Manage the Network Layer of the Map27 protocol stack.
More...
#include <Map27/NetworkLayer.h>
|
|
These functions are called when for different types of mesasge. They are passed a pointer to the raw message data buffer,and are repsonsibel for decoding the mesage and calling the appropriate member funciton in the Application Layer. You may want to subclass Map27NetworkLayer and override one or more of these functions for special behaviour.
|
virtual void | receiveStatus (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveStatusAck (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveSST (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveSSTAck (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveMST (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveMSTAck (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveSetupProgress (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveIncomingVoiceModem (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveProgress (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveModemData (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveCleared (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveRadioPersonality (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveProtocolInfo (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveNumberingInfo (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveRadioSettings (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveOperatingCondition (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveNetworkInformation (uint8_t *buf, uint16_t bufLen) |
|
virtual void | receiveRadioTestResult (uint8_t *buf, uint16_t bufLen) |
|
|
Applications can send messages by calling these members
|
bool | sendStatus (const Map27Address &address, uint8_t status) |
|
bool | sendSST (const Map27Address &address, uint8_t *buf, uint16_t bufLen) |
|
bool | sendMST (const Map27Address &address, uint8_t *buf, uint16_t bufLen) |
|
bool | setupVoiceModem (const Map27Address &address, uint8_t details) |
|
bool | setupEmergencyVoiceModem (const Map27Address &address, uint8_t details) |
|
bool | sendModemData (uint8_t *buf, uint16_t bufLen) |
|
bool | sendDisconnect (const Map27Address &address, uint8_t cause) |
|
bool | sendCleared (const Map27Address &address, uint8_t cause) |
|
bool | sendDiversionRequest (const Map27Address &address, uint8_t info, const Map27Address &diversionAddress) |
|
bool | sendDiversionCancel (const Map27Address &address, uint8_t info) |
|
bool | sendRadioInterrogation (uint8_t reason) |
|
bool | sendVolumeControl (uint8_t control_port, uint8_t volume) |
|
bool | sendDialledString (uint8_t *buf, uint16_t bufLen) |
|
bool | sendRadioTest (uint8_t *buf, uint16_t bufLen) |
|
void | decode_network_layer_packet (uint8_t *buf, uint16_t bufLen) |
|
void | request_timeout () |
|
|
These functions are called to deliver events to the Data Layer You may want to override themfor special behaviour
|
virtual void | output_application_error (uint8_t type) |
|
static void | request_timer_callback_glue (void *target) |
|
Manage the Network Layer of the Map27 protocol stack.
This class receives messages to be sent from the Map27ApplicationLayer and formats them for transmission to the Radio by Map27DataLayer. It also received messages from the Radio received by Map27DataLayer and delivers them to Map27ApplicationLayer.
- Examples:
- test.cpp, test2.cpp, and test3.cpp.
Network Layer state _network_state values. The network layer is always in exactly one of these states
Enumerator |
---|
NETWORK_STATE_IDLE |
Idle, ready to start a new transaction.
|
NETWORK_STATE_OUTCALL_WAIT |
Waiting for an outgoing voice/data call to be set up.
|
NETWORK_STATE_OUTCALL_INCLUDE_WAIT |
Waiting for an additional outgoing voice/data call to be set up.
|
NETWORK_STATE_ACTIVE |
Voice/data call is active.
|
NETWORK_STATE_INCALL_WAIT |
Waiting for an incoming voice/data call to be set up.
|
NETWORK_STATE_STATUS_WAIT |
Waiting for status send to complete.
|
NETWORK_STATE_SST_WAIT |
Waiting for an SST data send to complete.
|
NETWORK_STATE_MST_WAIT |
Waiting for an MST data send to complete.
|
NETWORK_STATE_DIVERSION_WAIT |
Waiting for a diversion request to complete.
|
Get the current Application Layer
- Returns
- The curent Application Layer pointer, or NULL if previously set.
Get the current DataLayer
- Returns
- The current Data Layer pointer, or NULL if previously set.
- Examples:
- test.cpp, and test2.cpp.
void Map27NetworkLayer::decode_network_layer_packet |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protected |
Called internally when a message is recieved by the Data LAyer and requires decoding and dispatching.
- Parameters
-
[in] | buf | Data in the message |
[in] | bufLen | Number of bytes in buf |
bool Map27NetworkLayer::is_idle |
( |
| ) |
|
Whether the Network Layer state machine is idle
- Returns
- true if the current Network Layer state mahcine state is IDLE
- Examples:
- test.cpp.
void Map27NetworkLayer::link_failure |
( |
| ) |
|
|
virtual |
Called by Data Layer when the data link stops being READY
void Map27NetworkLayer::link_ready |
( |
| ) |
|
|
virtual |
Called by Data Layer when the data link becomes READY
- Examples:
- test2.cpp.
void Map27NetworkLayer::network_layer_packet |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
virtual |
Called by Data Layer when a message is received from the radio
- Parameters
-
[in] | buf | Contents of the message |
[in] | bufLen | Number of bytes in buf |
- Examples:
- test2.cpp.
void Map27NetworkLayer::output_application_error |
( |
uint8_t |
type | ) |
|
|
protectedvirtual |
Tells the Application Layer about an error condition that was detected by the Network Layer
- Parameters
-
[in] | type | The type of error. One of MAP27_APPLICATION_ERROR_* |
void Map27NetworkLayer::packet_accepted |
( |
| ) |
|
|
virtual |
Called by Data Layer when a packet is accepted by the Data Layer for transmission
void Map27NetworkLayer::packet_rejected |
( |
| ) |
|
|
virtual |
Called by Data Layer when a packet is rejected by the DataLayer for transmission
void Map27NetworkLayer::poll |
( |
| ) |
|
Polls Network Layer timer and lower layers of the protocol stack for activity. 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: Map27ApplicationLayer does this automatically when its poll() function is called.
void Map27NetworkLayer::power_on |
( |
| ) |
|
Cause the entire protocol stack to power up and intialise to its startup state. Network state is IDLE.
void Map27NetworkLayer::receiveCleared |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a CLEARED (5.2.2.6.2) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveIncomingVoiceModem |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a INCOMING VOICE CALL / INCOMING MODEM CALL (5.2.2.4.4) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveModemData |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RECEIVE PROGRESS (5.2.2.4.6) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveMST |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RECEIVE MST (5.2.2.3.2) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveMSTAck |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a MST ACK (5.2.2.3.3) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveNetworkInformation |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a NETWORK INFORMATION (5.2.2.8.6) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveNumberingInfo |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a PROTOCOL INFO (5.2.2.8.9) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveOperatingCondition |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a OPERATING CONDITION (5.2.2.8.5) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveProgress |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveProtocolInfo |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveRadioPersonality |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RADIO PERSONALITY (5.2.2.8.2) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveRadioSettings |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RADIO SETTINGS (5.2.2.8.8) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveRadioTestResult |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RADIO TEST RESULT (5.2.2.8.13) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveSetupProgress |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a SETUP PROGRESS (5.2.2.4.3) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveSST |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RECEIVE SST (5.2.2.2.2) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveSSTAck |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a SST ACK (5.2.2.2.3) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::receiveStatus |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a RECIEVE STATUS (5.2.2.1.2) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
- Examples:
- test.cpp.
void Map27NetworkLayer::receiveStatusAck |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
|
protectedvirtual |
Decode a STATUS ACK (5.2.2.1.3) message and pass it to the appropriate ApplicationLAyer function
- Parameters
-
[in] | buf | Pointer to the raw message data |
[in] | bufLen | Number of bytes in buf |
void Map27NetworkLayer::request_timeout |
( |
| ) |
|
|
protected |
Called internally when a pending request times out. Cancels the reques and reurns the Network Layer to IDLE state
void Map27NetworkLayer::reset |
( |
| ) |
|
Resets the Network Layer to its power_on state
bool Map27NetworkLayer::sendCleared |
( |
const Map27Address & |
address, |
|
|
uint8_t |
cause |
|
) |
| |
Sends a CLEARED 5.2.2.6.2 message to a specified radio in the network.
- Parameters
-
[in] | address | Called, calling or connected party address |
[in] | cause | Cancellation or disconnection reason. One of MAP27_NETWORK_MESSAGE_CLEARED_CAUSE_* |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendDialledString |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
Sends a DIALLED STRING 5.2.2.8.11 message to the radio.
- Parameters
-
[in] | buf | The dialled string |
[in] | bufLen | The number of bytes in the dialled digits |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendDisconnect |
( |
const Map27Address & |
address, |
|
|
uint8_t |
cause |
|
) |
| |
Sends a DISCONNECT 5.2.2.6.1 message to a specified radio in the network.
- Parameters
-
[in] | address | Called or connected party address |
[in] | cause | Cancellation or disconnection reason. One of MAP27_NETWORK_MESSAGE_DISCONNECT_CAUSE_* |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendDiversionCancel |
( |
const Map27Address & |
address, |
|
|
uint8_t |
info |
|
) |
| |
Sends a DIVERSION CANCEL 5.2.2.7.2 message to cancel a previous diversion.
- Parameters
-
[in] | address | Address of the party whose calls are no longer diverted |
[in] | info | Information of the diversion. One of MAP27_NETWORK_MESSAGE_DIVERSION_CANCEL_* |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendDiversionRequest |
( |
const Map27Address & |
address, |
|
|
uint8_t |
info, |
|
|
const Map27Address & |
diversionAddress |
|
) |
| |
Sends a DIVERSION REQUEST 5.2.2.7.1 message to divert messages to another unit
- Parameters
-
[in] | address | Address of he party to which calls are diverted |
[in] | info | Informationof the diversion. One of MAP27_NETWORK_MESSAGE_DIVERSION_REQUEST_INFO_* |
[in] | diversionAddress | Bloked party address in a third party diversion |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendModemData |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
Sends a SEND MODEM DATA 5.2.2.5.1 message to a specified radio in the network.
- Parameters
-
[in] | buf | Data to send |
[in] | bufLen | Number of bytes in buf |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendMST |
( |
const Map27Address & |
address, |
|
|
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
Sends a SEND MST 5.2.2.3.1 message to a specified radio in the network.
- Parameters
-
[in] | address | Called party address |
[in] | buf | Data to send |
[in] | bufLen | Number of bytes in buf |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendRadioInterrogation |
( |
uint8_t |
reason | ) |
|
Sends a RADIO INTERROGATION message to the radio, requesting informaiton about its state or configuration. Radio will respond some time later with a reply message.
- Parameters
-
[in] | reason | Point of interrogation. One of MAP27_NETWORK_MESSAGE_RADIO_INTERROGATION_* |
- Returns
- true if the message was queued for transmission by Data Layer
- Examples:
- test3.cpp.
bool Map27NetworkLayer::sendRadioTest |
( |
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
Sends a RADIO TESET 5.2.2.8.12 message to the radio.
- Parameters
-
[in] | buf | Test controls. Depends on radio type |
[in] | bufLen | Number of bytes in buf. |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::sendSST |
( |
const Map27Address & |
address, |
|
|
uint8_t * |
buf, |
|
|
uint16_t |
bufLen |
|
) |
| |
Sends a SEND SST 5.2.2.2.1 message to a specified radio in the network.
- Parameters
-
[in] | address | Called party address |
[in] | buf | Data to send |
[in] | bufLen | Number of bytes in buf |
- Returns
- true if the message was queued for transmission by Data Layer
- Examples:
- test.cpp.
bool Map27NetworkLayer::sendStatus |
( |
const Map27Address & |
address, |
|
|
uint8_t |
status |
|
) |
| |
Senda SEND STATUS 5.2.2.1.1 message to a specified radio in the network.
- Parameters
-
[in] | address | Called party address |
[in] | status | Status number. One of MAP27_NETWORK_MESSAGE_STATUS_* |
- Returns
- true if the message was queued for transmission by Data Layer
- Examples:
- test.cpp.
bool Map27NetworkLayer::sendVolumeControl |
( |
uint8_t |
control_port, |
|
|
uint8_t |
volume |
|
) |
| |
Sends a VOLUME CONTROL 5.2.2.8.10 message to the radio.
- Parameters
-
[in] | control_port | Address of the volume control port. One of MAP27_NETWORK_MESSAGE_VOLUME_CONTROL_POINT_* |
[in] | volume | Volume set. One of MAP27_NETWORK_MESSAGE_VOLUME_SET_* and others. |
- Returns
- true if the message was queued for transmission by Data Layer
Sets the pointer to the ApplicationLayer to use to deliver messages to the application
- Parameters
-
[in] | applicationLayer | Pointer to the Application Layer |
- Examples:
- test.cpp, and test3.cpp.
Sets the pointer to the DataLayer to use to communicate with the Radio
- Parameters
-
[in] | dataLayer | Pointer to the Data Layer |
- Examples:
- test.cpp, and test3.cpp.
bool Map27NetworkLayer::setupEmergencyVoiceModem |
( |
const Map27Address & |
address, |
|
|
uint8_t |
details |
|
) |
| |
Sends a SETUP EMERGENCY VOICE / SETUP EMERGENCY MODEM 5.2.2.4.2 message to a specified radio in the network.
- Parameters
-
[in] | address | Called party address |
[in] | details | Call details One of MAP27_NETWORK_MESSAGE_SETUP_VOICE_MODEM_DETAILS_*. |
- Returns
- true if the message was queued for transmission by Data Layer
bool Map27NetworkLayer::setupVoiceModem |
( |
const Map27Address & |
address, |
|
|
uint8_t |
details |
|
) |
| |
Sends a SETUP VOICE / SETUP MODEM 5.2.2.4.1 message to a specified radio in the network.
- Parameters
-
[in] | address | Called party address |
[in] | details | Call details One of MAP27_NETWORK_MESSAGE_SETUP_VOICE_MODEM_DETAILS_*. |
- Returns
- true if the message was queued for transmission by Data Layer
The current state of the Network Layer state machine
- Returns
- The current state
The documentation for this class was generated from the following files: