EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoPacketStream Class Referenceabstract

The base class for all PacketStreams Implementations. More...

#include <eoPacketStream.h>

Inheritance diagram for eoPacketStream:

Public Member Functions

 eoPacketStream ()
 
virtual eoReturn Open (const char *port)=0
 
virtual void Close ()=0
 
virtual eoReturn Receive (eoPacket *p)
 
virtual eoReturn ReceiveByte (uint8_t *d)=0
 
virtual eoReturn Send (const eoPacket &p)
 
virtual eoReturn SendByte (uint8_t d)=0
 
virtual bool IsPacketPending ()
 

Detailed Description

The base class for all PacketStreams Implementations.

PacketStream is an abstract base class for the Hardware specific xyPacketStream Classes. It contains the Important PacketStream::Receive and PacketStream::Send Functions to receive and send [ESP3] Packets. The specific Hardware classed have to implement at least SendByte and ReceiveByte to get the Bytes.

Constructor & Destructor Documentation

◆ eoPacketStream()

eoPacketStream::eoPacketStream ( )

Constructor for eoPacketStream, Inits the necessary Hardware and opens the ports

Member Function Documentation

◆ Close()

virtual void eoPacketStream::Close ( )
pure virtual

Close the Port

Implemented in eoLinuxPacketStream, eoMacPacketStream, and eoWin32PacketStream.

◆ IsPacketPending()

virtual bool eoPacketStream::IsPacketPending ( )
virtual

Checks if a packet is currently received through the receive line, but is not yet fully received.

Returns
true if a packet is pending, false if no packet is currently received

◆ Open()

virtual eoReturn eoPacketStream::Open ( const char *  port)
pure virtual

Tries to Open and initialize the specific port for the eoPacketStream

Parameters
portto open; for example "/dev/USB300"
Returns
eoReturn EO_OK if everything was ok else eoReturn PORT_ERROR

Implemented in eoLinuxPacketStream, eoMacPacketStream, and eoWin32PacketStream.

◆ Receive()

virtual eoReturn eoPacketStream::Receive ( eoPacket p)
virtual

This functions will parse all the available bytes in the Stream, and tries to find an ESP3 Packet. It will Return EO_OK if we found one, or NEW_RX_BYTE if we've received some bytes but not yet a full Packet.

Parameters
pPointer to eoPacket to be filled
Returns
Returns a eoReturn
Examples:
linuxPacketStream_example.cpp, and packetStream_example.cpp.

◆ ReceiveByte()

virtual eoReturn eoPacketStream::ReceiveByte ( uint8_t *  d)
pure virtual
Parameters
dPointer where to write the Byte
Returns
Returns a eoReturn

Implemented in eoWin32PacketStream, eoLinuxPacketStream, and eoMacPacketStream.

◆ Send()

virtual eoReturn eoPacketStream::Send ( const eoPacket p)
virtual
Parameters
pThe eoPacket to send
Returns
Returns a eoReturn
Examples:
linuxPacketStream_example.cpp, and packetStream_example.cpp.

◆ SendByte()

virtual eoReturn eoPacketStream::SendByte ( uint8_t  d)
pure virtual
Parameters
dThe byte to send
Returns
Returns a eoReturn

Implemented in eoWin32PacketStream, eoLinuxPacketStream, and eoMacPacketStream.