EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoPacketStream.h
Go to the documentation of this file.
1 /******************************************************************************
2  DISCLAIMER
3 
4  THIS SOFTWARE PRODUCT ("SOFTWARE") IS PROPRIETARY TO ENOCEAN GMBH, OBERHACHING,
5  GERMANY (THE "OWNER") AND IS PROTECTED BY COPYRIGHT AND INTERNATIONAL TREATIES OR
6  PROTECTED AS TRADE SECRET OR AS OTHER INTELLECTUAL PROPERTY RIGHT. ALL RIGHTS, TITLE AND
7  INTEREST IN AND TO THE SOFTWARE, INCLUDING ANY COPYRIGHT, TRADE SECRET OR ANY OTHER
8  INTELLECTUAL PROPERTY EMBODIED IN THE SOFTWARE, AND ANY RIGHTS TO REPRODUCE,
9  DISTRIBUTE, MODIFY, DISPLAY OR OTHERWISE USE THE SOFTWARE SHALL EXCLUSIVELY VEST IN THE
10  OWNER. ANY UNAUTHORIZED REPRODUCTION, DISTRIBUTION, MODIFICATION, DISPLAY OR OTHER
11  USE OF THE SOFTWARE WITHOUT THE EXPLICIT PERMISSION OF OWNER IS PROHIBITED AND WILL
12  CONSTITUTE AN INFRINGEMENT OF THE OWNER'S RIGHT AND MAY BE SUBJECT TO CIVIL OR
13  CRIMINAL SANCTION.
14 
15  THIS SOFTWARE IS PROVIDED BY THE OWNER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN PARTICULAR, THE OWNER DOES NOT WARRANT
18  THAT THE SOFTWARE SHALL BE ERROR FREE AND WORKS WITHOUT INTERRUPTION.
19 
20  IN NO EVENT SHALL THE OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  ******************************************************************************/
27 
34 #if !defined(EO_PACKETSTREAM_H)
35 #define EO_PACKETSTREAM_H
36 
37 #include "eoHalTypes.h"
38 #include "eoApiDef.h"
39 #include "eoPacket.h"
40 
41 /****************************Defines******************************/
43 #define SER_SYNCH_CODE 0x55
44 #define SER_HEADER_NR_BYTES 4
46 #define SER_INTERBYTE_TIME_OUT 100
48 
59 {
60 private:
61  typedef enum
62  {
64  GET_SYNC_STATE = 0,
66  GET_HEADER_STATE,
68  CHECK_CRC8H_STATE,
70  GET_DATA_STATE,
72  CHECK_CRC8D_STATE
73 
74  } STATES_GET_PACKET;
75 
77  uint8_t u8CRC;
79  uint16_t u16Count;
81  STATES_GET_PACKET u8State;
83  uint32_t u32LastTimeoutCheckTickCount;
85  uint32_t u32LastByteReceivedTickCount;
87  eoPacket receivePacket;
88 
89 public:
94  virtual ~eoPacketStream();
95 
101  virtual eoReturn Open(const char *port) = 0;
105  virtual void Close() = 0;
106 
115  virtual eoReturn Receive(eoPacket *p);
121  virtual eoReturn ReceiveByte(uint8_t *d) = 0;
127  virtual eoReturn Send(const eoPacket &p);
133  virtual eoReturn SendByte(uint8_t d) = 0;
138  virtual bool IsPacketPending();
139 
140 };
141 #endif // !defined(EO_PACKETSTREAM_H)
contains Dolphin API Definitions
virtual bool IsPacketPending()
virtual eoReturn Receive(eoPacket *p)
virtual eoReturn SendByte(uint8_t d)=0
eoReturn
contains all the return values from different functions
Definition: eoApiDef.h:40
The base class for all PacketStreams Implementations.
Definition: eoPacketStream.h:58
virtual eoReturn ReceiveByte(uint8_t *d)=0
Class which contains a Packet.
Definition: eoPacket.h:43
virtual void Close()=0
virtual eoReturn Send(const eoPacket &p)
virtual eoReturn Open(const char *port)=0