initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
#include "anou.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define TYPE_DATA 0b0
|
||||||
|
#define TYPE_START 0b1
|
||||||
|
#define TYPE_STOP 0b10
|
||||||
|
#define TYPE_SHAW 0b11
|
||||||
|
|
||||||
|
#define ADDR_BROADCAST 0b111111
|
||||||
|
#define ADDR_HOST 0b0
|
||||||
|
|
||||||
|
class ANOUServer
|
||||||
|
{
|
||||||
|
char* portname;
|
||||||
|
char buffer[1024];
|
||||||
|
|
||||||
|
int* addresses;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int ConfigureSerialPort()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int StartListener()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int WriteSerialPort(char* message)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char* AssemblePacket(int src_addr = ADDR_HOST, int dst_addr, char** message)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char* AssembleMessage(int type, char* mode, char* value)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int SHAW(bool force_readdress)
|
||||||
|
{
|
||||||
|
//Stateful Host Addressing Waterfall protocol
|
||||||
|
//sends out an addressing message with the address it wants to
|
||||||
|
//assign. This will be assigned to the first client without an address
|
||||||
|
if (force_readdress)
|
||||||
|
{
|
||||||
|
//force readdressing ignores, whether the clients have
|
||||||
|
//an address or not. clients are required to forward this message
|
||||||
|
//with an increased address (so client 1 gets addr 1 and sends)
|
||||||
|
//a force readdress SHAW packet downstream with addr 2 and force_readdress
|
||||||
|
//enabled
|
||||||
|
|
||||||
|
WriteSerialPort(AssemblePacket())
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#ifndef ANOU_H
|
||||||
|
#define ANOU_H
|
||||||
|
|
||||||
|
class ANOUServer
|
||||||
|
{
|
||||||
|
char* portname; //name of the serial port (eg.: /dev/ttyUSB1)
|
||||||
|
char buffer[1024]; //message buffer
|
||||||
|
int* addresses; //known client addresses
|
||||||
|
|
||||||
|
public:
|
||||||
|
int ConfigureSerialPort(); //configuring the serial port
|
||||||
|
int StartListener(); //start listening on the serial port
|
||||||
|
int WriteSerialPort(char* message); //write the message to the serial port
|
||||||
|
char* AssemblePacket(int src_addr, int dst_addr, char** message)
|
||||||
|
char* AssembleMessage(int type, char* mode, char* value); //append the value and the message type to the message mode
|
||||||
|
int SHAW(bool force_readdress); //Stateful Host Addressing Waterfall protocol
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user