// // Created by robin on 5/6/16. // #ifndef DIGICODE_HOST_ARDUINOSERIAL_H #define DIGICODE_HOST_ARDUINOSERIAL_H #include #include "../DBO/Result.h" #include "../config.h" class ArduinoSerial { public: ArduinoSerial(std::string port, int baudrate); virtual ~ArduinoSerial(); BResult open(); void close(); Result> read(); BResult write(const char* data, SERIAL_PACKET_LENGTH_TYPE length); protected: BResult readBytes(char* buffer, size_t length); BResult writeBytes(const char* data, size_t length); std::string port_; int bauderate_; int fd_; }; #endif //DIGICODE_HOST_ARDUINOSERIAL_H