Stack Information

Connect API for accessing and modifying stack states and behaviors. More...

Modules

Stack Counters
Stack counters API.
 

Macros

#define EMBER_HIGH_PRIORITY_TASKS   (EMBER_OUTGOING_MESSAGES | EMBER_INCOMING_MESSAGES | EMBER_RADIO_IS_ON)
 A mask of the tasks that prevent a device from sleeping. More...
 
#define EMBER_INVALID_CHANNEL   65535
 Invalid channel number. More...
 

Handlers

void emberStackStatusHandler (EmberStatus status)
 A callback invoked when the status of the stack changes. More...
 
void emberStackIsrHandler (void)
 This handler is invoked in ISR context when certain stack-related ISR routines fire. More...
 
bool emberStackIdleHandler (uint32_t *idleTimeMs)
 A callback to allow the application to manage idling the MCU. More...
 
void emberRadioNeedsCalibratingHandler (void)
 The radio calibration callback function. More...
 
void emberChildJoinHandler (EmberNodeType nodeType, EmberNodeId nodeId)
 This handler is invoked at coordinator, range extender, or mac mode nodes when a new child has joined the device. More...
 

APIs

void emberStackPowerDown (void)
 Immediately turns the radio power completely off. More...
 
void emberStackPowerUp (void)
 Power up the radio. Typically called coming out of sleep. More...
 
EmberNetworkStatus emberNetworkState (void)
 Return the current join status. More...
 
bool emberStackIsUp (void)
 Indicate whether the stack is currently up. More...
 
EmberStatus emberSetSecurityKey (EmberKeyData *key)
 Set the security key. More...
 
EmberStatus emberGetSecurityKey (EmberKeyData *key)
 Get the security key. More...
 
EmberStatus emberSetRadioChannelExtended (uint16_t channel, bool persistent)
 Set the channel to use for sending and receiving messages on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config. More...
 
EmberStatus emberSetRadioChannel (uint16_t channel)
 Set the channel to use for sending and receiving messages on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config. More...
 
uint16_t emberGetRadioChannel (void)
 Get the radio channel, to which a node is set, on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config. More...
 
uint16_t emberGetDefaultChannel (void)
 Get the first available channel in the current radio configuration. More...
 
EmberStatus emberPhyConfigInit (EmberPhyType phyType)
 Indicate if the PHY configuration of the stack. Currently only supporting EMBER_RADIO_CONFIGURATOR and EMBER_STANDARD_PHY_2_4GHZ. It must be called before initialising the stack. More...
 
EmberStatus emberCalibrateCurrentChannelExtended (uint32_t calValueIn, uint32_t *calValueOut)
 Perform image rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on. More...
 
void emberCalibrateCurrentChannel (void)
 Perform image rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on. More...
 
EmberStatus emberApplyIrCalibration (uint32_t calValue)
 Apply Image Rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on. More...
 
EmberStatus emberTempCalibration (void)
 Perform Temperature VCO calibration calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on. More...
 
EmberCalType emberGetCalType (void)
 Fetch calibration type associated to the latest emberRadioNeedsCalibratingHandler() callback. More...
 
EmberStatus emberSetRadioPower (int16_t power, bool persistent)
 Set the radio output power at which a node is to operate for the current network. The radio has a finite power resolution, so it will approximate the requested power with the closest possible value at or below the requested value. More...
 
int16_t emberGetRadioPower (void)
 Get the radio output power of the current network at which a node is operating. This might be different to what you set using emberSetRadioPower because the radio has a finite power resolution, and emberSetRadioPower must approximate to the closest possible value at or below the requested value. This API however returns with the actual setting. More...
 
EmberStatus emberSetRadioPowerMode (bool radioOn)
 Allow the application to turn the radio on/off. This API is intended for use with direct devices only. More...
 
EmberStatus emberSetMacParams (int8_t ccaThreshold, uint8_t maxCcaAttempts, uint8_t minBackoffExp, uint8_t maxBackoffExp, uint16_t ccaBackoff, uint16_t ccaDuration, uint8_t maxRetries, uint32_t csmaTimeout, uint16_t ackTimeout)
 Sets the MAC layer transmission parameters. More...
 
EmberStatus emberMacGetParentAddress (EmberMacAddress *parentAddress)
 An API to retrieve the parent address. This API can be invoked only for nodes of EMBER_MAC_MODE_DEVICE or EMBER_MAC_MODE_SLEEPY_DEVICE type. More...
 
uint32_t emberStackIdleTimeMs (uint16_t *currentStackTasks)
 Return the time in milliseconds the stack could idle for. More...
 
uint16_t emberCurrentStackTasks (void)
 Return a bitmask indicating the stack's current tasks. More...
 
bool emberOkToNap (void)
 Indicate whether the stack is currently in a state with no high-priority tasks and may sleep. More...
 
bool emberOkToHibernate (void)
 Indicate whether the stack currently has any pending tasks. More...
 
EmberEUI64 emberGetEui64 (void)
 Return the EUI64 ID of the local node. More...
 
bool emberIsLocalEui64 (EmberEUI64 eui64)
 Determines whether eui64 is the local node's EUI64 ID. EUI64 is accessible easily in SoC mode, but in Host-NCP, the address is stored on the NCP. This API can be used on the Host to compare a value with the locally stored one. More...
 
EmberNodeId emberGetNodeId (void)
 Return the 16-bit node ID of local node on the current network. More...
 
EmberPanId emberGetPanId (void)
 Return the local node's PAN ID of the current network. More...
 
EmberNodeType emberGetNodeType (void)
 Return an EmberNodeType value indicating the type of the node. More...
 
EmberNodeId emberGetParentId (void)
 Return the parent's node ID. More...
 

Detailed Description

Connect API for accessing and modifying stack states and behaviors.

See stack-info.h for source code.

Macro Definition Documentation

◆ EMBER_HIGH_PRIORITY_TASKS

#define EMBER_HIGH_PRIORITY_TASKS   (EMBER_OUTGOING_MESSAGES | EMBER_INCOMING_MESSAGES | EMBER_RADIO_IS_ON)

A mask of the tasks that prevent a device from sleeping.

Definition at line 44 of file stack-info.h.

◆ EMBER_INVALID_CHANNEL

#define EMBER_INVALID_CHANNEL   65535

Invalid channel number.

Definition at line 51 of file stack-info.h.

Function Documentation

◆ emberApplyIrCalibration()

EmberStatus emberApplyIrCalibration ( uint32_t  calValue)

Apply Image Rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on.

Parameters
[in]calValueInthe calibration value to apply. Should not be set to EMBER_CAL_INVALID_VALUE.
Returns
An EmberStatus value indicating the success or failure of the command.

◆ emberCalibrateCurrentChannel()

void emberCalibrateCurrentChannel ( void  )

Perform image rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on.

◆ emberCalibrateCurrentChannelExtended()

EmberStatus emberCalibrateCurrentChannelExtended ( uint32_t  calValueIn,
uint32_t *  calValueOut 
)

Perform image rejection calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on.

Parameters
[in]calValueInthe calibration value to use. Set to EMBER_CAL_INVALID_VALUE to perform automatic calibration.
[out]calValueOuta pointer to the calibration value that was used. This parameter is ignored when set to NULL.
Returns
An EmberStatus value indicating the success or failure of the command.

◆ emberChildJoinHandler()

void emberChildJoinHandler ( EmberNodeType  nodeType,
EmberNodeId  nodeId 
)

This handler is invoked at coordinator, range extender, or mac mode nodes when a new child has joined the device.

Parameters
[in]nodeTypeThe role of the joining device (EMBER_STAR_RANGE_EXTENDER, EMBER_STAR_END_DEVICE, EMBER_STAR_SLEEPY_END_DEVICE, EMBER_MAC_MODE_DEVICE or EMBER_MAC_MODE_SLEEPY_DEVICE).
[in]nodeIdThe node ID of the joining device.

◆ emberCurrentStackTasks()

uint16_t emberCurrentStackTasks ( void  )

Return a bitmask indicating the stack's current tasks.

