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) |
Map27PhysicalLayer * | physicalLayer () |
void | setNetworkLayer (Map27NetworkLayer *networkLayer) |
Map27NetworkLayer * | networkLayer () |
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) |
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
uint32_t Map27DataLayer::baud | ( | ) |
Get the current baud rate
void Map27DataLayer::credit_value | ( | uint8_t | r_k | ) |
bool Map27DataLayer::isReady | ( | ) |
Tells whether the Data Layer is READY and therefor whether the link to teh radio is established
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
[in] | n_r | Receive sequence number |
[in] | n_k | receivet 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
[in] | n1 | Maximum message length |
[in] | k | Window size |
[in] | version | Protocol 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
[in] | n_s | Transmit sequence number |
[in] | ar | Immediate Acknowledgement request |
[in] | buf | Pointer to the payload data |
[in] | bufLen | Number 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
[in] | buf | Pointer to the message |
[in] | bufLen | Number of bytes in buf |
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
Map27PhysicalLayer * Map27DataLayer::physicalLayer | ( | ) |
Get the current Physical Layer pointer
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
[in] | baud | The desired baud rate in baud (per second) |
void Map27DataLayer::setNetworkLayer | ( | Map27NetworkLayer * | networkLayer | ) |
void Map27DataLayer::setPhysicalLayer | ( | Map27PhysicalLayer * | physicalLayer | ) |