Border Agent

This module includes functions for the Thread Border Agent role.

Summary

Enumerations

otBorderAgentState{
  OT_BORDER_AGENT_STATE_STOPPED = 0,
  OT_BORDER_AGENT_STATE_STARTED = 1,
  OT_BORDER_AGENT_STATE_ACTIVE = 2
}
enum
Defines the Border Agent state.

Typedefs

otBorderAgentId typedef
Represents a Border Agent ID.
otBorderAgentState typedef
Defines the Border Agent state.

Variables

OT_TOOL_PACKED_END

Functions

otBorderAgentGetId(otInstance *aInstance, otBorderAgentId *aId)
Gets the randomly generated Border Agent ID.
otBorderAgentGetState(otInstance *aInstance)
Gets the otBorderAgentState of the Thread Border Agent role.
otBorderAgentGetUdpPort(otInstance *aInstance)
uint16_t
Gets the UDP port of the Thread Border Agent service.
otBorderAgentSetId(otInstance *aInstance, const otBorderAgentId *aId)
Sets the Border Agent ID.

Macros

OT_BORDER_AGENT_ID_LENGTH (16)
The length of Border Agent/Router ID in bytes.

Structs

otBorderAgentId

Represents a Border Agent ID.

Enumerations

otBorderAgentState

 otBorderAgentState

Defines the Border Agent state.

Properties
OT_BORDER_AGENT_STATE_ACTIVE

Border agent is connected with external commissioner.

OT_BORDER_AGENT_STATE_STARTED

Border agent is started.

OT_BORDER_AGENT_STATE_STOPPED

Border agent role is disabled.

Typedefs

otBorderAgentId

struct otBorderAgentId otBorderAgentId

Represents a Border Agent ID.

otBorderAgentState

enum otBorderAgentState otBorderAgentState

Defines the Border Agent state.

Variables

OT_TOOL_PACKED_END

OT_TOOL_PACKED_BEGIN struct otBorderAgentId OT_TOOL_PACKED_END

Functions

otBorderAgentGetId

otError otBorderAgentGetId(
  otInstance *aInstance,
  otBorderAgentId *aId
)

Gets the randomly generated Border Agent ID.

The ID is saved in persistent storage and survives reboots. The typical use case of the ID is to be published in the MeshCoP mDNS service as the id TXT value for the client to identify this Border Router/Agent device.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aId
A pointer to buffer to receive the ID.
Return Values
OT_ERROR_NONE
If successfully retrieved the Border Agent ID.
...
If failed to retrieve the Border Agent ID.
See also:
otBorderAgentSetId

otBorderAgentGetState

otBorderAgentState otBorderAgentGetState(
  otInstance *aInstance
)

Gets the otBorderAgentState of the Thread Border Agent role.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
The current otBorderAgentState of the Border Agent.

otBorderAgentGetUdpPort

uint16_t otBorderAgentGetUdpPort(
  otInstance *aInstance
)

Gets the UDP port of the Thread Border Agent service.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
Returns
UDP port of the Border Agent.

otBorderAgentSetId

otError otBorderAgentSetId(
  otInstance *aInstance,
  const otBorderAgentId *aId
)

Sets the Border Agent ID.

The Border Agent ID will be saved in persistent storage and survive reboots. It's required to set the ID only once after factory reset. If the ID has never been set by calling this function, a random ID will be generated and returned when otBorderAgentGetId is called.

Details
Parameters
[in] aInstance
A pointer to an OpenThread instance.
[out] aId
A pointer to the Border Agent ID.
Return Values
OT_ERROR_NONE
If successfully set the Border Agent ID.
...
If failed to set the Border Agent ID.
See also:
otBorderAgentGetId

Macros

OT_BORDER_AGENT_ID_LENGTH

 OT_BORDER_AGENT_ID_LENGTH (16)

The length of Border Agent/Router ID in bytes.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.