From 1d5f4f0fdd542f4db40f39d0294a0e5deb4c6b6d Mon Sep 17 00:00:00 2001 From: Beluzsar Peter Date: Thu, 8 Oct 2026 14:10:53 +0200 Subject: [PATCH] initial commit --- .gitignore | 1 + examples/main.cpp | 0 src/anou.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++ src/anou.h | 19 ++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 .gitignore create mode 100644 examples/main.cpp create mode 100644 src/anou.cpp create mode 100644 src/anou.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/build diff --git a/examples/main.cpp b/examples/main.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/anou.cpp b/src/anou.cpp new file mode 100644 index 0000000..dc3be6f --- /dev/null +++ b/src/anou.cpp @@ -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()) + + } + + + } + +}; \ No newline at end of file diff --git a/src/anou.h b/src/anou.h new file mode 100644 index 0000000..c3dbb9f --- /dev/null +++ b/src/anou.h @@ -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 \ No newline at end of file