27#if defined(_WIN32) || defined(_WIN64)
48#define UNUSED(x) (void) (x)
68 char openDevice(
const char* Device,
const unsigned int Bauds);
80 char readChar(
char* pByte,
const unsigned int timeOut_ms = 0);
89 int readString(
char* receivedString,
char finalChar,
unsigned int maxNbBytes,
90 const unsigned int timeOut_ms = 0);
96 char writeBytes(
const void* Buffer,
const unsigned int NbBytes);
99 int readBytes(
void* buffer,
unsigned int maxNbBytes,
const unsigned int timeOut_ms = 0,
100 unsigned int sleepDuration_us = 100);
115 bool DTR(
bool status);
120 bool RTS(
bool status);
144 int readStringNoTimeOut(
char* String,
char FinalChar,
unsigned int MaxNbBytes);
147 bool currentStateRTS;
148 bool currentStateDTR;
150#if defined(_WIN32) || defined(_WIN64)
154 COMMTIMEOUTS timeouts;
178 struct timeval previousTime;
bool setRTS()
Set the bit RTS (pin 7) RTS stands for Data Terminal Ready.
Definition serialib.cpp:720
serialib()
Constructor of the class serialib.
Definition serialib.cpp:29
bool DTR(bool status)
Set or unset the bit DTR (pin 4) DTR stands for Data Terminal Ready Convenience method :This method c...
Definition serialib.cpp:643
bool isDSR()
Get the DSR's status (pin 6) DSR stands for Data Set Ready.
Definition serialib.cpp:782
bool isDTR()
Get the DTR's status (pin 4) DTR stands for Data Terminal Ready May behave abnormally on Windows.
Definition serialib.cpp:841
int available()
Return the number of bytes in the received buffer (UNIX only).
Definition serialib.cpp:612
char flushReceiver()
Empty receiver buffer.
Definition serialib.cpp:595
bool RTS(bool status)
Set or unset the bit RTS (pin 7) RTS stands for Data Termina Ready Convenience method :This method ca...
Definition serialib.cpp:705
char openDevice(const char *Device, const unsigned int Bauds)
Open the serial port.
Definition serialib.cpp:92
bool isDCD()
Get the DCD's status (pin 1) CDC stands for Data Carrier Detect.
Definition serialib.cpp:802
bool isRI()
Get the RING's status (pin 9) Ring Indicator.
Definition serialib.cpp:821
char writeString(const char *String)
Write a string on the current serial port.
Definition serialib.cpp:311
char readChar(char *pByte, const unsigned int timeOut_ms=0)
Wait for a byte from the serial device and return the data read.
Definition serialib.cpp:371
bool setDTR()
Set the bit DTR (pin 4) DTR stands for Data Terminal Ready.
Definition serialib.cpp:658
void closeDevice()
Close the connection with the current device.
Definition serialib.cpp:264
char writeBytes(const void *Buffer, const unsigned int NbBytes)
Write an array of data on the current serial port.
Definition serialib.cpp:342
char writeChar(char)
Write a char on the current serial port.
Definition serialib.cpp:282
int readBytes(void *buffer, unsigned int maxNbBytes, const unsigned int timeOut_ms=0, unsigned int sleepDuration_us=100)
Read an array of bytes from the serial device (with timeout).
Definition serialib.cpp:536
bool clearRTS()
Clear the bit RTS (pin 7) RTS stands for Data Terminal Ready.
Definition serialib.cpp:742
int readString(char *receivedString, char finalChar, unsigned int maxNbBytes, const unsigned int timeOut_ms=0)
Read a string from the serial device (with timeout).
Definition serialib.cpp:466
bool isRTS()
Get the RTS's status (pin 7) RTS stands for Request To Send May behave abnormally on Windows.
Definition serialib.cpp:859
bool isCTS()
Get the CTS's status (pin 8) CTS stands for Clear To Send.
Definition serialib.cpp:763
bool clearDTR()
Clear the bit DTR (pin 4) DTR stands for Data Terminal Ready.
Definition serialib.cpp:680
timeOut()
Constructor of the class timeOut.
Definition serialib.cpp:879
void initTimer()
Initialise the timer. It writes the current time of the day in the structure PreviousTime.
Definition serialib.cpp:887
unsigned long int elapsedTime_ms()
Returns the time elapsed since initialization. It write the current time of the day in the structure ...
Definition serialib.cpp:899