Garmin Fleet Management Controller  2.19.0
GarminTransportLayer.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * HEADER NAME:
4 * GarminTransportLayer.h
5 *
6 * Copyright 2008-2009 by Garmin Ltd. or its subsidiaries.
7 *---------------------------------------------------------------------
8 * $NoKeywords$
9 *********************************************************************/
10 #ifndef GarminTransportLayer_H
11 #define GarminTransportLayer_H
12 
14 
15 #include <time.h>
16 
17 #include "TimerListener.h"
18 #include "TransportLayer.h"
19 #include "ApplicationLayer.h"
20 #include "GarminLinkLayer.h"
21 #include "GarminPacket.h"
22 
23 //----------------------------------------------------------------------
41 //----------------------------------------------------------------------
43 {
44 
45 private:
47  typedef std::list<GarminPacket *> PacketList;
48 
49 public:
51  static void destroyInstance();
52 
53  virtual void tx
54  (
55  Packet * aPacket,
56  bool aSendImmediate
57  );
58  virtual void onTimer();
59 
60  void rx
61  (
62  Packet * aPacket
63  );
64  virtual void retry();
65 
66 private:
68  virtual ~GarminTransportLayer();
69 
70  bool sendPacket();
71 
74 
77 
80  PacketList mTransmitQueue;
81 
83  bool mCommError;
84 
87 
90 };
91 
92 #endif
virtual void tx(Packet *aPacket, bool aSendImmediate)
Transmit a Packet.
static GarminTransportLayer * sInstance
The one and only instance of this class.
void rx(Packet *aPacket)
Packet receive callback.
bool mCommError
If true, a communication error has occurred (transmit is suspended)
PacketList mTransmitQueue
Queue of packets being transmitted; the head of the queue may have been sent but is not ACKed...
std::list< GarminPacket * > PacketList
A list of packets.
static void destroyInstance()
Delete the one and only GarminTransportLayer instance.
Garmin serial packet.
Definition: GarminPacket.h:26
virtual void onTimer()
Periodic callback.
bool sendPacket()
Send a Packet.
GarminPacket * mLastNakSent
A copy of the most recently sent NAK.
virtual ~GarminTransportLayer()
GarminTransportLayer destructor.
Abstract base class for transport layer in the OSI model.
Abstract base class for a packet of data.
Definition: Packet.h:18
virtual void retry()
Tries to resend the most recently sent packet.
GarminLinkLayer * mLinkLayer
The link layer that frames are sent/received from.
Transport layer in the OSI communication model.
Abstract base class for objects that need to do something periodically.
Definition: TimerListener.h:21
GarminTransportLayer()
Construct a GarminTransportLayer.
Link Layer in the OSI model.
GarminPacket * mLastAckSent
A copy of the most recently sent ACK.
static GarminTransportLayer * getInstance()
Get the one and only GarminTransportLayer.