Rtos API example

Embed: (wiki syntax)

« Back to documentation index

thread_management_if.h File Reference

thread_management_if.h File Reference

Thread management interface. More...

Go to the source code of this file.

Data Structures

struct  link_configuration
 Thread network configuration. More...

Typedefs

typedef struct link_configuration link_configuration_s
 Thread network configuration.

Enumerations

enum  thread_device_type_e
 

Thread device type.

More...

Functions

int thread_management_node_init (int8_t interface_id, channel_list_s *channel_list, device_configuration_s *device_configuration, link_configuration_s *static_configuration)
 Initialize Thread stack to node mode.
int thread_management_device_type_set (int8_t interface_id, thread_device_type_e device_type)
 Change thread device type.
link_configuration_sthread_management_configuration_get (int8_t interface_id)
 Get Thread network settings.
int thread_management_link_configuration_store (int8_t interface_id, link_configuration_s *link_config)
 Store Thread network link configuration settings to NVM.
int thread_management_link_configuration_delete (int8_t interface_id)
 Delete Thread network link configuration settings.
device_configuration_s * thread_management_device_configuration_get (int8_t interface_id)
 Get Thread device settings.
int thread_management_max_child_count (int8_t interface_id, uint8_t maxChildCount)
 Thread router max child count set.
int8_t thread_management_set_link_timeout (int8_t interface_id, uint32_t link_timeout)
 Set Thread device link timeout.
int8_t thread_management_get_link_timeout (int8_t interface_id, uint32_t *link_timeout)
 Get link timeout from Thread device.
int8_t thread_management_set_request_full_nwk_data (int8_t interface_id, bool full_nwk_data)
 Set Thread request full network data.
int8_t thread_management_get_request_full_nwk_data (int8_t interface_id, bool *full_nwk_data)
 Get Thread request full network data.
int thread_management_get_leader_address (int8_t interface_id, uint8_t *address_ptr)
 Additional Thread device settings.
int thread_management_get_leader_aloc (int8_t interface_id, uint8_t *address_ptr)
 Get leader anycast address.
int thread_management_get_parent_address (int8_t interface_id, uint8_t *address_ptr)
 Get parent link local 16 address.
int thread_management_get_ml64_address (int8_t interface_id, uint8_t *address_ptr)
 Get own mesh local 64 address.
int thread_management_get_ml16_address (int8_t interface_id, uint8_t *address_ptr)
 Get own mesh local 16 address.
int thread_management_get_commissioner_address (int8_t interface_id, uint8_t *address_ptr, uint16_t *port_ptr)
 Get commissioner address.

Detailed Description

Thread management interface.

This interface is used for configuring Thread devices. After creating the Thread interface, you can use this interface to configure the Thread device behaviour. When you are done with the configurations, you need to call interface up to enable a Thread node.

Definition in file thread_management_if.h.


Typedef Documentation

Thread network configuration.

You can use this structure in start-up in case of a static configuration. This data can also be read after joining the Thread network. If this data is not provided to the stack, the device starts the commissioning process to join the Thread network.

If the data is provided, all fields must be initialised to 0.

If XPANID and MASTER KEY are provided, the device starts out-of-band commissioning. The values must be initialised to other than 0. If mesh_local_eid is initialised to 0 it is randomized at start-up. If extended_random_mac is initialised to 0 it is randomized at start-up.

If timestamp values are set to 0 it triggers a network configuration update when joining the network.


Enumeration Type Documentation

Thread device type.

REED - Router enabled End device. Device can become router or end device depending on network conditions. FED - Full End Device. Device creates links and makes address queries but does not become router. MED - Minimal End Device. Device communicates through parent. With radio on SED - Sleepy End Device. Device communicates through parent. Uses data poll to sleep.

Definition at line 137 of file thread_management_if.h.


Function Documentation

link_configuration_s* thread_management_configuration_get ( int8_t  interface_id )

Get Thread network settings.

Configuration is a pointer to the static configuration and only valid in current context.

Parameters:
interface_idNetwork interface ID.
Returns:
Pointer to link configuration.
NULL Failure.
device_configuration_s* thread_management_device_configuration_get ( int8_t  interface_id )

Get Thread device settings.

Configuration is a pointer to the static device configuration and only valid in current context.

Parameters:
interface_idNetwork interface ID.
Returns:
Pointer to Device configuration.
NULL Failure.
int thread_management_device_type_set ( int8_t  interface_id,
thread_device_type_e  device_type 
)

Change thread device type.

This function modifies the thread device mode. Default values are given in function arm_nwk_interface_configure_6lowpan_bootstrap_set().

If this function is called when interface is up re-attach is made.

Parameters:
interface_idNetwork interface ID.
device_typeDevice type of current bootstrap.
Returns:
0, Set OK.
<0 Set fail.
int thread_management_get_commissioner_address ( int8_t  interface_id,
uint8_t *  address_ptr,
uint16_t *  port_ptr 
)

