Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
RF4Control API Parser Module

This module is responsible for encoding and decoding the serial bytes to/from NCP into NWK or ZRC APIs to provide seamless working for application similar to stack running in same processor or on NCP.

Macros

#define RF4CONTROL_PID   (2)
 
#define RF4CONTROL_PID_LEN   (1)
 

Functions

void serial_api_init (void)
 This function does the initialization of the SIO or UART. More...
 
static void process_incoming_data (void)
 
static uint8_t * get_next_tx_buffer (void)
 
static void handle_incoming_msg (void)
 
nwk_enum_t nwk_init (void)
 Initialization of RF4CE network layer. More...
 
bool nwk_task (void)
 Function to handle the state machine serial data exchange. More...
 
bool nlme_reset_request (bool SetDefaultNIB, FUNC_PTR confirm_cb)
 NLME-RESET.request primitive API. More...
 
bool nlde_data_request (uint8_t PairingRef, profile_id_t ProfileId, uint16_t VendorId, uint8_t nsduLength, uint8_t *nsdu, uint8_t TxOptions, uint8_t Handle, FUNC_PTR confirm_cb)
 NLDE-DATA.request primitive API. More...
 
bool nlme_auto_discovery_request (uint8_t RecAppCapabilities, dev_type_t RecDevTypeList[DEVICE_TYPE_LIST_SIZE], profile_id_t RecProfileIdList[PROFILE_ID_LIST_SIZE], uint32_t AutoDiscDuration, FUNC_PTR confirm_cb)
 
bool nlme_discovery_request (uint16_t DstPANId, uint16_t DstNwkAddr, uint8_t OrgAppCapabilities, dev_type_t OrgDevTypeList[3], profile_id_t OrgProfileIdList[7], dev_type_t SearchDevType, uint8_t DiscProfileIdListSize, profile_id_t DiscProfileIdList[7], uint32_t DiscDuration, FUNC_PTR confirm_cb)
 NLME-DISCOVERY.request primitive API. More...
 
bool nlme_discovery_response (nwk_enum_t Status, uint64_t DstIEEEAddr, uint8_t RecAppCapabilities, dev_type_t RecDevTypeList[3], profile_id_t RecProfileIdList[7], uint8_t DiscReqLQI)
 NLME-DISCOVERY.response primitive API. More...
 
bool nlme_pair_request (uint8_t LogicalChannel, uint16_t DstPANId, uint64_t DstIEEEAddr, uint8_t OrgAppCapabilities, dev_type_t OrgDevTypeList[DEVICE_TYPE_LIST_SIZE], profile_id_t OrgProfileIdList[PROFILE_ID_LIST_SIZE], uint8_t KeyExTransferCount, FUNC_PTR confirm_cb)
 
bool nlme_pair_response (nwk_enum_t Status, uint16_t DstPANId, uint64_t DstIEEEAddr, uint8_t RecAppCapabilities, dev_type_t RecDevTypeList[3], profile_id_t RecProfileIdList[7], uint8_t ProvPairingRef)
 NLME-PAIR.response primitive API. More...
 
bool nlme_get_request (nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex, FUNC_PTR confirm_cb)
 NLME-GET.request primitive API. More...
 
bool nlme_rx_enable_request (uint32_t RxOnDuration, FUNC_PTR confirm_cb)
 NLME-RX-ENABLE.request primitive API. More...
 
bool nlme_set_request (nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex, uint8_t *NIBAttributeValue, FUNC_PTR confirm_cb)
 NLME-SET.request primitive API. More...
 
bool nlme_start_request (FUNC_PTR confirm_cb)
 NLME-START.request primitive API. More...
 
bool nlme_unpair_request (uint8_t PairingRef, FUNC_PTR confirm_cb)
 NLME-UNPAIR.request primitive API. More...
 
bool nlme_unpair_response (uint8_t PairingRef)
 NLME-UNPAIR.response primitive API. More...
 
bool nlme_update_key_request (uint8_t PairingRef, uint8_t NewLinkKey[16], FUNC_PTR confirm_cb)
 NLME-UPDATE-KEY.request primitive API. More...
 
bool nwk_ch_agility_request (nwk_agility_mode_t AgilityMode, FUNC_PTR confirm_cb)
 Sets channel agility mode. More...
 
bool pbp_org_pair_request (uint8_t OrgAppCapabilities, dev_type_t OrgDevTypeList[DEVICE_TYPE_LIST_SIZE], profile_id_t OrgProfileIdList[PROFILE_ID_LIST_SIZE], dev_type_t SearchDevType, uint8_t DiscProfileIdListSize, profile_id_t DiscProfileIdList[PROFILE_ID_LIST_SIZE], FUNC_PTR confirm_cb)
 
bool pbp_rec_pair_request (uint8_t RecAppCapabilities, dev_type_t RecDevTypeList[3], profile_id_t RecProfileIdList[7], FUNC_PTR confirm_cb)
 Recipient pair request; target use. More...
 
bool zrc_cmd_request (uint8_t PairingRef, uint16_t VendorId, zrc_cmd_code_t CmdCode, uint8_t CmdLength, uint8_t *Cmd, uint8_t TxOptions, FUNC_PTR confirm_cb)
 Handles the key press from the application. More...
 
bool zrc_cmd_disc_request (uint8_t PairingRef, FUNC_PTR confirm_cb)
 Handles the cmd discovery request. More...
 
bool zrc_cmd_disc_response (uint8_t PairingRef, uint8_t *SupportedCmd)
 Send out the cmd discovery response. More...
 
void register_nwk_indication_callback (nwk_indication_callback_t *nwk_ind_cb)
 Registering network indication callback. More...
 
void register_zrc_indication_callback (zrc_indication_callback_t *zrc_ind_callback)
 Registering zrc indication callback. More...
 
uint8_t nwk_get_nib_attribute_size (uint8_t nib_attribute_id)
 Gets the NIB attribute value size. More...
 
#define SOT   (1)
 The start of transmission delimiter. More...
 
#define EOT   (4)
 The end of transmission delimiter. More...
 
#define UART_RX_STATE_SOT   (1)
 A UART state that expects a SOT to be received as the next character. More...
 
#define UART_RX_STATE_LENGTH   (2)
 A UART state that expects the length to be received as the next character. More...
 
#define UART_RX_PROTOCOL_ID   (3)
 A UART state that expects the length to be received as the next character. More...
 
#define UART_RX_STATE_DATA   (4)
 A UART state that expects the next data character to be received. More...
 
#define UART_RX_STATE_EOT   (5)
 A UART state that expects a EOT to be received as the next character. More...
 
#define SIO_BUF_COUNT   (2)
 
#define SIO_RX2NCP_BUF_SIZE   (200)
 
#define SIO_TX_BUF_SIZE   SIO_RX2NCP_BUF_SIZE
 
#define GET_NIB_ATTR_SIZE(x)
 Gets attribute size by reading from a table stored in flash. More...
 
static uint8_t sio_rx_buf [SIO_RX2NCP_BUF_SIZE]
 This is the receive buffer of the UART. More...
 
static uint8_t sio_tx_buf [SIO_BUF_COUNT][SIO_TX_BUF_SIZE]
 This is the transmit buffer of the UART. More...
 
static uint8_t * sio_rx_ptr
 This pointer points to the next free element inside the receive buffer of the UART. More...
 
static volatile uint8_t sio_rx_state
 This is the receiver state of the UART. More...
 
static uint8_t sio_rx_length
 This is the length of the message should be received. More...
 
static uint8_t data [20]
 This is the length of the message should be transmitted. More...
 
static uint8_t data_length
 
static uint8_t rx_index
 
static uint8_t head
 
static uint8_t buf_count
 
static uint8_t protocol_id
 
static zrc_indication_callback_t zrc_ind_cb
 
static nwk_indication_callback_t nwk_ind_callback
 
nlme_start_confirm_cb_t nlme_start_confirm_cb
 
nlme_reset_confirm_cb_t nlme_reset_confirm_cb
 
nlme_rx_enable_confirm_cb_t nlme_rx_enable_confirm_cb
 
nlde_data_confirm_cb_t nlde_data_confirm_cb
 
nlme_auto_discovery_confirm_cb_t nlme_auto_discovery_confirm_cb
 
nlme_update_key_confirm_cb_t nlme_update_key_confirm_cb
 
nwk_ch_agility_confirm_cb_t nwk_ch_agility_confirm_cb
 
pbp_org_pair_confirm_cb_t pbp_org_pair_confirm_cb
 
pbp_rec_pair_confirm_cb_t pbp_rec_pair_confirm_cb
 
zrc_cmd_disc_confirm_cb_t zrc_cmd_disc_confirm_cb
 

#define GET_NIB_ATTR_SIZE (   x)
Value:
&nib_attr_size[x - nwkActivePeriod])
#define PGM_READ_BYTE(x)
Definition: compiler.h:1054
The active period of a device in MAC symbols.
Definition: rf4ce.h:382

Gets attribute size by reading from a table stored in flash.

Referenced by nwk_get_nib_attribute_size().

#define RF4CONTROL_PID   (2)
#define RF4CONTROL_PID_LEN   (1)
#define SIO_BUF_COUNT   (2)

Referenced by get_next_tx_buffer(), and nwk_task().

#define SIO_RX2NCP_BUF_SIZE   (200)

Referenced by nwk_task().

#define SIO_TX_BUF_SIZE   SIO_RX2NCP_BUF_SIZE
#define SOT   (1)

The start of transmission delimiter.

Referenced by get_next_tx_buffer(), and process_incoming_data().

#define UART_RX_PROTOCOL_ID   (3)

A UART state that expects the length to be received as the next character.

Referenced by process_incoming_data().

#define UART_RX_STATE_DATA   (4)

A UART state that expects the next data character to be received.

Referenced by process_incoming_data().

#define UART_RX_STATE_EOT   (5)

A UART state that expects a EOT to be received as the next character.

Referenced by process_incoming_data().

#define UART_RX_STATE_LENGTH   (2)

A UART state that expects the length to be received as the next character.

Referenced by process_incoming_data().

#define UART_RX_STATE_SOT   (1)

A UART state that expects a SOT to be received as the next character.

Referenced by process_incoming_data(), and serial_api_init().

static void handle_incoming_msg ( void  )
inlinestatic

References NodeDesc_tag::AppCapabilities, DEVICE_TYPE_LIST_SIZE, NodeDesc_tag::DevTypeList, NodeDesc_tag::DiscReqLQI, NodeDesc_tag::LogicalChannel, MEMCPY_ENDIAN, NLDE_DATA_CONFIRM, nlde_data_confirm_cb, NLDE_DATA_INDICATION, nwk_indication_callback_tag::nlde_data_indication_cb, NLME_AUTO_DISCOVERY_CONFIRM, nlme_auto_discovery_confirm_cb, NLME_COMM_STATUS_INDICATION, nwk_indication_callback_tag::nlme_comm_status_indication_cb, NLME_DISCOVERY_CONFIRM, NLME_DISCOVERY_INDICATION, nwk_indication_callback_tag::nlme_discovery_indication_cb, NLME_GET_CONFIRM, NLME_PAIR_CONFIRM, NLME_PAIR_INDICATION, nwk_indication_callback_tag::nlme_pair_indication_cb, NLME_RESET_CONFIRM, nlme_reset_confirm_cb, NLME_RX_ENABLE_CONFIRM, nlme_rx_enable_confirm_cb, NLME_SET_CONFIRM, NLME_START_CONFIRM, nlme_start_confirm_cb, NLME_UNPAIR_CONFIRM, NLME_UNPAIR_INDICATION, nwk_indication_callback_tag::nlme_unpair_indication_cb, NLME_UPDATE_KEY_CONFIRM, nlme_update_key_confirm_cb, NodeDesc_tag::NodeCapabilities, NULL, NWK_CH_AGILITY_CONFIRM, nwk_ch_agility_confirm_cb, NWK_CH_AGILITY_INDICATION, nwk_indication_callback_tag::nwk_ch_agility_indication_cb, NodeDesc_tag::PANId, PBP_ORG_PAIR_CONFIRM, pbp_org_pair_confirm_cb, PBP_REC_PAIR_CONFIRM, pbp_rec_pair_confirm_cb, PROFILE_ID_LIST_SIZE, NodeDesc_tag::ProfileIdList, sio_rx_buf, NodeDesc_tag::Status, NodeDesc_tag::UserString, zrc_indication_callback::vendor_data_ind_cb, VENDOR_DATA_INDICATION, NodeDesc_tag::VendorId, NodeDesc_tag::VendorString, ZRC_CMD_CONFIRM, zrc_cmd_disc_confirm_cb, zrc_indication_callback::zrc_cmd_disc_indication_cb, ZRC_CMD_DISCOVERY_CONFIRM, ZRC_CMD_DISCOVERY_INDICATION, ZRC_CMD_INDICATION, and zrc_indication_callback::zrc_cmd_indication_cb.

Referenced by process_incoming_data().

bool nlde_data_request ( uint8_t  PairingRef,
profile_id_t  ProfileId,
uint16_t  VendorId,
uint8_t  nsduLength,
uint8_t *  nsdu,
uint8_t  TxOptions,
uint8_t  Handle,
FUNC_PTR  confirm_cb 
)

NLDE-DATA.request primitive API.

The NLDE-DATA.request primitive requests the transfer of a data APDU (i.e. NSDU) from a local application entity to a peer application entity.

Parameters
PairingRefPairing reference used for the data transmission
ProfileIdProfile Id used for the data transmission
VendorIdVendor Id used for the data transmission
nsduLengthLength of the network payload
nsduPointer to the payload
TxOptionsTransmission options
HandleData retry handle
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlde_data_confirm

References EOT, get_next_tx_buffer(), nlde_data_confirm_cb, NLDE_DATA_REQ_LEN, NLDE_DATA_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), and vendor_data_request().

bool nlme_auto_discovery_request ( uint8_t  RecAppCapabilities,
dev_type_t  RecDevTypeList[DEVICE_TYPE_LIST_SIZE],
profile_id_t  RecProfileIdList[PROFILE_ID_LIST_SIZE],
uint32_t  AutoDiscDuration,
FUNC_PTR  confirm_cb 
)
bool nlme_discovery_request ( uint16_t  DstPANId,
uint16_t  DstNwkAddr,
uint8_t  OrgAppCapabilities,
dev_type_t  OrgDevTypeList[3],
profile_id_t  OrgProfileIdList[7],
dev_type_t  SearchDevType,
uint8_t  DiscProfileIdListSize,
profile_id_t  DiscProfileIdList[7],
uint32_t  DiscDuration,
FUNC_PTR  confirm_cb 
)

NLME-DISCOVERY.request primitive API.

The NLME-DISCOVERY.request primitive allows the application to request the NLME discover other devices of interest operating in the POS of the device.

Parameters
DstPANIdThe PAN identifier of the destination device for the discovery. This value can be set to 0xffff to indicate a wildcard.
DstNwkAddrThe address of the destination device for the discovery. This value can be set to 0xffff to indicate a wildcard.
OrgAppCapabilitiesThe application capabilities of the node.
OrgDevTypeListThe list of device types supported by the node.
OrgProfileIdListThe list of profile identifiers disclosed as supported by the node.
SearchDevTypeThe device type to discover. This value can be set to 0xff to indicate a wildcard.
DiscProfileIdListSizeThe number of profile identifiers contained in the DiscProfileIdList parameter.
DiscProfileIdListThe list of profile identifiers against which profile identifiers contained in received discovery response command frames will be matched for acceptance.
DiscDurationThe maximum number of MAC symbols to wait for discovery responses.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_discovery_confirm

References DEVICE_TYPE_LIST_SIZE, EOT, get_next_tx_buffer(), NLME_DISCOVERY_REQ_LEN, NLME_DISCOVERY_REQUEST, NULL, PROFILE_ID_LIST_SIZE, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg().

bool nlme_discovery_response ( nwk_enum_t  Status,
uint64_t  DstIEEEAddr,
uint8_t  RecAppCapabilities,
dev_type_t  RecDevTypeList[3],
profile_id_t  RecProfileIdList[7],
uint8_t  DiscReqLQI 
)

NLME-DISCOVERY.response primitive API.

The NLME-DISCOVERY.response primitive allows the application to request that the NLME respond to the discovery request command.

Parameters
StatusThe status of the discovery request.
DstIEEEAddrThe IEEE address of the device requesting discovery.
RecAppCapabilitiesThe application capabilities of the node issuing this primitive.
RecDevTypeListThe list of device types supported by the node issuing this primitive.
RecProfileIdListThe list of profile identifiers supported by the node issuing this primitive.
DiscReqLQIThe LQI value from the associated NLME-DISCOVERY.indication primitive.
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_discovery_indication

