Connectino Library
ConnectinoModule.h
1 #ifndef ConnectinoModule_h
2 #define ConnectinoModule_h
3 
11 {
12  public:
15  void begin();
16 
28  virtual bool moduleCallback(uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data) = 0;
29 
35  virtual uint8_t getModId() = 0;
36 
37  protected:
38  /*
39  * ConnectinoModule::append() are functions which append an array or a variable to a buffer,
40  * compute the remaining bufferSize and set the buffer pointer to the next free byte in the buffer.
41  * They return false if they failed because of the lack of space in the buffer (or are not implemented yet).
42  * numOfSizeBytes is an optional parameter which sets the number of bytes used to store the size information of the following array in a binuart frame
43  */
56  bool append(uint8_t ** buffer, uint16_t * bufferSize, const char data[], const uint8_t numOfSizeBytes = 1);
57 
70  bool append(uint8_t ** buffer, uint16_t * bufferSize, const uint8_t data[], const uint16_t dataSize, const uint8_t numOfSizeBytes = 1);
71 
81  bool append(uint8_t ** buffer, uint16_t * bufferSize, const bool data);
82 
92  bool append(uint8_t ** buffer, uint16_t * bufferSize, const uint8_t data);
93 
103  bool append(uint8_t ** buffer, uint16_t * bufferSize, const uint16_t data);
104 
114  bool append(uint8_t ** buffer, uint16_t * bufferSize, const uint32_t data);
115 };
116 
117 #endif
bool append(uint8_t **buffer, uint16_t *bufferSize, const char data[], const uint8_t numOfSizeBytes=1)
Append a string to the frames payload.
Definition: ConnectinoModule.cpp:8
void begin()
Starts the module.
Definition: ConnectinoModule.cpp:4
virtual bool moduleCallback(uint8_t subId, uint8_t reqId, uint16_t dataSize, uint8_t *data)=0
Callback function for serial frames of the Binuart module.
virtual uint8_t getModId()=0
Return the modules ID.
Binuart module.
Definition: ConnectinoModule.h:10