Garmin Fleet Management Controller  2.19.0
GarminLinkLayer.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * HEADER NAME:
4 * GarminLinkLayer.h
5 *
6 * Copyright 2008-2016 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #ifndef GarminLinkLayer_H
11 #define GarminLinkLayer_H
12 
13 class GarminLinkLayer;
14 
15 #include "LinkLayer.h"
16 #include "GarminPacket.h"
17 
20 #define FIFO_SIZE ( 1024 )
21 
22 //----------------------------------------------------------------------
38 //----------------------------------------------------------------------
39 class GarminLinkLayer : public LinkLayer
40 {
41 public:
42  static GarminLinkLayer * getInstance();
43  static void destroyInstance();
44 
45  virtual bool tx
46  (
47  Packet * aPacket
48  );
49 
50  virtual void rx
51  (
52  uint8 const * const aData,
53  uint32 const aSize
54  );
55 
57  (
58  PhysicalLayer * aPort
59  );
60 
61 private:
63  struct fifo_type
64  {
69  };
70 
73 
74  int numBytesInFifo();
75  bool getPacketFromFifo();
76  void getDataFromFifo
77  (
78  uint8 * aData,
79  uint32 aSize
80  );
81  void incrementHead
82  (
83  uint32 aIncrement
84  );
85 protected:
86 
87 private:
90 
94 };
95 
96 #endif
Abstract base class for the physical layer.
Definition: PhysicalLayer.h:25
virtual void rx(uint8 const *const aData, uint32 const aSize)
Copy Data to FIFO.
A circular FIFO buffer for processing received bytes into packets.
int numBytesInFifo()
Calculate the number of bytes in the FIFO buffer.
GarminLinkLayer()
Construct a new GarminLinkLayer.
uint32 head
Index of first byte of data.
static GarminLinkLayer * getInstance()
Get the one and only link layer object.
bool getPacketFromFifo()
Frame Packet.
uint8 buffer[FIFO_SIZE]
Data buffer.
Abstract base class for link Layers in the OSI model.
Definition: LinkLayer.h:26
fifo_type mFifo
FIFO (First-In, First-Out) buffer used to store bytes received from the client until they are parsed ...
void resetPhysicalLayer(PhysicalLayer *aPort)
Reset the physical layer.
void incrementHead(uint32 aIncrement)
Increment FIFO head.
Abstract base class for a packet of data.
Definition: Packet.h:18
void getDataFromFifo(uint8 *aData, uint32 aSize)
Get Data From FIFO.
uint32 tail
Index of last byte of data.
unsigned char uint8
8-bit unsigned integer
Definition: garmin_types.h:62
static GarminLinkLayer * sInstance
The one and only instance of this class.
uint32 size
Number of bytes of data in the buffer.
Link Layer in the OSI model.
#define FIFO_SIZE
The size of the server's internal FIFO buffer for parsing raw data into packets for processing...
unsigned long int uint32
32-bit unsigned integer
Definition: garmin_types.h:66
static void destroyInstance()
Delete the one and only link layer object.
virtual bool tx(Packet *aPacket)
Transmit a packet.