路由器/领导者
此模块包含线程路由器和主要副本的函数。
总结
枚举 |
|
---|---|
otCacheEntryState
|
枚举 定义 EID 缓存条目状态。 |
otNeighborTableEvent{
|
枚举 定义 otNeighborTableCallback 中用于指示邻域表发生更改的常量。 |
otPowerSupply{
|
枚举 表示设备上的电源属性。 |
类型定义符 |
|
---|---|
otCacheEntryInfo
|
typedefstruct otCacheEntryInfo
表示 EID 缓存条目。 |
otCacheEntryIterator
|
typedefstruct otCacheEntryIterator
表示用于迭代 EID 缓存表条目的迭代器。 |
otCacheEntryState
|
typedefenum otCacheEntryState
定义 EID 缓存条目状态。 |
otChildIp6AddressIterator
|
typedefuint16_t
用于遍历 Thread Child 条目的 IPv6 地址。 |
otDeviceProperties
|
typedefstruct otDeviceProperties
表示用于计算设备上的本地前导权重的设备属性。 |
otNeighborTableCallback)(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)
|
typedefvoid(*
系统会调用指针来通知邻表发生了更改。 |
函数 |
|
---|---|
otThreadBecomeLeader(otInstance *aInstance)
|
成为领先变体并启动新的分区。
|
otThreadBecomeRouter(otInstance *aInstance)
|
尝试成为路由器。
|
otThreadGetChildInfoById(otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo)
|
根据所关联子项的子 ID 或 RLOC16 获取诊断信息。
|
otThreadGetChildInfoByIndex(otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo)
|
函数通过内部表索引保留附加的子元素的诊断信息。
|
otThreadGetChildNextIp6Address(otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, otIp6Address *aAddress)
|
获取给定子项的下一个 IPv6 地址(使用迭代器)。
|
otThreadGetChildRouterLinks(otInstance *aInstance)
|
uint8_t
获取 REED 角色中使用的 MLE_CHILD_ROUTER_LINKS 参数。
|
otThreadGetContextIdReuseDelay(otInstance *aInstance)
|
uint32_t
获取 Leader 角色中使用的 CONTEXT_ID_REUSE_DELAY 参数。
|
otThreadGetDeviceProperties(otInstance *aInstance)
|
const otDeviceProperties *
获取当前的设备属性。
|
otThreadGetJoinerUdpPort(otInstance *aInstance)
|
uint16_t
获取 Joiner UDP 端口。
|
otThreadGetLocalLeaderWeight(otInstance *aInstance)
|
uint8_t
获取以 Leader 角色运行时使用的 Thread Leader Weight。
|
otThreadGetMaxAllowedChildren(otInstance *aInstance)
|
uint16_t
获取当前允许的子项数上限。
|
otThreadGetMaxChildIpAddresses(otInstance *aInstance)
|
uint8_t
获取每个 MTD 子级可在此设备上注册为父级的 IP 地址数量上限。
|
otThreadGetMaxRouterId(otInstance *aInstance)
|
uint8_t
函数会返回允许的路由器 ID 数上限。
|
otThreadGetNetworkIdTimeout(otInstance *aInstance)
|
uint8_t
获取路由器角色中使用的 NETWORK_ID_TIMEOUT 参数。
|
otThreadGetNextCacheEntry(otInstance *aInstance, otCacheEntryInfo *aEntryInfo, otCacheEntryIterator *aIterator)
|
获取下一个 EID 缓存条目(使用迭代器)。
|
otThreadGetNextHopAndPathCost(otInstance *aInstance, uint16_t aDestRloc16, uint16_t *aNextHopRloc16, uint8_t *aPathCost)
|
void
获取指向指定 RLOC16 目的地的下一个跃点和路径费用。
|
otThreadGetParentPriority(otInstance *aInstance)
|
int8_t
获取分配的父级优先级。
|
otThreadGetPreferredLeaderPartitionId(otInstance *aInstance)
|
uint32_t
获取以 Leader 角色运行时使用的首选 Thread Leader Partition ID。
|
otThreadGetPskc(otInstance *aInstance, otPskc *aPskc)
|
void
获取 PSKc。
|
otThreadGetPskcRef(otInstance *aInstance)
|
获取对 Thread PSKc 存储的密钥引用。
|
otThreadGetRouterDowngradeThreshold(otInstance *aInstance)
|
uint8_t
获取路由器角色中使用的 ROUTER_DOWNGrade_THRESHOLD 参数。
|
otThreadGetRouterIdRange(otInstance *aInstance, uint8_t *aMinRouterId, uint8_t *aMaxRouterId)
|
void
获取允许分配给线程网络中的节点的路由器 ID 范围。
|
otThreadGetRouterIdSequence(otInstance *aInstance)
|
uint8_t
获取当前的路由器 ID 序列。
|
otThreadGetRouterInfo(otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo)
|
该函数会保留给定线程路由器的诊断信息。
|
otThreadGetRouterSelectionJitter(otInstance *aInstance)
|
uint8_t
获取 REED/Router 角色中使用的 ROUTER_SELECTION_JITTER 参数。
|
otThreadGetRouterUpgradeThreshold(otInstance *aInstance)
|
uint8_t
获取 REED 角色中使用的 ROUTER_UPGrade_THRESHOLD 参数。
|
otThreadIsRouterEligible(otInstance *aInstance)
|
bool
指明设备是否符合路由器条件。
|
otThreadIsRouterIdAllocated(otInstance *aInstance, uint8_t aRouterId)
|
bool
指明当前是否分配了路由器 ID。
|
otThreadRegisterNeighborTableCallback(otInstance *aInstance, otNeighborTableCallback aCallback)
|
void
注册邻域表回调函数。
|
otThreadReleaseRouterId(otInstance *aInstance, uint8_t aRouterId)
|
释放设备在“主管”角色中分配的路由器 ID。
|
otThreadSetCcmEnabled(otInstance *aInstance, bool aEnabled)
|
void
设置设备是否通过使用 CCM 调试的。
|
otThreadSetChildRouterLinks(otInstance *aInstance, uint8_t aChildRouterLinks)
|
设置 REED 角色中使用的 MLE_CHILD_ROUTER_LINKS 参数。
|
otThreadSetContextIdReuseDelay(otInstance *aInstance, uint32_t aDelay)
|
void
设置“Leader”角色中使用的 CONTEXT_ID_REUSE_DELAY 参数。
|
otThreadSetDeviceProperties(otInstance *aInstance, const otDeviceProperties *aDeviceProperties)
|
void
设置设备属性,然后这些属性将用来确定和设置前导权重。
|
otThreadSetJoinerUdpPort(otInstance *aInstance, uint16_t aJoinerUdpPort)
|
设置 Joiner UDP 端口。
|
otThreadSetLocalLeaderWeight(otInstance *aInstance, uint8_t aWeight)
|
void
设置以 Leader 角色运行时使用的 Thread Leader Weight。
|
otThreadSetMaxAllowedChildren(otInstance *aInstance, uint16_t aMaxChildren)
|
设置当前允许的子级数量上限。
|
otThreadSetMaxChildIpAddresses(otInstance *aInstance, uint8_t aMaxIpAddresses)
|
设置或恢复每个 MTD 子设备可在此设备注册为父 IP 地址的 IP 地址数上限。
|
otThreadSetNetworkIdTimeout(otInstance *aInstance, uint8_t aTimeout)
|
void
设置 Leader 角色中使用的 NETWORK_ID_TIMEOUT 参数。
|
otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority)
|
设置父级优先级。
|
otThreadSetPreferredLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId)
|
void
设置以 Leader 角色运行时使用的首选 Thread Leader Partition ID。
|
otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId)
|
设置首选路由器 ID。
|
otThreadSetPskc(otInstance *aInstance, const otPskc *aPskc)
|
设置 Thread PSK。
|
otThreadSetPskcRef(otInstance *aInstance, otPskcRef aKeyRef)
|
设置 Thread PSK。
|
otThreadSetRouterDowngradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
void
设置 Leader 角色中使用的 ROUTER_DOWNGrade_THRESHOLD 参数。
|
otThreadSetRouterEligible(otInstance *aInstance, bool aEligible)
|
设置设备是否符合路由器条件。
|
otThreadSetRouterIdRange(otInstance *aInstance, uint8_t aMinRouterId, uint8_t aMaxRouterId)
|
设置允许分配给线程网络中的节点的路由器 ID 范围。
|
otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter)
|
void
设置 REED/Router 角色中使用的 ROUTER_SELECTION_JITTER 参数。
|
otThreadSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aThreshold)
|
void
设置“主要角色”角色中使用的 ROUTER_UPGrade_THRESHOLD 参数。
|
otThreadSetSteeringData(otInstance *aInstance, const otExtAddress *aExtAddress)
|
void
将带外数据设置为带外数据。
|
otThreadSetThreadVersionCheckEnabled(otInstance *aInstance, bool aEnabled)
|
void
设置是否已启用安全政策的 TLV 版本阈值(VR 字段)。
|
结构体 |
|
---|---|
otCacheEntryInfo |
表示 EID 缓存条目。 |
otCacheEntryIterator |
表示用于迭代 EID 缓存表条目的迭代器。 |
otChildInfo |
保留线程子级的诊断信息。 |
otDeviceProperties |
表示用于计算设备上的本地前导权重的设备属性。 |
otNeighborTableEntryInfo |
表示邻域表条目信息(子节点或路由器),并用作邻域表回调 |
枚举
otCacheEntryState
otCacheEntryState
定义 EID 缓存条目状态。
otNeighborTableEvent
otNeighborTableEvent
定义 otNeighborTableCallback
中用于指示邻域表发生更改的常量。
属性 | |
---|---|
OT_NEIGHBOR_TABLE_EVENT_CHILD_ADDED
|
正在添加儿童。 |
OT_NEIGHBOR_TABLE_EVENT_CHILD_MODE_CHANGED
|
已有孩子的模式会发生变化。 |
OT_NEIGHBOR_TABLE_EVENT_CHILD_REMOVED
|
正在移除儿童。 |
OT_NEIGHBOR_TABLE_EVENT_ROUTER_ADDED
|
正在添加路由器。 |
OT_NEIGHBOR_TABLE_EVENT_ROUTER_REMOVED
|
正在移除某个路由器。 |
超级电源
otPowerSupply
表示设备上的电源属性。
此属性用作 otDeviceProperties
中的属性,用于计算前导权重。
属性 | |
---|---|
OT_POWER_SUPPLY_BATTERY
|
电池供电。 |
OT_POWER_SUPPLY_EXTERNAL
|
由外部电源(由电源供电) |
OT_POWER_SUPPLY_EXTERNAL_STABLE
|
稳定的外部电源(备用电池或 UPS)。 |
OT_POWER_SUPPLY_EXTERNAL_UNSTABLE
|
外部电源可能不稳定(例如灯泡通过开关供电)。 |
类型定义符
otCacheEntryIterator
struct otCacheEntryIterator otCacheEntryIterator
表示用于迭代 EID 缓存表条目的迭代器。
要初始化迭代器并从缓存表中的第一个条目开始,请将结构中的所有字段设置为零(例如,memset
迭代器到零)。
otChildIp6AddressIterator
uint16_t otChildIp6AddressIterator
用于遍历 Thread Child 条目的 IPv6 地址。
otDeviceProperties
struct otDeviceProperties otDeviceProperties
表示用于计算设备上的本地前导权重的设备属性。
这些参数是根据设备的功能(无论是充当边界路由器、电源配置等)设置的。
mIsUnstable
表示设备的稳定性,通过供应商特定的机制来确定。该权限可以包括:
- 设备内部检测到外部电源丢失的频率高于平时。通常由供应商决定。
- 设备内部检测到它重新启动的频率比平时高。通常由供应商决定。
otNeighborTableCallback
void(* otNeighborTableCallback)(otNeighborTableEvent aEvent, const otNeighborTableEntryInfo *aEntryInfo)
系统会调用指针来通知邻表发生了更改。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
函数
otThread 成为领先变体
otError otThreadBecomeLeader( otInstance *aInstance )
成为领先变体并启动新的分区。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThread 成为 Router
otError otThreadBecomeRouter( otInstance *aInstance )
尝试成为路由器。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetChildInfoById
otError otThreadGetChildInfoById( otInstance *aInstance, uint16_t aChildId, otChildInfo *aChildInfo )
根据所关联子项的子 ID 或 RLOC16 获取诊断信息。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otThreadGetChildInfoByIndex
otError otThreadGetChildInfoByIndex( otInstance *aInstance, uint16_t aChildIndex, otChildInfo *aChildInfo )
函数通过内部表索引保留附加的子元素的诊断信息。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otGetMaxAllowedChildren
otThreadGetChildNextIp6Address
otError otThreadGetChildNextIp6Address( otInstance *aInstance, uint16_t aChildIndex, otChildIp6AddressIterator *aIterator, otIp6Address *aAddress )
获取给定子项的下一个 IPv6 地址(使用迭代器)。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
返回值 |
|
otThreadGetChildInfoByIndex
otThreadGetChildRouterLinks
uint8_t otThreadGetChildRouterLinks( otInstance *aInstance )
获取 REED 角色中使用的 MLE_CHILD_ROUTER_LINKS 参数。
此参数用于指定设备(作为 FED)将尝试建立连接的相邻路由器的最大数量。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
MLE_CHILD_ROUTER_LINKS 值。
|
otThreadSetChildRouterLinks
otThreadGetContextIdReuseDelay
uint32_t otThreadGetContextIdReuseDelay( otInstance *aInstance )
获取 Leader 角色中使用的 CONTEXT_ID_REUSE_DELAY 参数。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
CONTEXT_ID_REUSE_DELAY 值。
|
otThreadSetContextIdReuseDelay
otThreadGetDeviceProperties
const otDeviceProperties * otThreadGetDeviceProperties( otInstance *aInstance )
otThreadGetJoinerUdpPort
uint16_t otThreadGetJoinerUdpPort( otInstance *aInstance )
获取 Joiner UDP 端口。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
Joiner UDP 端口号。
|
otThreadSetJoinerUdpPort
otThreadGetLocalLeaderWeight
uint8_t otThreadGetLocalLeaderWeight( otInstance *aInstance )
获取以 Leader 角色运行时使用的 Thread Leader Weight。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
线程前导权重值。
|
otThreadSetLeaderWeight
otThreadSetDeviceProperties
otThreadGetMaxAllowedChildren
uint16_t otThreadGetMaxAllowedChildren( otInstance *aInstance )
获取当前允许的子项数上限。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
当前允许的子级数量上限。
|
otThreadSetMaxAllowedChildren
otThreadGetMaxChildIpAddress
uint8_t otThreadGetMaxChildIpAddresses( otInstance *aInstance )
获取每个 MTD 子级可在此设备上注册为父级的 IP 地址数量上限。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
每个 MTD 子节点可在这个设备上作为父节点注册的 IP 地址的数量上限。
|
otThreadSetMaxChildIpAddress
otThreadGetMaxRouterId
uint8_t otThreadGetMaxRouterId( otInstance *aInstance )
函数会返回允许的路由器 ID 数上限。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
允许的路由器 ID 上限。
|
otThreadGetNetworkIdTimeout
uint8_t otThreadGetNetworkIdTimeout( otInstance *aInstance )
获取路由器角色中使用的 NETWORK_ID_TIMEOUT 参数。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
NETWORK_ID_TIMEOUT 值。
|
otThreadSetNetworkIdTimeout
otThreadGetNextCacheEntry
otError otThreadGetNextCacheEntry( otInstance *aInstance, otCacheEntryInfo *aEntryInfo, otCacheEntryIterator *aIterator )
获取下一个 EID 缓存条目(使用迭代器)。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otThreadGetNextHopAndPathCost
void otThreadGetNextHopAndPathCost( otInstance *aInstance, uint16_t aDestRloc16, uint16_t *aNextHopRloc16, uint8_t *aPathCost )
获取指向指定 RLOC16 目的地的下一个跃点和路径费用。
可以与 aNextHopRloc16
或 aPathCost
为 NULL 时配合使用,表示调用方不想获取该值。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
otThreadGetParentPriority
int8_t otThreadGetParentPriority( otInstance *aInstance )
获取分配的父级优先级。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
为父级指定的优先级值“-2”表示未分配。
|
otThreadSetParentPriority
otThreadGetPreferredLeaderPartitionId
uint32_t otThreadGetPreferredLeaderPartitionId( otInstance *aInstance )
获取以 Leader 角色运行时使用的首选 Thread Leader Partition ID。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
Thread Leader Partition ID 值。
|
otThreadGetPskc
void otThreadGetPskc( otInstance *aInstance, otPskc *aPskc )
获取 PSKc。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadSetPskc
otThreadGetPskcRef
otPskcRef otThreadGetPskcRef( otInstance *aInstance )
获取对 Thread PSKc 存储的密钥引用。
需要启用构建时功能 OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
提及 PSKc 的重要参考
|
otThreadSetPskcRef
otThreadGetRouterDowngradeThreshold
uint8_t otThreadGetRouterDowngradeThreshold( otInstance *aInstance )
获取路由器角色中使用的 ROUTER_DOWNGrade_THRESHOLD 参数。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
ROUTER_DOWNGrade_THRESHOLD 值。
|
otThreadSetRouterDowngradeThreshold
otThreadGetRouterIdRange
void otThreadGetRouterIdRange( otInstance *aInstance, uint8_t *aMinRouterId, uint8_t *aMaxRouterId )
获取允许分配给线程网络中的节点的路由器 ID 范围。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
otThreadSetRouterIdRange
otThreadGetRouterIdSequence
uint8_t otThreadGetRouterIdSequence( otInstance *aInstance )
获取当前的路由器 ID 序列。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
路由器 ID 序列。
|
otThreadGetRouterInfo
otError otThreadGetRouterInfo( otInstance *aInstance, uint16_t aRouterId, otRouterInfo *aRouterInfo )
该函数会保留给定线程路由器的诊断信息。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otThreadGetRouterSelectionJitter
uint8_t otThreadGetRouterSelectionJitter( otInstance *aInstance )
获取 REED/Router 角色中使用的 ROUTER_SELECTION_JITTER 参数。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
ROUTER_SELECTION_JITTER 值。
|
otThreadSetRouterSelectionJitter
otThreadGetRouterUpgradeThreshold
uint8_t otThreadGetRouterUpgradeThreshold( otInstance *aInstance )
获取 REED 角色中使用的 ROUTER_UPGrade_THRESHOLD 参数。
详情 | |||
---|---|---|---|
参数 |
|
||
返回 |
ROUTER_UPGrade_THRESHOLD 值。
|
otThreadSetRouterUpgradeThreshold
otThreadIsRouter 符合条件
bool otThreadIsRouterEligible( otInstance *aInstance )
指明设备是否符合路由器条件。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadIsRouterIdAlassigned
bool otThreadIsRouterIdAllocated( otInstance *aInstance, uint8_t aRouterId )
指明当前是否分配了路由器 ID。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadRegisterNeighborTableCallback
void otThreadRegisterNeighborTableCallback( otInstance *aInstance, otNeighborTableCallback aCallback )
注册邻域表回调函数。
当邻居表发生更改(例如,添加/移除子项或路由器邻居项或更改现有子项的模式)时,系统会调用提供的回调(如果为非 NULL)。
对此方法的后续调用将覆盖之前的回调。请注意,在更新邻表/子表且始终在 otStateChangedCallback
之前调用此回调。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadReleaseRouterId
otError otThreadReleaseRouterId( otInstance *aInstance, uint8_t aRouterId )
释放设备在“主管”角色中分配的路由器 ID。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
返回值 |
|
otThreadSetCcmEnabled
void otThreadSetCcmEnabled( otInstance *aInstance, bool aEnabled )
设置设备是否通过使用 CCM 调试的。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadSetChildRouterLinks
otError otThreadSetChildRouterLinks( otInstance *aInstance, uint8_t aChildRouterLinks )
设置 REED 角色中使用的 MLE_CHILD_ROUTER_LINKS 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetChildRouterLinks
otThreadSetContextIdReuseDelay
void otThreadSetContextIdReuseDelay( otInstance *aInstance, uint32_t aDelay )
设置“Leader”角色中使用的 CONTEXT_ID_REUSE_DELAY 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetContextIdReuseDelay
otThreadSetDeviceProperties
void otThreadSetDeviceProperties( otInstance *aInstance, const otDeviceProperties *aDeviceProperties )
设置设备属性,然后这些属性将用来确定和设置前导权重。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadSetJoinerUdpPort
otError otThreadSetJoinerUdpPort( otInstance *aInstance, uint16_t aJoinerUdpPort )
设置 Joiner UDP 端口。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetJoinerUdpPort
otThreadSetLocalLeaderWeight
void otThreadSetLocalLeaderWeight( otInstance *aInstance, uint8_t aWeight )
设置以 Leader 角色运行时使用的 Thread Leader Weight。
直接将前导权重设置为新值,替换其前一个值(该值可能由当前的 otDeviceProperties
确定)。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetLeaderWeight
otThreadSetMaxAllowedChildren
otError otThreadSetMaxAllowedChildren( otInstance *aInstance, uint16_t aMaxChildren )
设置当前允许的子级数量上限。
只有在已停止 Thread 协议操作时才能设置此参数。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otThreadGetMaxAllowedChildren
otThreadSetMaxChildIpAddress
otError otThreadSetMaxChildIpAddresses( otInstance *aInstance, uint8_t aMaxIpAddresses )
设置或恢复每个 MTD 子设备可在此设备注册为父 IP 地址的 IP 地址数上限。
传递 0
可清除该设置并恢复默认设置。
启用 OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE
后可用。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetMaxChildIpAddress
otThreadSetNetworkIdTimeout
void otThreadSetNetworkIdTimeout( otInstance *aInstance, uint8_t aTimeout )
设置 Leader 角色中使用的 NETWORK_ID_TIMEOUT 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetNetworkIdTimeout
otThreadSetParentPriority
otError otThreadSetParentPriority( otInstance *aInstance, int8_t aParentPriority )
设置父级优先级。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetParentPriority
otThreadSetPreferredLeaderPartitionId
void otThreadSetPreferredLeaderPartitionId( otInstance *aInstance, uint32_t aPartitionId )
设置以 Leader 角色运行时使用的首选 Thread Leader Partition ID。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadSetPreferredRouterId
otError otThreadSetPreferredRouterId( otInstance *aInstance, uint8_t aRouterId )
设置首选路由器 ID。
成为路由器/领导者后,节点会尝试使用此路由器 ID。如果未设置首选路由器 ID 或无法使用首选路由器 ID,系统会选择随机生成的路由器 ID。只有在设备角色分离或停用时才能设置此属性。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadSetPskc
otError otThreadSetPskc( otInstance *aInstance, const otPskc *aPskc )
设置 Thread PSK。
仅在 Thread 协议停用时成功。成功调用此函数还会使非易失性内存中的活跃和待处理操作数据集无效。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetPskc
otThreadSetPskcRef
otError otThreadSetPskcRef( otInstance *aInstance, otPskcRef aKeyRef )
设置 Thread PSK。
需要启用构建时功能 OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE
。
仅在 Thread 协议停用时成功。成功调用此函数还会使非易失性内存中的活跃和待处理操作数据集无效。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadGetPskcRef
otThreadSetRouterDowngradeThreshold
void otThreadSetRouterDowngradeThreshold( otInstance *aInstance, uint8_t aThreshold )
设置 Leader 角色中使用的 ROUTER_DOWNGrade_THRESHOLD 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetRouterDowngradeThreshold
otThreadSetRoutereligible
otError otThreadSetRouterEligible( otInstance *aInstance, bool aEligible )
设置设备是否符合路由器条件。
如果 aEligible
为 false 且设备当前作为路由器运行,则此调用会导致设备分离并尝试重新连接为子级。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
otThreadSetRouterIdRange
otError otThreadSetRouterIdRange( otInstance *aInstance, uint8_t aMinRouterId, uint8_t aMaxRouterId )
设置允许分配给线程网络中的节点的路由器 ID 范围。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
otThreadGetRouterIdRange
otThreadSetRouterSelectionJitter
void otThreadSetRouterSelectionJitter( otInstance *aInstance, uint8_t aRouterJitter )
设置 REED/Router 角色中使用的 ROUTER_SELECTION_JITTER 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetRouterSelectionJitter
otThreadSetRouterUpgradeThreshold
void otThreadSetRouterUpgradeThreshold( otInstance *aInstance, uint8_t aThreshold )
设置“主要角色”角色中使用的 ROUTER_UPGrade_THRESHOLD 参数。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadGetRouterUpgradeThreshold
otThreadSetSteeringData
void otThreadSetSteeringData( otInstance *aInstance, const otExtAddress *aExtAddress )
将带外数据设置为带外数据。
应设置配置选项 OPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE
,以支持对带外数据的设置。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
otThreadSetThreadVersionCheckEnabled
void otThreadSetThreadVersionCheckEnabled( otInstance *aInstance, bool aEnabled )
设置是否已启用安全政策的 TLV 版本阈值(VR 字段)。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
宏
OT_CHILD_IP6_ADDRESS_ITERATOR_INIT
OT_CHILD_IP6_ADDRESS_ITERATOR_INIT 0
otChildIP6AddressIterator 的初始化程序。
资源
OpenThread API 参考主题源自源代码,可在 GitHub 上获取。 如需了解详情或为我们的文档贡献内容,请参阅资源。