References DEVICE_TYPE_LIST_SIZE, EOT, get_next_tx_buffer(), MEMCPY_ENDIAN, NLME_DISCOVERY_RESP_LEN, NLME_DISCOVERY_RESPONSE, NULL, PROFILE_ID_LIST_SIZE, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg().

bool nlme_get_request ( nib_attribute_t  NIBAttribute,
uint8_t  NIBAttributeIndex,
FUNC_PTR  confirm_cb 
)

NLME-GET.request primitive API.

The NLME-GET.request primitive allows the application to request the value of a NIB attribute from the NLME.

Parameters
NIBAttributeThe identifier of the NIB attribute to read.
NIBAttributeIndexThe index within the table or array of the specified NIB attribute to read.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_get_confirm

References EOT, get_next_tx_buffer(), NLME_GET_REQ_LEN, NLME_GET_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), handle_input(), nlme_get_confirm(), nlme_rx_enable_confirm(), print_node_status(), and print_pairing_table().

bool nlme_pair_request ( uint8_t  LogicalChannel,
uint16_t  DstPANId,
uint64_t  DstIEEEAddr,
uint8_t  OrgAppCapabilities,
dev_type_t  OrgDevTypeList[DEVICE_TYPE_LIST_SIZE],
profile_id_t  OrgProfileIdList[PROFILE_ID_LIST_SIZE],
uint8_t  KeyExTransferCount,
FUNC_PTR  confirm_cb 
)
bool nlme_pair_response ( nwk_enum_t  Status,
uint16_t  DstPANId,
uint64_t  DstIEEEAddr,
uint8_t  RecAppCapabilities,
dev_type_t  RecDevTypeList[3],
profile_id_t  RecProfileIdList[7],
uint8_t  ProvPairingRef 
)

NLME-PAIR.response primitive API.

The NLME-PAIR.response primitive allows the application to request that the NLME respond to a pairing request command.

Parameters
StatusThe status of the pairing request.
DstPANIdThe PAN identifier of the device requesting the pair.
DstIEEEAddrThe IEEE address of the device requesting the pair.
RecAppCapabilitiesThe application capabilities of the node issuing this primitive.
RecDevTypeListThe list of device types supported by the node issuing this primitive.
RecProfileIdListThe list of profile identifiers supported by the node issuing this primitive.
ProvPairingRefThe reference to the provisional pairing entry if the pair was accepted.
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_pair_indication

References DEVICE_TYPE_LIST_SIZE, EOT, get_next_tx_buffer(), MEMCPY_ENDIAN, NLME_PAIR_RESP_LEN, NLME_PAIR_RESPONSE, NULL, PROFILE_ID_LIST_SIZE, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg().

bool nlme_reset_request ( bool  SetDefaultNIB,
FUNC_PTR  confirm_cb 
)

NLME-RESET.request primitive API.

The NLME-RESET.request primitive allows the application entity to request a reset of the NWK layer.

Parameters
SetDefaultNIBIf TRUE, the NWK layer is reset and all NIB attributes are set to their default values. If FALSE, the NWK layer is reset but all NIB attributes retain their values prior to the generation of the NLME-RESET.request primitive.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_reset_confirm

References EOT, get_next_tx_buffer(), nlme_reset_confirm_cb, NLME_RESET_REQ_LEN, NLME_RESET_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), handle_input(), and main().

bool nlme_rx_enable_request ( uint32_t  RxOnDuration,
FUNC_PTR  confirm_cb 
)

NLME-RX-ENABLE.request primitive API.

The NLME-RX-ENABLE.request primitive allows the application to request that the receiver is either enabled (for a finite period or until further notice) or disabled.

Parameters
RxOnDurationThe number of MAC symbols for which the receiver is to be enabled. To activate power saving mode, this value should correspond to the value of nwkActivePeriod and nwkActivePeriod should not be equal to 0x000000. If this parameter is equal to 0x000000, the receiver is disabled, allowing the node to enter dormant power save mode. If this parameter is equal to 0xffffff, the receiver is enabled, allowing the node to come out of power save mode.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_rx_enable_confirm

References EOT, get_next_tx_buffer(), MEMCPY_ENDIAN, nlme_rx_enable_confirm_cb, NLME_RX_ENABLE_REQ_LEN, NLME_RX_ENABLE_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), handle_input(), nlme_reset_confirm(), pbp_org_pair_confirm(), vendor_data_ind(), zrc_cmd_disc_confirm(), and zrc_cmd_indication().

