Map27
 All Classes Functions Variables Enumerations Enumerator Pages
Classes | Public Member Functions | List of all members
Map27PhysicalLayer Class Reference

Manage the Physical Layer of the Map27 protocol stack. More...

#include <Map27/PhysicalLayer.h>

Public Member Functions

 Map27PhysicalLayer ()
 Constructor.
 
void setPort (Map27Port *port)
 
Map27Portport ()
 
void setDataLayer (Map27DataLayer *dataLayer)
 
Map27DataLayerdataLayer ()
 
void reset ()
 
bool configure_rs232_port (uint32_t baud=9600)
 
void send (uint8_t *buf, uint16_t len)
 
virtual void sendToPort (uint8_t ch)
 
void sendLinkRequest (uint8_t n1, uint8_t k, uint8_t version)
 
void sendLinkAcknowledge (uint8_t n_r, uint8_t n_k)
 
void sendLinkTransfer (uint8_t n_s, uint8_t ar, uint8_t *buf, uint16_t bufLen)
 
void poll ()
 
void clearRxBuf ()
 

Detailed Description

Manage the Physical Layer of the Map27 protocol stack.

This class reads data from the device Port and formats the data into complete frames and checks their FCS. Its also formats outdoing messages with framing and frame check characters

Examples:
test.cpp, test2.cpp, and test3.cpp.

Member Function Documentation

void Map27PhysicalLayer::clearRxBuf ( )

Clears the incoming message buffer, perhaps to due a link reset

bool Map27PhysicalLayer::configure_rs232_port ( uint32_t  baud = 9600)

Configures the desiredbaud rate to use on the Port the next time it is opened

Parameters
[in]baudThe baud rate to set, in bauds (per second)
Returns
true if successful
Map27DataLayer * Map27PhysicalLayer::dataLayer ( )

Get the current Data Layer pointer

Returns
The current Data Layer pointer, or NULL if previously set.
void Map27PhysicalLayer::poll ( )

Poll the Physical Layer for timer and input events from lower layers in the protocol stack In Unix/Linux and Arduino environments, you are required to call this at least as frequently as octets might be received from the radio. At least every 10msec would be appropriate for a 9600 baud connection. Note: Map27DataLayer does this automatically when its poll() function is called.

Map27Port * Map27PhysicalLayer::port ( )

Get the current Port pointer

Returns
The current Port pointer, or NULL if previously set.
void Map27PhysicalLayer::reset ( )

Resets the port by closing and reopenng it

void Map27PhysicalLayer::send ( uint8_t *  buf,
uint16_t  len 
)

Sends a complete message to the radio. Prefixes the message withthe frame start, does data stuffing, and adds the frame end and FCS

Parameters
[in]bufPointer to the data payload to send
[in]lenNumber of bytes in buf
void Map27PhysicalLayer::sendLinkAcknowledge ( uint8_t  n_r,
uint8_t  n_k 
)

Sends a Link Acknowledge (LA) messgae to the Port

Parameters
[in]n_rreceive sequence number
[in]n_kReceive credit number
void Map27PhysicalLayer::sendLinkRequest ( uint8_t  n1,
uint8_t  k,
uint8_t  version 
)

Sends a Link Request (LR) message to the Port

Parameters
[in]n1The requested maimum message size
[in]kThe requested maximum window size
[in]versionThe requested protocol version
void Map27PhysicalLayer::sendLinkTransfer ( uint8_t  n_s,
uint8_t  ar,
uint8_t *  buf,
uint16_t  bufLen 
)

Sends a Link Transfer (LT) messgae to the Port

Parameters
[in]n_sTransmit sequence number
[in]arImmediate Acknowledgement request
[in]bufPointer to the payload data
[in]bufLenNumber of bytes in buf
void Map27PhysicalLayer::sendToPort ( uint8_t  ch)
virtual

Sends a single octet to the current Port

Parameters
[in]chTheoctet to send
void Map27PhysicalLayer::setDataLayer ( Map27DataLayer dataLayer)

Sets the pointer to the Data LAyer to use to deliver messages up the protocol stack

Parameters
[in]dataLayerPointer to the Data Layer
Examples:
test.cpp, test2.cpp, and test3.cpp.
void Map27PhysicalLayer::setPort ( Map27Port port)

Sets the pointer to the Port to use to communicate with the Radio

Parameters
[in]portPointer to the Port
Examples:
test.cpp, test2.cpp, and test3.cpp.

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