The mask EMBER_HIGH_PRIORITY_TASKS defines which tasks are high-priority. Devices should not sleep if any high-priority tasks are active. Active tasks that are not high-priority are waiting for messages to arrive from other devices. If there are active tasks, but no high-priority ones, the device may sleep but should periodically wake up and call emberPollForData() to receive messages. Parents will hold messages for EMBER_INDIRECT_TRANSMISSION_TIMEOUT_MS milliseconds before discarding them.

Returns
A bitmask of the stack's active tasks.

◆ emberGetCalType()

EmberCalType emberGetCalType ( void  )

Fetch calibration type associated to the latest emberRadioNeedsCalibratingHandler() callback.

Returns
An EmberCalType value indicating which type of calibration should be performed.

◆ emberGetDefaultChannel()

uint16_t emberGetDefaultChannel ( void  )

Get the first available channel in the current radio configuration.

Returns
The first available channel in the radio configuration. 0xffff if error

◆ emberGetEui64()

EmberEUI64 emberGetEui64 ( void  )

Return the EUI64 ID of the local node.

Returns
The 64-bit ID.

◆ emberGetNodeId()

EmberNodeId emberGetNodeId ( void  )

Return the 16-bit node ID of local node on the current network.

Returns
The 16-bit ID. Byte order is little endian.

◆ emberGetNodeType()

EmberNodeType emberGetNodeType ( void  )

Return an EmberNodeType value indicating the type of the node.

Returns
The node type.

◆ emberGetPanId()

EmberPanId emberGetPanId ( void  )

Return the local node's PAN ID of the current network.

Returns
The PAN ID.

◆ emberGetParentId()

EmberNodeId emberGetParentId ( void  )

Return the parent's node ID.

Returns
The parent's node ID.

◆ emberGetRadioChannel()

uint16_t emberGetRadioChannel ( void  )

Get the radio channel, to which a node is set, on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config.

Returns
The current radio channel.

◆ emberGetRadioPower()

int16_t emberGetRadioPower ( void  )

Get the radio output power of the current network at which a node is operating. This might be different to what you set using emberSetRadioPower because the radio has a finite power resolution, and emberSetRadioPower must approximate to the closest possible value at or below the requested value. This API however returns with the actual setting.

Returns
Current radio output power, in deci-dBm.

◆ emberGetSecurityKey()

EmberStatus emberGetSecurityKey ( EmberKeyData key)

Get the security key.

◆ emberIsLocalEui64()

bool emberIsLocalEui64 ( EmberEUI64  eui64)

Determines whether eui64 is the local node's EUI64 ID. EUI64 is accessible easily in SoC mode, but in Host-NCP, the address is stored on the NCP. This API can be used on the Host to compare a value with the locally stored one.

Parameters
[in]eui64An EUI64 ID.
Returns
true if eui64 is the local node's ID, otherwise false.

◆ emberMacGetParentAddress()

EmberStatus emberMacGetParentAddress ( EmberMacAddress parentAddress)

An API to retrieve the parent address. This API can be invoked only for nodes of EMBER_MAC_MODE_DEVICE or EMBER_MAC_MODE_SLEEPY_DEVICE type.

Returns
An EmberStatus value of EMBER_SUCCESS if the parent address was successfully retrieved, otherwise an EmberStatus value indicating the reason of failure.

◆ emberNetworkState()

EmberNetworkStatus emberNetworkState ( void  )

Return the current join status.

Returns a value indicating whether the node is joining, joined to, or leaving a network.

Returns
An EmberNetworkStatus value indicating the current join status.

◆ emberOkToHibernate()

bool emberOkToHibernate ( void  )

Indicate whether the stack currently has any pending tasks.

If no tasks are pending , emberTick() does not need to be called until next stack API function is called. This function can only be called when the node type is EMBER_STAR_SLEEPY_END_DEVICE.

Returns
true if the application may sleep for as long as it wishes.

◆ emberOkToNap()

bool emberOkToNap ( void  )

Indicate whether the stack is currently in a state with no high-priority tasks and may sleep.

Tasks may be expecting incoming messages, in which case the device should periodically wake up and call emberPollForData() to receive messages. This function can only be called when the node type is EMBER_STAR_SLEEPY_END_DEVICE.

Returns
true if the application may sleep but the stack may be expecting incoming messages.

◆ emberPhyConfigInit()

