Manage the Physical Layer of the Map27 protocol stack.
More...
#include <Map27/PhysicalLayer.h>
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.
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] | baud | The baud rate to set, in bauds (per second) |
- Returns
- true if successful
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.
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] | buf | Pointer to the data payload to send |
[in] | len | Number 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_r | receive sequence number |
[in] | n_k | Receive 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] | n1 | The requested maimum message size |
[in] | k | The requested maximum window size |
[in] | version | The 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_s | Transmit sequence number |
[in] | ar | Immediate Acknowledgement request |
[in] | buf | Pointer to the payload data |
[in] | bufLen | Number of bytes in buf |
void Map27PhysicalLayer::sendToPort |
( |
uint8_t |
ch | ) |
|
|
virtual |
Sends a single octet to the current Port
- Parameters
-
Sets the pointer to the Data LAyer to use to deliver messages up the protocol stack
- Parameters
-
[in] | dataLayer | Pointer 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] | port | Pointer to the Port |
- Examples:
- test.cpp, test2.cpp, and test3.cpp.
The documentation for this class was generated from the following files: