std::string portname
HANDLE port_h
- open this with CreateFile
mutex shutdown_mutex
- mutex to lock shutdown procedure
OVERLAPPED os
- allows background data loading
DWORD dwEvtMask
- this var just keep the status of previous call of wait_comport_event()
std::string internal_buffer
- internal buffer where get_data function places intermediate data
comport( const std::string &comport_name )
- arg is com1 or com2. Do not connect immediately
void init()
- init only there
void shutdown()
~comport()
bool wait_comport_event()
- this is a blocking call which does not returns until some activity on
port happens. We can do that because this thread have nothing to do
if no data in port. It returns true if new data is awailable. It
happens that it returns false if new event is coming but this is
not a data event
text_data* get_data()
- fill given structures with data. If it happens that data from comport
are invalid or end-of-line is not reached yet - return NULL.
The structure is allocated inside this function and pointer is
released - you are responsible to clean-up it