bool nlme_set_request ( nib_attribute_t  NIBAttribute,
uint8_t  NIBAttributeIndex,
uint8_t *  NIBAttributeValue,
FUNC_PTR  confirm_cb 
)

NLME-SET.request primitive API.

The NLME-SET.request primitive allows the application to request the NLME change the value of a NIB attribute.

Parameters
NIBAttributeThe identifier of the NIB attribute to write.
NIBAttributeIndexThe index within the table or array of the specified NIB attribute to write.
NIBAttributeValueThe value of the indicated attribute to write.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_set_confirm

References EOT, get_next_tx_buffer(), NLME_SET_REQ_LEN, NLME_SET_REQUEST, NULL, nwk_get_nib_attribute_size(), RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), print_ch_change_submenu(), and print_sub_mode_ch_ag_setup().

bool nlme_start_request ( FUNC_PTR  confirm_cb)

NLME-START.request primitive API.

The NLME-START.request primitive allows the application to request the NLME start a network.

Parameters
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_start_confirm

References EOT, get_next_tx_buffer(), nlme_start_confirm_cb, NLME_START_REQ_LEN, NLME_START_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), handle_input(), and nlme_reset_confirm().

bool nlme_unpair_request ( uint8_t  PairingRef,
FUNC_PTR  confirm_cb 
)

NLME-UNPAIR.request primitive API.

The NLME-UNPAIR.request primitive allows the application to request the NLME removes a pairing link with another device both in the local and remote pairing tables.

Parameters
PairingRefThe reference into the local pairing table of the entry that is to be removed.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_unpair_confirm

References EOT, get_next_tx_buffer(), NLME_UNPAIR_REQ_LEN, NLME_UNPAIR_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), and print_unpair_submenu().

bool nlme_unpair_response ( uint8_t  PairingRef)

NLME-UNPAIR.response primitive API.

The NLME-UNPAIR.response primitive allows the application to notify the NLME that the pairing link indicated via the NLME-UNPAIR.indication primitive can be removed from the pairing table.

Parameters
PairingRefThe reference into the local pairing table of the entry that is to be removed.
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_unpair_indication

References EOT, get_next_tx_buffer(), NLME_UNPAIR_RESP_LEN, NLME_UNPAIR_RESPONSE, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg().

bool nlme_update_key_request ( uint8_t  PairingRef,
uint8_t  NewLinkKey[16],
FUNC_PTR  confirm_cb 
)

NLME-UPDATE-KEY.request primitive API.

The NLME-UPDATE-KEY.request primitive allows the application to request the NLME change the security link key of an entry in the pairing table.

Parameters
PairingRefThe reference into the local pairing table of the entry whose key is to be updated.
NewLinkKeyThe security link key to replace the key in the pairing table.
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nlme_update_key_confirm

References EOT, get_next_tx_buffer(), nlme_update_key_confirm_cb, NLME_UPDATE_KEY_REQ_LEN, NLME_UPDATE_KEY_REQUEST, NULL, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg().

bool nwk_ch_agility_request ( nwk_agility_mode_t  AgilityMode,
FUNC_PTR  confirm_cb 
)

Sets channel agility mode.

The function configures the channel agility mode. Parameters of the channel agility feature, like ScanInterval, EdThreshold, IndicationCountThreshold and AutoChannelMode, can be set via NLME-SET.request. If power save mode is enabled, the channel agility mode is suspended until power save mode is left again.

Parameters
AgilityModeChannel agility mode: AG_ONE_SHOT - scans once AG_PERIODIC - starts periodic scanning AG_STOP - stops periodic scanning
confirm_cbCall back pointer for the confirmation
Returns
true if request has been added to NHLE-NWK queue successfully; else false
See Also
nwk_ch_agility_confirm

References EOT, get_next_tx_buffer(), NULL, nwk_ch_agility_confirm_cb, nwk_ch_agility_confirm_cb_t, NWK_CH_AGILITY_REQ_LEN, NWK_CH_AGILITY_REQUEST, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), and handle_input().

uint8_t nwk_get_nib_attribute_size ( uint8_t  nib_attribute_id)

Gets the NIB attribute value size.

Parameters
nib_attribute_idNIB attribute ID
Returns
Size of NIB attribute value in bytes
See Also
nlme_get_confirm

