Garmin Fleet Management Controller  2.19.0
LinkLayer Class Referenceabstract

Abstract base class for link Layers in the OSI model. More...

#include <LinkLayer.h>

+ Inheritance diagram for LinkLayer:

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

PhysicalLayermPhysicalLayer
 The serial port that this link layer communicates with. More...
 
TransportLayermTransportLayer
 The transport layer that this link layer communicates with. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

LinkLayer::LinkLayer ( )
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.

LinkLayer::~LinkLayer ( )
protectedvirtual

Destructor.

Definition at line 28 of file LinkLayer.cpp.

References mPhysicalLayer, PhysicalLayer::setLinkLayer(), and setPhysicalLayer().

Member Function Documentation

virtual void LinkLayer::rx ( uint8 const *const  aData,
uint32 const  aSize 
)
pure virtual

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.

Parameters
aDataThe data received
aSizeThe 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.

Parameters
aPortThe 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.

Parameters
aTransportThe physical layer, or NULL if none.

Definition at line 55 of file LinkLayer.cpp.

References mTransportLayer.

Referenced by GarminTransportLayer::GarminTransportLayer(), setPhysicalLayer(), and GarminTransportLayer::~GarminTransportLayer().

virtual bool LinkLayer::tx ( Packet aPacket)
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.

Parameters
aPacketThe Packet to transmit.
Returns
true if the data was sent, false otherwise.

Implemented in GarminLinkLayer.

Member Data Documentation

PhysicalLayer* LinkLayer::mPhysicalLayer
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().

TransportLayer* LinkLayer::mTransportLayer
protected

The transport layer that this link layer communicates with.

Definition at line 77 of file LinkLayer.h.

Referenced by GarminLinkLayer::getPacketFromFifo(), and setTransportLayer().


The documentation for this class was generated from the following files: