#ifndef LIB_COM_H_
#define LIB_COM_H_
#include <stddef.h>
#include <stdint.h>
#include "lib_com_abase.h"
class comlink {
public:
comlink(com_abase * comdevice) : device(comdevice) {}
~comlink() { shutdown(); }
void shutdown() { device->shutdown(); }
void put( char c ) { device->put(c); }
void flush() { device->flush(); }
int get() { return( device->get() ); }
uint8_t is_ready() { return( device->is_ready() );}
protected:
com_abase * device;
};
class textlink : public comlink {
public:
textlink(com_abase * comdevice) : comlink(comdevice) {}
void puts(const char* text);
void gets( char* text, size_t max_size);
};
class console : public comlink {
public:
console(com_abase * comdevice) : comlink(comdevice) {}
void puts(const char* text);
void edit( char* text, size_t max_size);
};
class binarylink : public comlink {
public:
binarylink(com_abase * comdevice) : comlink(comdevice) {}
void write(const char* buffer, size_t length);
void read ( char* buffer, size_t length);
};
#endif