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

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

#include <Map27/DataLayer.h>

Public Member Functions

 Map27DataLayer ()
 Constructor.
 
void poll ()
 
void setPhysicalLayer (Map27PhysicalLayer *physicalLayer)
 
Map27PhysicalLayerphysicalLayer ()
 
void setNetworkLayer (Map27NetworkLayer *networkLayer)
 
Map27NetworkLayernetworkLayer ()
 
void setBaud (uint32_t baud)
 
uint32_t baud ()
 
Inputs from OS A2.2.2
void power_on ()
 
Inputs from PhysicalLayer A2.2.4

These members are called by the Physical LAyer in response toe events detected by it

void link_request (uint8_t n1, uint8_t k, uint8_t version)
 
void link_acknowledge (uint8_t n_r, uint8_t n_k)
 
void link_transfer (uint8_t n_s, uint8_t ar, uint8_t *buf, uint16_t bufLen)
 

Inputs from NetworkLayer

These members are called by the Network layer to control the Data Layer and queue mesage for transmission to the radio

void network_layer_reset ()
 
void credit_value (uint8_t r_k)
 
bool network_layer_packet (uint8_t *buf, uint16_t bufLen)
 
bool isReady ()
 
void reset ()
 
void resetLink ()
 
void link_establishment_timeout ()
 
void retry_timeout ()
 
void acknowledgement_timeout ()
 
void activity_timeout ()
 
void link_failure_detection_timeout ()
 
void adjust_link_parameters (uint8_t n1, uint8_t k, uint8_t version)
 
void decrement_retransmission_counter ()
 
void decrement_send_credit ()
 
void delete_acknowledged_packets (uint8_t n_r)
 
void increment_send_state ()
 
void initialise_variables ()
 
void initialise_rs232_port ()
 
void maximise_link_parameters ()
 
void record_send_credit (uint8_t n_r, uint8_t n_k)
 
void rewind_packet_number (uint8_t n_r)
 
void set_retransmission_counter (uint8_t c1xo)
 
void store_acknowledged_rx_sequence_number (uint8_t n_r)
 
void store_packet (uint8_t *buf, uint16_t bufLen)
 
void store_receive_credit ()
 
void update_receive_credit (uint8_t r_k)
 
void increment_receive_state ()
 
void decrement_receive_credit ()
 
bool acknowledgement_inside_window (uint8_t n_r)
 
bool all_transmitted_packets_acknowledged (uint8_t n_r)
 
bool immediate_reply_requested (uint8_t ar)
 
bool packet_out_of_sequence (uint8_t n_s)
 
bool packet_outside_window (uint8_t n)
 
bool receive_credit_available ()
 
bool received_parameters_acceptable (uint8_t n1, uint8_t k, uint8_t version)
 
bool repeated_link_acknowledge (uint8_t n_r)
 
bool retransmission_count_zero ()
 
bool send_credit_available ()
 
virtual void output_link_ready ()
 Outputs to Network Layer A2.2.7.
 
virtual void output_link_failure ()
 
virtual void output_packet_accepted ()
 
virtual void output_packet_rejected ()
 
virtual void output_network_layer_packet (uint8_t *buf, uint16_t bufLen)
 
virtual void output_link_request ()
 
virtual void output_link_acknowledge ()
 
virtual void output_link_transfer ()
 
uint32_t calc_retry_timeout ()
 
uint32_t calc_acknowledgement_timeout ()
 
static void link_establishment_timer_callback_glue (void *target)
 
static void retry_timer_callback_glue (void *target)
 
static void acknowledgement_timer_callback_glue (void *target)
 
static void activity_timer_callback_glue (void *target)
 
static void link_failure_detection_timer_callback_glue (void *target)
 

Detailed Description

Manage the Data Layer of the Map27 protocol stack.

This class receives raw messages from Network LAyer for transmission to the radio. It also receves low level frames from the Physical Layer and delivers them to Network Layer. It is responsible for establishing and maintaining the protocol link between this protocol stack and the radio. Based on Appendix A2

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

Member Function Documentation

uint32_t Map27DataLayer::baud ( )

Get the current baud rate

Returns
The current baud rate in baud (per second)
void Map27DataLayer::credit_value ( uint8_t  r_k)

Called by the Network Layer whenever it completes handling of a message and is able to handle more

Parameters
[in]r_kNumber of concurrent messages the Network Layer can now handle
Examples:
test.cpp, and test2.cpp.
bool Map27DataLayer::isReady ( )

Tells whether the Data Layer is READY and therefor whether the link to teh radio is established

Returns
tru if the Daa Layer is in READY state
void Map27DataLayer::link_acknowledge ( uint8_t  n_r,
uint8_t  n_k 
)

Called by Physical Layer when a Link Acknowledge (LA) message is received by the radio

Parameters
[in]n_rReceive sequence number
[in]n_kreceivet credit number
void Map27DataLayer::link_request ( uint8_t  n1,
uint8_t  k,
uint8_t  version 
)

Called by Physical Layer when a Linkrequest (LR) message is received by the radio

Parameters
[in]n1Maximum message length
[in]kWindow size
[in]versionProtocol version
void Map27DataLayer::link_transfer ( uint8_t  n_s,
uint8_t  ar,
uint8_t *  buf,
uint16_t  bufLen 
)

Called by Physical Layer when a Link Transfer (LT) message is received by the radio

Parameters
[in]n_sTransmit sequence number
[in]arImmediate Acknowledgement request
[in]bufPointer to the payload data
[in]bufLenNumber of bytes in buf
bool Map27DataLayer::network_layer_packet ( uint8_t *  buf,
uint16_t  bufLen 
)

Called by the Network Layer to queue a raw message for delivery to the radio

Parameters
[in]bufPointer to the message
[in]bufLenNumber of bytes in buf
Returns
true if the link is READY and the message was queued for delivery
Examples:
test.cpp.
void Map27DataLayer::network_layer_reset ( )

Called by Network Layer wen it requires to reset the Data Layer

Map27NetworkLayer * Map27DataLayer::networkLayer ( )

Get the current Network Layer pointer

Returns
The current Network Layer pointer, or NULL if previously set.
Map27PhysicalLayer * Map27DataLayer::physicalLayer ( )

Get the current Physical Layer pointer

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

Poll the Data 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: Map27NetworkLayer does this automatically when its poll() function is called.

void Map27DataLayer::power_on ( )

Powers on the Data LAyer and lower layers. Opens the port aand initialises it. initialises the Physical layer

void Map27DataLayer::setBaud ( uint32_t  baud)

Sets the desired baud rate to communicate with the radio. Typical choices are 9600 or 1200, but other speeds may be suported by your radio and RS232 hardware

Parameters
[in]baudThe desired baud rate in baud (per second)
void Map27DataLayer::setNetworkLayer ( Map27NetworkLayer networkLayer)

Sets the pointer to the NetworkLayer to use to deliver messages up the protocol stack

Parameters
[in]networkLayerPointer to the Netowrk Layer
Examples:
test.cpp, test2.cpp, and test3.cpp.
void Map27DataLayer::setPhysicalLayer ( Map27PhysicalLayer physicalLayer)

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

Parameters
[in]physicalLayerPointer to the Physical Layer
Examples:
test.cpp, test2.cpp, and test3.cpp.

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