Rtos API example

Embed: (wiki syntax)

« Back to documentation index

net_load_balance_api.h File Reference

net_load_balance_api.h File Reference

6LoWPAN network load balance control API. More...

Go to the source code of this file.

Typedefs

typedef bool net_load_balance_network_switch_notify (void)
 load_balance_network_switch_notify This function is called by the load balancer when it has detected a better network to switch to.

Functions

int8_t net_load_balance_network_switch_cb_set (int8_t interface_id, net_load_balance_network_switch_notify *network_switch_notify)
 Set user callback for accepting the network switch.
int8_t net_load_balance_create (int8_t interface_id, bool enable_periodic_beacon_interval)
 Create and enable load balance to the selected interface.
int8_t net_load_balance_delete (int8_t interface_id)
 Disable and delete load balancing from the interface.
int8_t net_load_balance_threshold_set (int8_t interface_id, uint8_t threshold_min, uint8_t threshold_max)
 Set load balance threshold min and max.
int8_t net_load_balance_set_max_probability (int8_t interface_id, uint8_t max_p)
 Set the network probability percent when the new network is better than threshold max.
int8_t net_load_balance_load_level_update_enable (int8_t interface_id, uint16_t expected_device_count)
 Set load balance expected device count and enable automatic network load level update.
int8_t net_load_balance_load_level_update_disable (int8_t interface_id)
 Disable the automatic network load level update.

Detailed Description

6LoWPAN network load balance control API.

Definition in file net_load_balance_api.h.


Typedef Documentation

load_balance_network_switch_notify This function is called by the load balancer when it has detected a better network to switch to.

Returns:
true The network can be switched immediately.
false The load balancer will ask later a time for network switching if a better network is still available at that time.

Definition at line 31 of file net_load_balance_api.h.


Function Documentation

int8_t net_load_balance_create ( int8_t  interface_id,
bool  enable_periodic_beacon_interval 
)

Create and enable load balance to the selected interface.

Parameters:
interface_idInterface ID.
enable_periodic_beacon_intervalSet True when you want to activate load balance periodic beacon; false will work only properly with the FHSS system.
Returns:
0 Enable OK.
-1 unknown Interface or parameter error.
-2 Out of memory.
-3 Load balance already configured to this interface.
int8_t net_load_balance_delete ( int8_t  interface_id )

Disable and delete load balancing from the interface.

Parameters:
interface_idInterface ID.
Returns:
0 Process OK.
-1 Unknown interface.
int8_t net_load_balance_load_level_update_disable ( int8_t  interface_id )

Disable the automatic network load level update.

Parameters:
interface_idInterface ID.
Returns:
0 Process OK, -1 Unknown interface ID.
int8_t net_load_balance_load_level_update_enable ( int8_t  interface_id,
uint16_t  expected_device_count 
)

Set load balance expected device count and enable automatic network load level update.

This feature is just for RPL DoDAG root device!

Parameters:
interface_idInterface ID.
expected_device_countDevice count that sets the max load level.

  • If the count is not divisible by 8, the function rounds the number up to reach that.
  • It is not hard limit it define max DoDAG preference.
  • For hard limit, check whiteboard_api.h.
Returns:
0 Process OK, -1 Unknown interface ID, -2 Out of memory.
int8_t net_load_balance_network_switch_cb_set ( int8_t  interface_id,
net_load_balance_network_switch_notify network_switch_notify 
)

Set user callback for accepting the network switch.

Parameters:
interface_idInterface ID.
network_switch_notifyUser callback.
Returns:
0 Set OK.
-1 unknown Interface.
int8_t net_load_balance_set_max_probability ( int8_t  interface_id,
uint8_t  max_p 
)

Set the network probability percent when the new network is better than threshold max.

Parameters:
interface_idInterface ID.
max_pProbability percent to switch the network. Default is 25%. Accepted values are [1,100], recommend values are 10-25.
Returns:
0 Process OK, -1 Unknown interface ID or parameter fail.
int8_t net_load_balance_threshold_set ( int8_t  interface_id,
uint8_t  threshold_min,
uint8_t  threshold_max 
)

Set load balance threshold min and max.

Network switch: diff_priority >= randLIB_get_random_in_range(threshold_min, threshold_max) --> switch network if true. For border router: Disable network compare by setting threshold_min and threshold_max to 0.

Parameters:
interface_idInterface ID.
threshold_minMin value defines a random minimum value for compare (must be bigger than 0).
threshold_maxMax value defines a random maximum value for compare (must be bigger than 0).
Returns:
0 Process OK, -1 Unknown interface ID.