References GET_NIB_ATTR_SIZE.

Referenced by nlme_get_confirm(), and nlme_set_request().

nwk_enum_t nwk_init ( void  )

Initialization of RF4CE network layer.

The RF4CE network layer needs to initialize after power-up of the MCU. The function nwk_init() initializes the network layer including the underlying layers, like MAC and queue and buffer management.

Returns
Status of the initialization

References NWK_SUCCESS, and serial_api_init().

Referenced by main().

bool nwk_task ( void  )

Function to handle the state machine serial data exchange.

Task handling of RF4CE network layer.

References buf_count, data, data_length, head, process_incoming_data(), rx_index, sio2ncp_rx(), sio2ncp_tx(), SIO_BUF_COUNT, SIO_RX2NCP_BUF_SIZE, and sio_tx_buf.

Referenced by main().

bool pbp_org_pair_request ( uint8_t  OrgAppCapabilities,
dev_type_t  OrgDevTypeList[DEVICE_TYPE_LIST_SIZE],
profile_id_t  OrgProfileIdList[PROFILE_ID_LIST_SIZE],
dev_type_t  SearchDevType,
uint8_t  DiscProfileIdListSize,
profile_id_t  DiscProfileIdList[PROFILE_ID_LIST_SIZE],
FUNC_PTR  confirm_cb 
)
bool pbp_rec_pair_request ( uint8_t  RecAppCapabilities,
dev_type_t  RecDevTypeList[3],
profile_id_t  RecProfileIdList[7],
FUNC_PTR  confirm_cb 
)

Recipient pair request; target use.

The push button pairing recipient pair request allows a target to start the push button pairing procedure; auto-discovery and incoming pairing handling.

Parameters
RecAppCapabilitiesApplication capabilities of the device issuing the request
RecDevTypeListSupported device type list
RecProfileIdListSupported profile id list
confirm_cbCall back pointer for the confirmation
Returns
true if command could be handled; else false

References DEVICE_TYPE_LIST_SIZE, EOT, get_next_tx_buffer(), NULL, pbp_rec_pair_confirm_cb, PBP_REC_PAIR_REQ_LEN, PBP_REC_PAIR_REQUEST, PROFILE_ID_LIST_SIZE, RF4CONTROL_PID, and RF4CONTROL_PID_LEN.

Referenced by handle_incoming_msg(), handle_input(), and nlme_start_confirm().

void register_nwk_indication_callback ( nwk_indication_callback_t nwk_indication_cb)

Registering network indication callback.

The application/profile needs to register the network indication callback functions so that the corresponding function will get called by the network layer on receiving the indication

Parameters
nwk_indication_callback_tnwk_indication_cb
See Also
nwk_indication_callback_t

References nwk_indication_callback_tag::nlde_data_indication_cb, nwk_indication_callback_tag::nlme_comm_status_indication_cb, nwk_indication_callback_tag::nlme_discovery_indication_cb, nwk_indication_callback_tag::nlme_pair_indication_cb, nwk_indication_callback_tag::nlme_unpair_indication_cb, NULL, nwk_indication_callback_tag::nwk_ch_agility_indication_cb, and nwk_indication_callback_tag::zrc_data_indication_cb.

Referenced by main(), and stack_indication_callback_init().

void register_zrc_indication_callback ( zrc_indication_callback_t zrc_ind_callback)

Registering zrc indication callback.

The application needs to register the zrc indication call back functions so that the corresponding indication function will get called by the profile on receiving the indication from the network layer.

Parameters
zrc_indication_callback_tindication callback struct
See Also
zrc_indication_callback_t

References NULL, zrc_indication_callback::vendor_data_ind_cb, zrc_indication_callback::zrc_cmd_disc_indication_cb, and zrc_indication_callback::zrc_cmd_indication_cb.

Referenced by main(), and stack_indication_callback_init().

void serial_api_init ( void  )

This function does the initialization of the SIO or UART.

References sio2ncp_init(), sio_rx_state, and UART_RX_STATE_SOT.

Referenced by nwk_init().

bool zrc_cmd_disc_request ( uint8_t  PairingRef,
FUNC_PTR  confirm_cb 
)

Handles the cmd discovery request.

Initialites the command transmission from the application.

Parameters
PairingRefpairing ref of the originator device.
Returns
true if cmd discovery is sent using nlde_data_req.

