Network layer management functions implementation.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "phy.h"
#include "sysConfig.h"
#include "nwkRx.h"
#include "nwkTx.h"
#include "nwkGroup.h"
#include "nwkFrame.h"
#include "nwkRoute.h"
#include "nwkSecurity.h"
#include "nwkRouteDiscovery.h"
Functions | |
bool | NWK_Busy (void) |
Checks if network layer is ready for sleep. More... | |
void | NWK_Init (void) |
Initializes all network layer modules. More... | |
uint8_t | NWK_LinearizeLqi (uint8_t lqi) |
Calculates linearized value for the given value of the LQI. More... | |
void | NWK_Lock (void) |
Increases the lock counter and sets a busy state. More... | |
void | NWK_OpenEndpoint (uint8_t id, bool(*handler)(NWK_DataInd_t *ind)) |
Registers callback ind for the endpoint endpoint. More... | |
void | NWK_SetAddr (uint16_t addr) |
Sets network address of the node. More... | |
void | NWK_SetPanId (uint16_t panId) |
Sets network identifier (PAN) of the node. More... | |
void | NWK_SleepReq (void) |
Puts network layer to a sleeping state. More... | |
void | NWK_TaskHandler (void) |
Network layer task handler. More... | |
void | NWK_Unlock (void) |
Decreases the lock counter and sets a free state if counter reaches 0. More... | |
void | NWK_WakeupReq (void) |
Puts network layer to an active state. More... | |
Variables | |
NwkIb_t | nwkIb |
bool NWK_Busy | ( | void | ) |
Checks if network layer is ready for sleep.
true
if network layer is ready for sleep or false
otherwise References NwkIb_t::lock.
Referenced by APP_TaskHandler().
void NWK_Init | ( | void | ) |
Initializes all network layer modules.
References NwkIb_t::addr, NwkIb_t::endpoint, i, NwkIb_t::lock, NwkIb_t::macSeqNum, NULL, NWK_ENDPOINTS_AMOUNT, nwkDataReqInit(), nwkFrameInit(), nwkRxInit(), NwkIb_t::nwkSeqNum, and nwkTxInit().
Referenced by SYS_Init().
uint8_t NWK_LinearizeLqi | ( | uint8_t | lqi | ) |
Calculates linearized value for the given value of the LQI.
[in] | lqi | LQI value as provided by the transceiver |
References i.
void NWK_Lock | ( | void | ) |
Increases the lock counter and sets a busy state.
References NwkIb_t::lock.
Referenced by appCmdHandle().
void NWK_OpenEndpoint | ( | uint8_t | id, |
bool(*)(NWK_DataInd_t *ind) | handler | ||
) |
Registers callback ind for the endpoint endpoint.
[in] | id | Endpoint index (1-15) |
[in] | handler | Pointer to the callback function |
References NwkIb_t::endpoint, and id.
Referenced by APP_CommandsInit(), appInit(), and nwkRxInit().
void NWK_SetAddr | ( | uint16_t | addr | ) |
Sets network address of the node.
[in] | addr | Adddress to set |
References NwkIb_t::addr, addr, and PHY_SetShortAddr().
Referenced by appInit().
void NWK_SetPanId | ( | uint16_t | panId | ) |
Sets network identifier (PAN) of the node.
[in] | panId | PAN ID to set |
References NwkIb_t::panId, and PHY_SetPanId().
Referenced by appInit().
void NWK_SleepReq | ( | void | ) |
void NWK_TaskHandler | ( | void | ) |
Network layer task handler.
References nwkDataReqTaskHandler(), nwkRxTaskHandler(), and nwkTxTaskHandler().
Referenced by SYS_TaskHandler().
void NWK_Unlock | ( | void | ) |
Decreases the lock counter and sets a free state if counter reaches 0.
References NwkIb_t::lock.
Referenced by appCmdIdentifyDurationTimerHandler().
void NWK_WakeupReq | ( | void | ) |
NwkIb_t nwkIb |
Referenced by NWK_DataReq(), nwkDataReqConfirm(), nwkDataReqSendFrame(), nwkFrameAlloc(), nwkFrameCommandInit(), nwkFrameFree(), nwkRxHandleIndication(), nwkRxHandleReceivedFrame(), nwkRxIndicateFrame(), nwkRxRejectDuplicate(), nwkTxBroadcastFrame(), nwkTxFrame(), nwkTxTaskHandler(), and PHY_DataConf().