nRF5 SDK for Thread v0.10.0
Functions
Router/Leader

This module includes functions for Thread Routers and Leaders. More...

Functions

OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadSetMaxAllowedChildren (otInstance *aInstance, uint8_t aMaxChildren)
 
OTAPI bool OTCALL otThreadIsRouterRoleEnabled (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetRouterRoleEnabled (otInstance *aInstance, bool aEnabled)
 
OTAPI otError OTCALL otThreadSetPreferredRouterId (otInstance *aInstance, uint8_t aRouterId)
 
OTAPI uint8_t OTCALL otThreadGetLocalLeaderWeight (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetLocalLeaderWeight (otInstance *aInstance, uint8_t aWeight)
 
OTAPI uint32_t OTCALL otThreadGetLocalLeaderPartitionId (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetLocalLeaderPartitionId (otInstance *aInstance, uint32_t aPartitionId)
 
OTAPI uint16_t OTCALL otThreadGetJoinerUdpPort (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadSetJoinerUdpPort (otInstance *aInstance, uint16_t aJoinerUdpPort)
 
otError otThreadSetSteeringData (otInstance *aInstance, otExtAddress *aExtAddress)
 
OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetContextIdReuseDelay (otInstance *aInstance, uint32_t aDelay)
 
OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetNetworkIdTimeout (otInstance *aInstance, uint8_t aTimeout)
 
OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetRouterUpgradeThreshold (otInstance *aInstance, uint8_t aThreshold)
 
OTAPI otError OTCALL otThreadReleaseRouterId (otInstance *aInstance, uint8_t aRouterId)
 
OTAPI otError OTCALL otThreadBecomeRouter (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadBecomeLeader (otInstance *aInstance)
 
OTAPI uint8_t OTCALL otThreadGetRouterDowngradeThreshold (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetRouterDowngradeThreshold (otInstance *aInstance, uint8_t aThreshold)
 
OTAPI uint8_t OTCALL otThreadGetRouterSelectionJitter (otInstance *aInstance)
 
OTAPI void OTCALL otThreadSetRouterSelectionJitter (otInstance *aInstance, uint8_t aRouterJitter)
 
OTAPI otError OTCALL otThreadGetChildInfoById (otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
 
OTAPI otError OTCALL otThreadGetChildInfoByIndex (otInstance *aInstance, uint8_t aChildIndex, otChildInfo *aChildInfo)
 
OTAPI uint8_t OTCALL otThreadGetRouterIdSequence (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadGetRouterInfo (otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
 
OTAPI otError OTCALL otThreadGetEidCacheEntry (otInstance *aInstance, uint8_t aIndex, otEidCacheEntry *aEntry)
 
OTAPI const uint8_t *OTCALL otThreadGetPSKc (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadSetPSKc (otInstance *aInstance, const uint8_t *aPSKc)
 
OTAPI int8_t OTCALL otThreadGetParentPriority (otInstance *aInstance)
 
OTAPI otError OTCALL otThreadSetParentPriority (otInstance *aInstance, int8_t aParentPriority)
 

Detailed Description

This module includes functions for Thread Routers and Leaders.

Function Documentation

OTAPI otError OTCALL otThreadBecomeLeader ( otInstance *  aInstance)

Become a leader and start a new partition.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully became a leader and started a new partition.
OT_ERROR_INVALID_STATEThread is disabled.
OTAPI otError OTCALL otThreadBecomeRouter ( otInstance *  aInstance)

Attempt to become a router.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully begin attempt to become a router.
OT_ERROR_INVALID_STATEThread is disabled.
OTAPI otError OTCALL otThreadGetChildInfoById ( otInstance *  aInstance,
uint16_t  aChildId,
otChildInfo aChildInfo 
)

The function retains diagnostic information for an attached Child by its Child ID or RLOC16.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aChildIdThe Child ID or RLOC16 for the attached child.
[out]aChildInfoA pointer to where the child information is placed.
Return values
OT_ERROR_NONEaChildInfo was successfully updated with the info for the given ID.
OT_ERROR_NOT_FOUNDNo valid child with this Child ID.
OT_ERROR_INVALID_ARGSIf aChildInfo is NULL.
OTAPI otError OTCALL otThreadGetChildInfoByIndex ( otInstance *  aInstance,
uint8_t  aChildIndex,
otChildInfo aChildInfo 
)

The function retains diagnostic information for an attached Child by the internal table index.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aChildIndexThe table index.
[out]aChildInfoA pointer to where the child information is placed.
Return values
OT_ERROR_NONEaChildInfo was successfully updated with the info for the given index.
OT_ERROR_NOT_FOUNDNo valid child at this index.
OT_ERROR_INVALID_ARGSEither aChildInfo is NULL, or aChildIndex is out of range (higher than max table index).
See Also
otGetMaxAllowedChildren
OTAPI uint32_t OTCALL otThreadGetContextIdReuseDelay ( otInstance *  aInstance)

Get the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The CONTEXT_ID_REUSE_DELAY value.
See Also
otThreadSetContextIdReuseDelay
OTAPI otError OTCALL otThreadGetEidCacheEntry ( otInstance *  aInstance,
uint8_t  aIndex,
otEidCacheEntry aEntry 
)

This function gets an EID cache entry.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aIndexAn index into the EID cache table.
[out]aEntryA pointer to where the EID information is placed.
Return values
OT_ERROR_NONESuccessfully retrieved the EID cache entry.
OT_ERROR_INVALID_ARGSaIndex was out of bounds or aEntry was NULL.
OTAPI uint16_t OTCALL otThreadGetJoinerUdpPort ( otInstance *  aInstance)

Get the Joiner UDP Port.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The Joiner UDP Port number.
See Also
otThreadSetJoinerUdpPort
OTAPI uint32_t OTCALL otThreadGetLocalLeaderPartitionId ( otInstance *  aInstance)

Get the Thread Leader Partition Id used when operating in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The Thread Leader Partition Id value.
OTAPI uint8_t OTCALL otThreadGetLocalLeaderWeight ( otInstance *  aInstance)

Get the Thread Leader Weight used when operating in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The Thread Leader Weight value.
See Also
otThreadSetLeaderWeight
OTAPI uint8_t OTCALL otThreadGetMaxAllowedChildren ( otInstance *  aInstance)

Get the maximum number of children currently allowed.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The maximum number of children currently allowed.
See Also
otThreadSetMaxAllowedChildren
OTAPI uint8_t OTCALL otThreadGetNetworkIdTimeout ( otInstance *  aInstance)

Get the NETWORK_ID_TIMEOUT parameter used in the Router role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The NETWORK_ID_TIMEOUT value.
See Also
otThreadSetNetworkIdTimeout
OTAPI int8_t OTCALL otThreadGetParentPriority ( otInstance *  aInstance)

Get the assigned parent priority.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The assigned parent priority value, -2 means not assigned.
See Also
otThreadSetParentPriority
OTAPI const uint8_t* OTCALL otThreadGetPSKc ( otInstance *  aInstance)

Get the thrPSKc.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
A pointer to a buffer containing the thrPSKc.
See Also
otThreadSetPSKc
OTAPI uint8_t OTCALL otThreadGetRouterDowngradeThreshold ( otInstance *  aInstance)

Get the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Router role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The ROUTER_DOWNGRADE_THRESHOLD value.
See Also
otThreadSetRouterDowngradeThreshold
OTAPI uint8_t OTCALL otThreadGetRouterIdSequence ( otInstance *  aInstance)

Get the current Router ID Sequence.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The Router ID Sequence.
OTAPI otError OTCALL otThreadGetRouterInfo ( otInstance *  aInstance,
uint16_t  aRouterId,
otRouterInfo aRouterInfo 
)

The function retains diagnostic information for a given Thread Router.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aRouterIdThe router ID or RLOC16 for a given router.
[out]aRouterInfoA pointer to where the router information is placed.
OTAPI uint8_t OTCALL otThreadGetRouterSelectionJitter ( otInstance *  aInstance)

Get the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The ROUTER_SELECTION_JITTER value.
See Also
otThreadSetRouterSelectionJitter
OTAPI uint8_t OTCALL otThreadGetRouterUpgradeThreshold ( otInstance *  aInstance)

Get the ROUTER_UPGRADE_THRESHOLD parameter used in the REED role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The ROUTER_UPGRADE_THRESHOLD value.
See Also
otThreadSetRouterUpgradeThreshold
OTAPI bool OTCALL otThreadIsRouterRoleEnabled ( otInstance *  aInstance)

This function indicates whether or not the Router Role is enabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
TRUEIf the Router Role is enabled.
FALSEIf the Router Role is not enabled.
OTAPI otError OTCALL otThreadReleaseRouterId ( otInstance *  aInstance,
uint8_t  aRouterId 
)

Release a Router ID that has been allocated by the device in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aRouterIdThe Router ID to release. Valid range is [0, 62].
Return values
OT_ERROR_NONESuccessfully released the Router ID specified by aRouterId.
OTAPI void OTCALL otThreadSetContextIdReuseDelay ( otInstance *  aInstance,
uint32_t  aDelay 
)

Set the CONTEXT_ID_REUSE_DELAY parameter used in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aDelayThe CONTEXT_ID_REUSE_DELAY value.
See Also
otThreadGetContextIdReuseDelay
OTAPI otError OTCALL otThreadSetJoinerUdpPort ( otInstance *  aInstance,
uint16_t  aJoinerUdpPort 
)

Set the Joiner UDP Port

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aJoinerUdpPortThe Joiner UDP Port number.
Return values
OT_ERROR_NONESuccessfully set the Joiner UDP Port.
See Also
otThreadGetJoinerUdpPort
OTAPI void OTCALL otThreadSetLocalLeaderPartitionId ( otInstance *  aInstance,
uint32_t  aPartitionId 
)

Set the Thread Leader Partition Id used when operating in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPartitionIdThe Thread Leader Partition Id value.
OTAPI void OTCALL otThreadSetLocalLeaderWeight ( otInstance *  aInstance,
uint8_t  aWeight 
)

Set the Thread Leader Weight used when operating in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aWeightThe Thread Leader Weight value.
See Also
otThreadGetLeaderWeight
OTAPI otError OTCALL otThreadSetMaxAllowedChildren ( otInstance *  aInstance,
uint8_t  aMaxChildren 
)

Set the maximum number of children currently allowed.

This parameter can only be set when Thread protocol operation has been stopped.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aMaxChildrenThe maximum allowed children.
Return values
OT_ERROR_NONESuccessfully set the max.
OT_ERROR_INVALID_ARGSIf aMaxChildren is not in the range [1, OPENTHREAD_CONFIG_MAX_CHILDREN].
OT_ERROR_INVALID_STATEIf Thread isn't stopped.
See Also
otThreadGetMaxAllowedChildren, otThreadStop
OTAPI void OTCALL otThreadSetNetworkIdTimeout ( otInstance *  aInstance,
uint8_t  aTimeout 
)

Set the NETWORK_ID_TIMEOUT parameter used in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aTimeoutThe NETWORK_ID_TIMEOUT value.
See Also
otThreadGetNetworkIdTimeout
OTAPI otError OTCALL otThreadSetParentPriority ( otInstance *  aInstance,
int8_t  aParentPriority 
)

Set the parent priority.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aParentPriorityThe parent priority value.
Return values
OT_ERROR_NONESuccessfully set the parent priority.
OT_ERROR_INVALID_ARGSIf the parent priority value is not among 1, 0, -1 and -2.
See Also
otThreadGetParentPriority
OTAPI otError OTCALL otThreadSetPreferredRouterId ( otInstance *  aInstance,
uint8_t  aRouterId 
)

Set the preferred Router Id.

Upon becoming a router/leader the node attempts to use this Router Id. If the preferred Router Id is not set or if it can not be used, a randomly generated router id is picked. This property can be set only when the device role is either detached or disabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aRouterIdThe preferred Router Id.
Return values
OT_ERROR_NONESuccessfully set the preferred Router Id.
OT_ERROR_INVALID_STATECould not set (role is not detached or disabled)
OTAPI otError OTCALL otThreadSetPSKc ( otInstance *  aInstance,
const uint8_t *  aPSKc 
)

Set the thrPSKc.

This function will only succeed when Thread protocols are disabled. A successful call to this function will also invalidate the Active and Pending Operational Datasets in non-volatile memory.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aPSKcA pointer to a buffer containing the thrPSKc.
Return values
OT_ERROR_NONESuccessfully set the thrPSKc.
OT_ERROR_INVALID_STATEThread protocols are enabled.
See Also
otThreadGetPSKc
OTAPI void OTCALL otThreadSetRouterDowngradeThreshold ( otInstance *  aInstance,
uint8_t  aThreshold 
)

Set the ROUTER_DOWNGRADE_THRESHOLD parameter used in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aThresholdThe ROUTER_DOWNGRADE_THRESHOLD value.
See Also
otThreadGetRouterDowngradeThreshold
OTAPI void OTCALL otThreadSetRouterRoleEnabled ( otInstance *  aInstance,
bool  aEnabled 
)

This function sets whether or not the Router Role is enabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnabledTRUE if the Router Role is enabled, FALSE otherwise.
OTAPI void OTCALL otThreadSetRouterSelectionJitter ( otInstance *  aInstance,
uint8_t  aRouterJitter 
)

Set the ROUTER_SELECTION_JITTER parameter used in the REED/Router role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aRouterJitterThe ROUTER_SELECTION_JITTER value.
See Also
otThreadGetRouterSelectionJitter
OTAPI void OTCALL otThreadSetRouterUpgradeThreshold ( otInstance *  aInstance,
uint8_t  aThreshold 
)

Set the ROUTER_UPGRADE_THRESHOLD parameter used in the Leader role.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aThresholdThe ROUTER_UPGRADE_THRESHOLD value.
See Also
otThreadGetRouterUpgradeThreshold
otError otThreadSetSteeringData ( otInstance *  aInstance,
otExtAddress aExtAddress 
)

Set Steering data out of band

Configuration option OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB should be set to enable setting of steering data out of band. Otherwise calling this function does nothing and it returns OT_ERROR_DISABLED_FEATURE error.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aExtAddressAddress used to update the steering data. All zeros to clear the steering data (no steering data). All 0xFFs to set steering data/bloom filter to accept/allow all. A specific EUI64 which is then added to current steering data/bloom filter.
Return values
OT_ERROR_NONESuccessfully set/updated the steering data.
OT_ERROR_DISABLED_FEATUREFeature is disabled, not capable of setting steering data out of band.

Documentation feedback | Developer Zone | Subscribe | Updated