OSTC Companion  3.0
Companion sofftware for H&W dive computers
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
Emulator::Fifo Class Reference

a basic one-way communication line between threads. Should handle all the Serial protocol. More...

#include <Emulator.h>

Public Member Functions

 Fifo ()
 
void writeByte (byte b)
 Send one byte to the queue. More...
 
byte readByte (bool noTimeout=false)
 Wait for the next byte from the queue, and return it. More...
 
void writeBlock (const byte *data, int len)
 
void readBlock (byte *data, int len)
 
void purge ()
 Delete all pending bytes from the queue. More...
 
void flush ()
 Wait for the queue to empty. More...
 

Public Attributes

int timeout
 Read max wait delay, in millisecondes. More...
 

Detailed Description

a basic one-way communication line between threads. Should handle all the Serial protocol.

See also
Serial, SerialTest.

Constructor & Destructor Documentation

Emulator::Fifo::Fifo ( )

Member Function Documentation

void Emulator::Fifo::flush ( )

Wait for the queue to empty.

Exceptions
after1sec if there is still bytes in the queue.
void Emulator::Fifo::purge ( )

Delete all pending bytes from the queue.

void Emulator::Fifo::readBlock ( Emulator::byte data,
int  len 
)
Parameters
[in]datapointer to store bytes received from the queue.
[in]lennumber of bytes to wait for.
Exceptions
whentimeout is exceeded while waitting for the next byte.
Emulator::byte Emulator::Fifo::readByte ( bool  noTimeout = false)

Wait for the next byte from the queue, and return it.

Exceptions
whentimeout is exceeded.
void Emulator::Fifo::writeBlock ( const byte data,
int  len 
)
Parameters
[in]datapointer to bytes to send to the queue.
[in]lennumber of bytes.
void Emulator::Fifo::writeByte ( Emulator::byte  b)

Send one byte to the queue.

Note
there is not fifo size limit, which is not very realist...

Member Data Documentation

int Emulator::Fifo::timeout

Read max wait delay, in millisecondes.


The documentation for this class was generated from the following files: