2015-04-11 19:28:53 +01:00
|
|
|
#ifndef _SerialChannel_h_
|
|
|
|
#define _SerialChannel_h_
|
|
|
|
|
|
|
|
class SerialChannel
|
|
|
|
{
|
|
|
|
private:
|
2015-04-12 11:16:54 +01:00
|
|
|
static SerialChannel* first;
|
|
|
|
SerialChannel* next;
|
|
|
|
|
|
|
|
static byte nextId;
|
|
|
|
byte id;
|
|
|
|
const char* name;
|
2015-04-11 19:28:53 +01:00
|
|
|
|
|
|
|
public:
|
2015-04-12 11:16:54 +01:00
|
|
|
SerialChannel(const char* name_);
|
2015-04-11 19:28:53 +01:00
|
|
|
|
2015-04-12 11:16:54 +01:00
|
|
|
void write(byte* data, short byteCount, unsigned long time = (unsigned long)-1);
|
2015-04-11 19:28:53 +01:00
|
|
|
|
2015-04-12 11:16:54 +01:00
|
|
|
void write(const char* text, unsigned long time = (unsigned long)-1);
|
2015-04-16 18:30:57 +01:00
|
|
|
|
|
|
|
void beginWrite(short byteCount, unsigned long time = (unsigned long)-1);
|
|
|
|
void continueWrite(byte* data, short byteCount);
|
2015-04-11 19:28:53 +01:00
|
|
|
|
2015-04-12 11:16:54 +01:00
|
|
|
private:
|
|
|
|
void handleConnection();
|
|
|
|
void writeShort(short num);
|
|
|
|
void writeULong(unsigned long num);
|
2015-04-11 19:28:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|