EmberStatus emberPhyConfigInit ( EmberPhyType  phyType)

Indicate if the PHY configuration of the stack. Currently only supporting EMBER_RADIO_CONFIGURATOR and EMBER_STANDARD_PHY_2_4GHZ. It must be called before initialising the stack.

Returns
EMBER_BAD_ARGUMENT if phyType is incorrect EMBER_INVALID_CALL if API is called after stack initialization EMBER_SUCCESS otherwise

◆ emberRadioNeedsCalibratingHandler()

void emberRadioNeedsCalibratingHandler ( void  )

The radio calibration callback function.

This handler is invoked by the stack upon receiving a "calibration needed" event from the radio to inform the application that it should perform calibration of the current channel as soon as possible using the emberCalibrateCurrentChannel() API. While calibration only takes tens of microseconds, the application can failsafe any critical processes or peripherals before calling emberCalibrateCurrentChannel(). The application must call emberCalibrateCurrentChannel() in response to this callback to maintain expected radio performance.

◆ emberSetMacParams()

EmberStatus emberSetMacParams ( int8_t  ccaThreshold,
uint8_t  maxCcaAttempts,
uint8_t  minBackoffExp,
uint8_t  maxBackoffExp,
uint16_t  ccaBackoff,
uint16_t  ccaDuration,
uint8_t  maxRetries,
uint32_t  csmaTimeout,
uint16_t  ackTimeout 
)

Sets the MAC layer transmission parameters.

Parameters
[in]ccaThresholdThe CCA RSSI threshold, in dBm, above which the channel is considered 'busy'. This parameter is by default set to EMBER_RADIO_CCA_THRESHOLD.
[in]maxCcaAttemptsThe maximum number of clear channel assessment attempts that are performed prior to fail to transmit a packet with EMBER_PHY_TX_CCA_FAIL status. This parameter is set by default to 4. If this parameter is set to 0, the CCA assessment shall not be performed.
[in]minBackoffExpThe backoff exponent used if the initial channel clear assessment fails. This parameter is set by default to 3. Note: this is meaningful only if the checkCca parameter is set to true.
[in]maxBackoffExpThe backoff exponent used if the final channel clear assessment fails. This parameter is set by default to 5. Note: this is meaningful only if the checkCca parameter is set to true.
[in]ccaBackoffThe backoff unit period in microsecond. It is multiplied by the random backoff exponential controlled by minBackoffExp and maxBackoffExp to determine the overall backoff period. This parameter is set by default to the PHY symbol time in microseconds multiplied by 20.
[in]ccaDurationThe minimum desired CCA check duration in microseconds. This parameter is set by default to the PHY symbol time in microseconds multiplied by 8.
[in]maxRetriesThe number of transmission retries that is performed if no acknowledgment was received. This parameter is set by default to 3 (which means that a total of 4 transmission attempts will be performed).
[in]csmaTimeoutAn overall timeout in microsecond time base for the the CSMA operations. This value is set by default to 0 which means that no timeout is imposed.
[in]ackTimeoutThe ack timeout in microsends after which the transmitting shall give up waiting for an acknowledment. This parameter is set by default to (EMBER_MAC_ACK_TIMEOUT_MS * 1000).
Note
The CSMA/CA (CCA) values are directly used in RAIL's RAIL_CsmaConfig_t and further information can be found in the RAIL API documentation.
Returns
An EmberStatus value indicating whether the MAC parameters were successfully set or the reason of failure.

◆ emberSetRadioChannel()

EmberStatus emberSetRadioChannel ( uint16_t  channel)

Set the channel to use for sending and receiving messages on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config.

Note
Care should be taken when using this API. All devices on a network must use the same channel. Each call triggers a token write. Excessive usage might cause flash to wear-out.
Parameters
[in]channelA desired radio channel.
Returns
An EmberStatus value of:

◆ emberSetRadioChannelExtended()

EmberStatus emberSetRadioChannelExtended ( uint16_t  channel,
bool  persistent 
)

Set the channel to use for sending and receiving messages on the current network. The available channels depend on the radio config you use, and channels can differ more than the frequency if it's a multi-PHY config.