References EOT, get_next_tx_buffer(), NULL, RF4CONTROL_PID, RF4CONTROL_PID_LEN, zrc_cmd_disc_confirm_cb, ZRC_CMD_DISCOVERY_REQ_LEN, and ZRC_CMD_DISCOVERY_REQUEST.

Referenced by handle_incoming_msg(), pbp_rec_pair_confirm(), and start_cmd_disc_cb().

bool zrc_cmd_disc_response ( uint8_t  PairingRef,
uint8_t *  SupportedCmd 
)

Send out the cmd discovery response.

ZRC command discovery response.

Parameters
PairingRefpairing ref of the originator device.
SupportedCmdAddress of provided 32 byte array containing supported command codes
Returns
true if cmd discovery response is sent using nlde_data_req.

References EOT, get_next_tx_buffer(), NULL, RF4CONTROL_PID, ZRC_CMD_DISCOVERY_RESP_LEN, and ZRC_CMD_DISCOVERY_RESPONSE.

Referenced by handle_incoming_msg(), and zrc_cmd_disc_indication().

bool zrc_cmd_request ( uint8_t  PairingRef,
uint16_t  VendorId,
zrc_cmd_code_t  CmdCode,
uint8_t  CmdLength,
uint8_t *  Cmd,
uint8_t  TxOptions,
FUNC_PTR  confirm_cb 
)

Handles the key press from the application.

Parameters
PairingRefPairing reference
VendorIdVendor Id information
CmdCodeZRC cmd code (Press/Release)
CmdLengthLength of the rc cmd (rc cmd code + Payload).
CmdActual rc command code (rc cmd code + Payload)
TxOptionsTransmission options (ex- ack, security etc)
Returns
true returns the status of zrc_cmd_request.

References EOT, get_next_tx_buffer(), NULL, RF4CONTROL_PID, RF4CONTROL_PID_LEN, ZRC_CMD_REQ_LEN, and ZRC_CMD_REQUEST.

Referenced by app_task(), and handle_incoming_msg().

uint8_t buf_count
static

Referenced by get_next_tx_buffer(), and nwk_task().

uint8_t data[20]
static

This is the length of the message should be transmitted.

uint8_t data_length
static
uint8_t head
static

Referenced by get_next_tx_buffer(), and nwk_task().

nlde_data_confirm_cb_t nlde_data_confirm_cb
nlme_auto_discovery_confirm_cb_t nlme_auto_discovery_confirm_cb
nlme_reset_confirm_cb_t nlme_reset_confirm_cb
nlme_rx_enable_confirm_cb_t nlme_rx_enable_confirm_cb
nlme_start_confirm_cb_t nlme_start_confirm_cb
nlme_update_key_confirm_cb_t nlme_update_key_confirm_cb
nwk_ch_agility_confirm_cb_t nwk_ch_agility_confirm_cb
nwk_indication_callback_t nwk_ind_callback
static
pbp_org_pair_confirm_cb_t pbp_org_pair_confirm_cb
pbp_rec_pair_confirm_cb_t pbp_rec_pair_confirm_cb
uint8_t protocol_id
static

Referenced by process_incoming_data().

uint8_t rx_index
static

Referenced by nwk_task(), and process_incoming_data().

uint8_t sio_rx_buf[SIO_RX2NCP_BUF_SIZE]
static

This is the receive buffer of the UART.

Referenced by handle_incoming_msg(), and process_incoming_data().

uint8_t sio_rx_length
static

This is the length of the message should be received.

Referenced by process_incoming_data().

uint8_t* sio_rx_ptr
static

This pointer points to the next free element inside the receive buffer of the UART.

Referenced by process_incoming_data().

volatile uint8_t sio_rx_state
static

This is the receiver state of the UART.

(UART_RX_STATE_SOT, UART_RX_STATE_LENGTH, UART_RX_STATE_DATA, or UART_RX_STATE_EOT)

Referenced by process_incoming_data(), and serial_api_init().

uint8_t sio_tx_buf[SIO_BUF_COUNT][SIO_TX_BUF_SIZE]
static

This is the transmit buffer of the UART.

Referenced by get_next_tx_buffer(), and nwk_task().

zrc_cmd_disc_confirm_cb_t zrc_cmd_disc_confirm_cb
zrc_indication_callback_t zrc_ind_cb
static