gclogger/src/SerialPort.h

40 lines
635 B
C++

//
// Created by h44z on 07.05.19.
//
#ifndef GCLOGGER_SERIALPORT_H
#define GCLOGGER_SERIALPORT_H
#include <iostream>
#include <string>
#include <termios.h> // POSIX terminal control definitions
#include <unistd.h>
#include <fcntl.h>
using namespace std;
class SerialPort {
int fd;
struct termios tio;
int tioBaud;
int getTioBaud(int);
public:
// Constructor
SerialPort();
SerialPort(const string&, int);
~SerialPort();
bool isOpen();
bool serialClose();
int serialRead(string, int);
int serialWrite(const string&);
bool clearInput(int);
};
#endif //GCLOGGER_SERIALPORT_H