From 02e24f0f533fe904c3a5275c4060c10c38d7c17a Mon Sep 17 00:00:00 2001 From: Ján Sučan Date: Wed, 10 May 2017 15:13:29 +0200 Subject: Uvodny commit, subory su rovnake ako na CD prilozenom k vytlacenemu texu bakalarskej prace, naviac je pridany len subor LICENCIA --- SerialPort/SerialPortUnix.hpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 SerialPort/SerialPortUnix.hpp (limited to 'SerialPort/SerialPortUnix.hpp') diff --git a/SerialPort/SerialPortUnix.hpp b/SerialPort/SerialPortUnix.hpp new file mode 100755 index 0000000..db1ae73 --- /dev/null +++ b/SerialPort/SerialPortUnix.hpp @@ -0,0 +1,35 @@ +#ifndef SERIAL_PORT_UNIX_H +#define SERIAL_PORT_UNIX_H 1 + +#include + +#include +#include "SerialPort.hpp" + +using std::vector; +using std::pair; + +class CSerialPortUnix : public CSerialPort { +private: + int mSerialPortFd; + string mPortName; + vector< pair > mBaudrates; + + vector> getDeviceSpeeds(); + pair findSpeed(string speed, const vector> & list); + void setSpeed(pair speed); + void openPort(string portName); + + ssize_t readSingle(uint8_t *data, int data_length); + ssize_t writeSingle(uint8_t *data, int data_length); +public: + CSerialPortUnix(); + ~CSerialPortUnix(); + + void open(string portName, string speed); + string getSpeeds(string portName); + + void close(); +}; + +#endif -- cgit v1.2.3