1234567891011121314151617181920212223242526272829303132333435363738 |
- //
- // Created by robin on 5/6/16.
- //
-
- #ifndef DIGICODE_HOST_ARDUINOSERIAL_H
- #define DIGICODE_HOST_ARDUINOSERIAL_H
-
-
- #include <string>
- #include "../DBO/Result.h"
- #include "../config.h"
-
- class ArduinoSerial
- {
- public:
- ArduinoSerial(std::string port, int baudrate);
- virtual ~ArduinoSerial();
-
- BResult open();
- void close();
-
- Result<std::pair<SERIAL_PACKET_TYPE, std::string>> 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
|