Note
Care should be taken when using this API. All devices on a network must use the same channel.
Parameters
[in]channelA desired radio channel.
[in]persistentA flag to instruct the stack to save the channel setting in persistent or not. Each persistent call triggers a token write. Excessive usage might cause flash to wear-out.
Returns
An EmberStatus value of:

◆ emberSetRadioPower()

EmberStatus emberSetRadioPower ( int16_t  power,
bool  persistent 
)

Set the radio output power at which a node is to operate for the current network. The radio has a finite power resolution, so it will approximate the requested power with the closest possible value at or below the requested value.

Note
Care should be taken when using this API on a running network, because it directly impacts the established link qualities neighboring nodes have with the node on which it is called. This can lead to disruption of existing routes and erratic network behavior.
Parameters
[in]powerDesired radio output power, in deci-dBm.
[in]persistentA flag to instruct the stack to save the power setting in persistent or not.
Returns
An EmberStatus value indicating the success or failure of the command. Failure indicates that the requested power level is out of range.

◆ emberSetRadioPowerMode()

EmberStatus emberSetRadioPowerMode ( bool  radioOn)

Allow the application to turn the radio on/off. This API is intended for use with direct devices only.

Parameters
[in]radioOnIf this parameter is true, the radio is turned on, otherwise it's turned off.
Returns
An EmberStatus value indicating the success or failure of the command. Failure indicates that the node type is a type other than EMBER_DIRECT_DEVICE.

◆ emberSetSecurityKey()

EmberStatus emberSetSecurityKey ( EmberKeyData key)

Set the security key.

Parameters
[out]keyAn EmberKeyData value containing the security key to be set.
Returns
An EmberStatus value of EMBER_SUCCESS if the key was successfully set. Otherwise, it returns an EmberStatus value of EMBER_INVALID_CALL.

◆ emberStackIdleHandler()

bool emberStackIdleHandler ( uint32_t *  idleTimeMs)

A callback to allow the application to manage idling the MCU.

Parameters
[in,out]idleTimeMsA pointer to the time in millisecond the stack is allowed to idle. If the application decides to manage idling the MCU, it should update the passed value with the actual time the MCU was idled.
Returns
true if the application is managing idling the MCU, false otherwise. If this function returns false, the stack will manage idling the MCU.

◆ emberStackIdleTimeMs()

uint32_t emberStackIdleTimeMs ( uint16_t *  currentStackTasks)

Return the time in milliseconds the stack could idle for.

Parameters
[in]currentStackTasksA pointer to an integer that is written with the active stack tasks at the time of the API call.
Returns
Allowed idle time in milliseconds.

◆ emberStackIsrHandler()

void emberStackIsrHandler ( void  )

This handler is invoked in ISR context when certain stack-related ISR routines fire.

◆ emberStackIsUp()

bool emberStackIsUp ( void  )

Indicate whether the stack is currently up.

Returns true if the stack is joined to a network and ready to send and receive messages. This reflects only the state of the local node and does not indicate whether or not other nodes are able to communicate with this node.

Returns
true if the stack is up, false otherwise.

◆ emberStackPowerDown()

void emberStackPowerDown ( void  )

Immediately turns the radio power completely off.

After calling this function, do not call any other stack function except emberStackPowerUp() because all other stack functions require that the radio is powered to operate properly.

◆ emberStackPowerUp()

void emberStackPowerUp ( void  )

Power up the radio. Typically called coming out of sleep.

For non-sleepy devices, also turns the radio on and leaves it in RX mode.

◆ emberStackStatusHandler()

void emberStackStatusHandler ( EmberStatus  status)

A callback invoked when the status of the stack changes.

The application is free to begin messaging once it receives the EMBER_NETWORK_UP status.

Parameters
[in]statusStack status. One of the following:

◆ emberTempCalibration()

EmberStatus emberTempCalibration ( void  )

Perform Temperature VCO calibration calibration on the current channel. The stack will notify the application of the need for channel calibration via the emberRadioNeedsCalibratingHandler() callback function during emberTick(). This function should only be called from within the context of the emberRadioNeedsCalibratingHandler() callback function. Note if this function is called when the radio is off, it will turn the radio on and leave it on.

Returns
An EmberStatus value indicating the success or failure of the command.