Garmin Fleet Management Controller
2.19.0
|
Abstract base class for link Layers in the OSI model. More...
#include <LinkLayer.h>
Public Member Functions | |
virtual void | rx (uint8 const *const aData, uint32 const aSize)=0 |
Receive data from the physical layer. More... | |
void | setPhysicalLayer (PhysicalLayer *aPort) |
Set the physical layer. More... | |
void | setTransportLayer (TransportLayer *aTransport) |
Set the transport layer. More... | |
virtual bool | tx (Packet *aPacket)=0 |
Transmit data to the physical layer. More... | |
Protected Member Functions | |
LinkLayer () | |
Construct a LinkLayer. More... | |
virtual | ~LinkLayer () |
Destructor. More... | |
Protected Attributes | |
PhysicalLayer * | mPhysicalLayer |
The serial port that this link layer communicates with. More... | |
TransportLayer * | mTransportLayer |
The transport layer that this link layer communicates with. More... | |
Abstract base class for link Layers in the OSI model.
In the OSI model, the Data Link layer provides encapsulation of data packets into frames, frame synchronization, and possibly error control for errors at the physical layer.
Definition at line 26 of file LinkLayer.h.
|
protected |
Construct a LinkLayer.
Construct a link layer. Initially the LinkLayer is not connected to a PhysicalLayer or a TransportLayer.
Definition at line 18 of file LinkLayer.cpp.
|
protectedvirtual |
Destructor.
Definition at line 28 of file LinkLayer.cpp.
References mPhysicalLayer, PhysicalLayer::setLinkLayer(), and setPhysicalLayer().
Receive data from the physical layer.
The physical layer calls this function when data is received. The LinkLayer should append the data to what has been received so far, then find any frames and pass them up to the TransportLayer for processing.
aData | The data received |
aSize | The number of bytes received. |
Implemented in GarminLinkLayer.
Referenced by TcpIpPort::pumpRx(), and SerialPort::pumpRx().
void LinkLayer::setPhysicalLayer | ( | PhysicalLayer * | aPort | ) |
Set the physical layer.
Set the physical layer that this LinkLayer sends bytes to and receives bytes from.
aPort | The physical layer, or NULL if none. |
Definition at line 41 of file LinkLayer.cpp.
References mPhysicalLayer, and setTransportLayer().
Referenced by GarminLinkLayer::GarminLinkLayer(), GarminLinkLayer::resetPhysicalLayer(), ~LinkLayer(), SerialPort::~SerialPort(), and TcpIpPort::~TcpIpPort().
void LinkLayer::setTransportLayer | ( | TransportLayer * | aTransport | ) |
Set the transport layer.
Set the transport layer that this LinkLayer sends packets to and receives packets from.
aTransport | The physical layer, or NULL if none. |
Definition at line 55 of file LinkLayer.cpp.
References mTransportLayer.
Referenced by GarminTransportLayer::GarminTransportLayer(), setPhysicalLayer(), and GarminTransportLayer::~GarminTransportLayer().
|
pure virtual |
Transmit data to the physical layer.
The TransportLayer calls this function when a packet should be sent. The LinkLayer should send the raw bytes to the physical layer if it is up.
aPacket | The Packet to transmit. |
Implemented in GarminLinkLayer.
|
protected |
The serial port that this link layer communicates with.
Definition at line 74 of file LinkLayer.h.
Referenced by GarminLinkLayer::GarminLinkLayer(), GarminLinkLayer::resetPhysicalLayer(), setPhysicalLayer(), GarminLinkLayer::tx(), and ~LinkLayer().
|
protected |
The transport layer that this link layer communicates with.
Definition at line 77 of file LinkLayer.h.
Referenced by GarminLinkLayer::getPacketFromFifo(), and setTransportLayer().