Rtos API example
thread_management_api.h File Reference
Public API for managing Thread network configuration. More...
Go to the source code of this file.
Typedefs | |
typedef int( | management_set_response_cb )(int8_t interface_id, management_state_e status) |
Callback to display the result of management set command. | |
typedef int( | management_get_response_cb )(int8_t instance_id, management_state_e status, uint8_t *response_message_ptr, uint16_t response_message_len) |
Callback for reading Thread management information. | |
Enumerations | |
enum | management_state_e |
Thread management state. More... | |
Functions | |
int | thread_management_register (int8_t interface_id) |
Register Thread management interface. | |
int | thread_management_unregister (int8_t instance_id) |
Unregister Thread management interface. | |
int | thread_management_set_security_policy (int8_t instance_id, uint8_t options, uint16_t rotation_time, management_set_response_cb *cb_ptr) |
Set the Thread security policy. | |
int | thread_management_set_steering_data (int8_t instance_id, uint16_t session_id, uint8_t *steering_data_ptr, uint8_t steering_data_len, management_set_response_cb *cb_ptr) |
Set the steering data. | |
int | thread_management_set_commissioning_data_timestamp (int8_t instance_id, uint64_t time, management_set_response_cb *cb_ptr) |
Set the Thread commissioning data timestamp. | |
int | thread_management_get (int8_t instance_id, uint8_t dst_addr[static 16], char *uri_ptr, uint8_t *fields_ptr, uint8_t fields_count, management_get_response_cb *cb_ptr) |
Get Thread management fields. | |
int | thread_management_set (int8_t instance_id, uint8_t dst_addr[static 16], char *uri_ptr, uint8_t *data_ptr, uint8_t data_len, management_set_response_cb *cb_ptr) |
Set Thread management fields. |
Detailed Description
Public API for managing Thread network configuration.
This interface enables modification and reading the Thread network parameters.
Thread management can modify the following values in the Thread network: * [Network Name] (Read/write) * [Security Policy] (Read/write) * [Steering Data] (Read/write) * [Commissioning Data Timestamp] (Read/write) * [Commissioning Credential] PSKc (Write only) * [Network Master Key] (Read only when policy allows) * [Network Key Sequence] (Read only when policy allows) * [Network Mesh-Local ULA] (Read only) * [Border Router Locator] (Read only) * [Commissioner Session ID] (Read only) * [XPANID] (Read only) * [PANID] (Read only) * [Channel] (Read only)
Definition in file thread_management_api.h.
Typedef Documentation
typedef int( management_get_response_cb)(int8_t instance_id, management_state_e status, uint8_t *response_message_ptr, uint16_t response_message_len) |
Callback for reading Thread management information.
Result message containing the Thread management TLV message. This message can be parsed with thread_meshcop_lib.h.
- Parameters:
-
instance_id The ID of the management session. status Result of the request. response_message_ptr A meshcop TLV structure pointer containing the requested TLVs. response_message_len The length of the message.
- Returns:
- 0 Success.
- <0 Fail.
Definition at line 143 of file thread_management_api.h.
typedef int( management_set_response_cb)(int8_t interface_id, management_state_e status) |
Callback to display the result of management set command.
This callback is called when the server responds to the management set command. This can fail if the leader rejects the request or the request times out.
- Parameters:
-
interface_id The interface ID of the Thread network. status Result of the request.
Definition at line 81 of file thread_management_api.h.
Enumeration Type Documentation
enum management_state_e |
Thread management state.
Definition at line 50 of file thread_management_api.h.
Function Documentation
int thread_management_get | ( | int8_t | instance_id, |
uint8_t | dst_addr[static 16], | ||
char * | uri_ptr, | ||
uint8_t * | fields_ptr, | ||
uint8_t | fields_count, | ||
management_get_response_cb * | cb_ptr | ||
) |
Get Thread management fields.
Fetching Thread management field values from any device in the Thread network.
- Parameters:
-
instance_id Instance ID of the management session. dst_addr Destination address; the address of a remote device from whome it is desirable to fetch management information. If however, the address is not provided, a request is sent to the leader of the network for this purpose. If a native commissioner is used, the request for management information is sent to the border router. uri_ptr The ASCII string for the URI. This string identifies the CoAP URI for the desired resource. For example, /c/mg identifies the management get information resource. fields_ptr A pointer that points to an array of desirable MESHCOP TLVs. A list of such TLVs can be found in thread_meshcop_lib.h fields_count Number of fields in the field pointer array (set of TLVs). cb_ptr A callback function carrying the result of the operation.
- Returns:
- 0, Success.
- <0 Fail.
int thread_management_register | ( | int8_t | interface_id ) |
Register Thread management interface.
- Parameters:
-
interface_id Interface ID of the Thread network.
- Returns:
- A handle for the management interface.
int thread_management_set | ( | int8_t | instance_id, |
uint8_t | dst_addr[static 16], | ||
char * | uri_ptr, | ||
uint8_t * | data_ptr, | ||
uint8_t | data_len, | ||
management_set_response_cb * | cb_ptr | ||
) |
Set Thread management fields.
Set Thread management field values to a device in Thread network.
- Parameters:
-
instance_id Instance ID of the management session. dst_addr Destination address, the address of a remote device where it is desired to setup management information. If however, the address is not provided, a request is sent to leader of the network for this purpose. If a native commissioner is being used, the rquest for setting up management information is sent to the Border router. uri_ptr The ASCII string for the URI. This string identifies the CoAP URI for the desired resource, for example, /c/ms identifies the the management set information resource. data_ptr A pointer to the desired set of TLVs. data_len count of the members (no. of TLVs) in the TLV set. cb_ptr A callback function carrying the result of the operation.
- Returns:
- 0, Success
- <0 Fail.
int thread_management_set_commissioning_data_timestamp | ( | int8_t | instance_id, |
uint64_t | time, | ||
management_set_response_cb * | cb_ptr | ||
) |
Set the Thread commissioning data timestamp.
- Parameters:
-
instance_id The ID of the management session. time Upper 48 bits is the timestamp in seconds since the start of unix time, lower 16 bits are fractional portion of time. If the last bit is set to 1, the commissioner has accurate time. cb_ptr A callback function indicating the result of the operation. Can be NULL if no result code needed.
- Returns:
- 0 Success.
- <0 Fail.
int thread_management_set_security_policy | ( | int8_t | instance_id, |
uint8_t | options, | ||
uint16_t | rotation_time, | ||
management_set_response_cb * | cb_ptr | ||
) |
Set the Thread security policy.
- Parameters:
-
instance_id The ID of the management session. options Security policy options: bit 8 Out-of-band commissioning restricted. bit 7 Native commissioner restricted. rotation_time Thread key rotation time in hours. cb_ptr A callback function indicating the result of the operation. Can be NULL if no result code needed.
- Returns:
- 0 Success.
- <0 Fail.
int thread_management_set_steering_data | ( | int8_t | instance_id, |
uint16_t | session_id, | ||
uint8_t * | steering_data_ptr, | ||
uint8_t | steering_data_len, | ||
management_set_response_cb * | cb_ptr | ||
) |
Set the steering data.
Steering data can be either:
- Empty to decline joining.
- Any length with all bits set to 0 to decline joining.
- Any length with all bits 1 to allow anyone to join.
- Bloom filter to guide which device can join.
If a Bloom filter is present it can be any length between 1-16 bytes. The first bit of the Bloom filter indicates whether to use 0 == EUI-64 or 1 == bottom 24 bits of EUI-64.
- Parameters:
-
instance_id The ID of the management session. session_id The commissioning session ID that needs to be added. steering_data_ptr A pointer to new steering data. steering_data_len The length of the new steering data. cb_ptr A callback function indicating the result of the operation. Can be NULL if no result code needed.
- Returns:
- 0 Success.
- <0 Fail.
int thread_management_unregister | ( | int8_t | instance_id ) |
Unregister Thread management interface.
- Parameters:
-
instance_id ID of the management session.
Generated on Sun Jul 17 2022 08:25:36 by 1.7.2