2018-04-23 01:11:56 +02:00
|
|
|
#ifndef MACSERIALSTREAM_H_
|
|
|
|
#define MACSERIALSTREAM_H_
|
|
|
|
|
|
|
|
#include <Stream.h>
|
|
|
|
|
|
|
|
class MacSerialStream : public Stream
|
|
|
|
{
|
2018-05-07 23:51:17 +02:00
|
|
|
static const long kInputBufferSize = 8192;
|
2018-04-23 01:11:56 +02:00
|
|
|
static const long kReadBufferSize = 4096;
|
|
|
|
char inputBuffer[kInputBufferSize];
|
|
|
|
char readBuffer[kReadBufferSize];
|
|
|
|
|
|
|
|
short outRefNum, inRefNum;
|
2018-05-07 23:51:47 +02:00
|
|
|
int port, curBaud;
|
2018-04-23 01:11:56 +02:00
|
|
|
public:
|
|
|
|
virtual void write(const void* p, size_t n) override;
|
|
|
|
|
|
|
|
void idle();
|
|
|
|
|
2018-05-07 23:51:47 +02:00
|
|
|
MacSerialStream(int port = 0, int baud = 19200);
|
2018-04-23 01:11:56 +02:00
|
|
|
~MacSerialStream();
|
|
|
|
|
|
|
|
void close();
|
2018-04-27 02:06:54 +02:00
|
|
|
void open();
|
2018-04-24 22:06:32 +02:00
|
|
|
|
|
|
|
void setBaud(int baud);
|
2018-04-23 01:11:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|