start new readme
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
# Addresed Networking Over UART (ANOU)
|
||||||
|
## Elmélet
|
||||||
|
Ennek a protokollnak a lényege, hogy egy egyszerű L3 réteget lehessen helyezni
|
||||||
|
az eléggé limitált UART protokoll fölé.
|
||||||
+23
-4
@@ -24,17 +24,17 @@ class ANOUServer
|
|||||||
char* addresses;
|
char* addresses;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char ConfigureSerialPort()
|
int ConfigureSerialPort()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char StartListener()
|
int StartListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char WriteSerialPort(char* message)
|
int WriteSerialPort(char* message)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
full_message[0] = TYPE_START + dst_addr << 2;
|
full_message[0] = TYPE_START + dst_addr << 2;
|
||||||
for (char i = 0; i < message_size; i++) full_message[i+1] = message[i];
|
for (char i = 0; i < message_size; i++) full_message[i+1] = message[i];
|
||||||
full_message[message_size+1] = TYPE_STOP + dst_addr << 2;
|
full_message[message_size+1] = TYPE_STOP + dst_addr << 2;
|
||||||
|
|
||||||
|
return full_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Response(char address)
|
char* Response(char address)
|
||||||
@@ -82,11 +84,25 @@ public:
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
char SHAW(char address, bool force_readdress = false)
|
int SHAW(char address = -1, bool force_readdress = false)
|
||||||
{
|
{
|
||||||
//Stateful Host Addressing Waterfall protocol
|
//Stateful Host Addressing Waterfall protocol
|
||||||
//sends out an addressing message with the address it wants to
|
//sends out an addressing message with the address it wants to
|
||||||
//assign. This will be assigned to the first client without an address
|
//assign. This will be assigned to the first client without an address
|
||||||
|
if (address == -1) {
|
||||||
|
//if no address is effectively specified, select the first available
|
||||||
|
//address
|
||||||
|
|
||||||
|
for (int i = 0; i < sizeof(addresses)/sizeof(int); i++)
|
||||||
|
{
|
||||||
|
if (i != addresses[i]) {
|
||||||
|
address = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
char message[2] = {
|
char message[2] = {
|
||||||
TYPE_SHAW + address << 2,
|
TYPE_SHAW + address << 2,
|
||||||
0b0
|
0b0
|
||||||
@@ -104,6 +120,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
WriteSerialPort(AssemblePacket(message, ADDR_BROADCAST));
|
WriteSerialPort(AssemblePacket(message, ADDR_BROADCAST));
|
||||||
|
//no need for response packet; the SHAW packet can only come
|
||||||
|
//from the host, therefore the clients will always ACK to the
|
||||||
|
//host address
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
+4
-4
@@ -11,11 +11,11 @@ class ANOUServer
|
|||||||
char* addresses; //known client addresses
|
char* addresses; //known client addresses
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char ConfigureSerialPort(); //configuring the serial port
|
int ConfigureSerialPort(); //configuring the serial port
|
||||||
char StartListener(); //start listening on the serial port
|
int StartListener(); //start listening on the serial port
|
||||||
char WriteSerialPort(char* message); //write the message to the serial port
|
int WriteSerialPort(char* message); //write the message to the serial port
|
||||||
char* AssemblePacket(char src_addr, char dst_addr, char* message); //assemble the full packet, with the source and destination address too
|
char* AssemblePacket(char src_addr, char dst_addr, char* message); //assemble the full packet, with the source and destination address too
|
||||||
char SHAW(bool force_readdress); //Stateful Host Addressing Waterfall protocol
|
int SHAW(bool force_readdress); //Stateful Host Addressing Waterfall protocol
|
||||||
|
|
||||||
char* SetVar6(char var_index, int var_value); //used to create a 6 bit long variable altering message
|
char* SetVar6(char var_index, int var_value); //used to create a 6 bit long variable altering message
|
||||||
char* SetVar12(char var_index, int var_value); //used to create a 12 bit long variable altering message
|
char* SetVar12(char var_index, int var_value); //used to create a 12 bit long variable altering message
|
||||||
|
|||||||
Reference in New Issue
Block a user