Get commissioner address.

This function returns the commissioner address where you can continue provisioning traffic. If the commissioner is not present this function returns a failure.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
port_ptrA pointer to the location of port after copying.
Returns:
0, Read OK.
<0 Read fail.
int thread_management_get_leader_address ( int8_t  interface_id,
uint8_t *  address_ptr 
)

Additional Thread device settings.

Changing these can cause non-compliance with Thread. Diagnostics functions. Get leader mesh local 16 address.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
Returns:
0, Read OK.
<0 Read fail.
int thread_management_get_leader_aloc ( int8_t  interface_id,
uint8_t *  address_ptr 
)

Get leader anycast address.

Address should be used when contacting Leader without need to know the actual routing details. This address will remain valid even after leader changes.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
Returns:
0, Read OK.
<0 Read fail. Not connected to Thread network.
int8_t thread_management_get_link_timeout ( int8_t  interface_id,
uint32_t *  link_timeout 
)

Get link timeout from Thread device.

Parameters:
interface_idNetwork interface ID.
link_timeout[out] A pointer to the location for writing the timeout.
Returns:
0, Get OK
<0 Get Fail
int thread_management_get_ml16_address ( int8_t  interface_id,
uint8_t *  address_ptr 
)

Get own mesh local 16 address.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
Returns:
0, Read OK.
<0 Read fail.
int thread_management_get_ml64_address ( int8_t  interface_id,
uint8_t *  address_ptr 
)

Get own mesh local 64 address.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
Returns:
0, Read OK.
<0 Read fail.
int thread_management_get_parent_address ( int8_t  interface_id,
uint8_t *  address_ptr 
)

Get parent link local 16 address.

Parameters:
interface_idNetwork interface ID.
address_ptrA pointer to the location of address after copying.
Returns:
0, Read OK.
<0 Read fail.
int8_t thread_management_get_request_full_nwk_data ( int8_t  interface_id,
bool *  full_nwk_data 
)

Get Thread request full network data.

Parameters:
interface_idNetwork interface ID.
link_timeout[out] A pointer to the location for writing the flag value.
full_nwk_dataRequest full network data
Returns:
0, Get OK.
<0 Get Fail.
int thread_management_link_configuration_delete ( int8_t  interface_id )

Delete Thread network link configuration settings.

Deletion is asynchronous operation and this method makes a request to delete link configuration settings. Operation will be completed in the background. Once settings has been deleted the Thread network will be restarted with default settings.

/param interface Id of network interface. -1 can be used if interface_id is not available.

/return 0 if delete request has been delivered successfully to lower layer. /return -1 if delete failed (request not delivered to lower layer) /return -2 if delete request delivered to lower layer but given interface_id was not valid.

int thread_management_link_configuration_store ( int8_t  interface_id,
link_configuration_s link_config 
)

Store Thread network link configuration settings to NVM.

Storing is asynchronous operation and this method makes a request to store link configuration settings. Operation will be completed in the background. Once settings has been stored the Thread network will be restarted with new configuration settings.

/param interface Id of network interface. -1 if interface_id is not available. /param link_config Pointer to a structure containing link configuration parameters

/return 0 if store request has been delivered successfully to lower layer. /return -1 if storing failed (request not delivered to lower layer) /return -2 if store request delivered to lower layer but given interface_id was not valid.

int thread_management_max_child_count ( int8_t  interface_id,
uint8_t  maxChildCount 
)

Thread router max child count set.

This function is used to limit the number of children allowed for parent.

Parameters:
interface_idNetwork interface ID.
maxChildCountMin accepted value is 0 and max 32.
Returns:
0, Set OK.
<0 Set Fail.
int thread_management_node_init ( int8_t  interface_id,
channel_list_s channel_list,
device_configuration_s *  device_configuration,
link_configuration_s static_configuration 
)

Initialize Thread stack to node mode.

If static configuration is given and new one is updated by commissioner it will override current setup. it is safe to always give this as default configuration.

Parameters:
interface_idNetwork interface ID.
channel_listA pointer to channel list. Can be NULL if all channels accepted.
device_configurationA pointer to device configuration.
static_configurationA pointer to static configuration. Can be NULL.
Returns:
0, Init OK.
<0 Init fail.
int8_t thread_management_set_link_timeout ( int8_t  interface_id,
uint32_t  link_timeout 
)

Set Thread device link timeout.

Parameters:
interface_idNetwork interface ID.
link_timeoutNew timeout value in seconds.
Returns:
0, Set OK.
<0 Set Fail.
int8_t thread_management_set_request_full_nwk_data ( int8_t  interface_id,
bool  full_nwk_data 
)

Set Thread request full network data.

Parameters:
interface_idNetwork interface ID.
full_nwk_dataWhether or not to request full network data.
Returns:
0, Set OK.
<0 Set Fail.