Rtos API example

Embed: (wiki syntax)

« Back to documentation index

net_polling_api.h File Reference

net_polling_api.h File Reference

ZigBeeIP Sleepy Host Data Poll API. More...

Go to the source code of this file.

Enumerations

enum  net_host_mode { NET_HOST_FAST_POLL_MODE, NET_HOST_SLOW_POLL_MODE, NET_HOST_RX_ON_IDLE, NET_HOST_MODE_NOT_ACTIVE }

Functions

int8_t arm_nwk_host_mode_set (int8_t interface_id, net_host_mode_t mode, uint32_t poll_time)
 Set new host state.
int8_t arm_nwk_host_mode_get (int8_t interface_id, net_host_mode_t *mode)
 Read current host state.
void arm_net_host_enter_sleep_state_set (int8_t interface_id, uint8_t state)
 Host sleep state control.

Detailed Description

ZigBeeIP Sleepy Host Data Poll API.

The sleepy host default state is NET_HOST_FAST_POLL_MODE after bootstrap. The stack always disables radio automatically between data polls. The stack can also enable deep sleep when application net_host_enter_sleep_state_set().

A sleepy host can change the host state to normal, which saves time and resources when the client is waiting for a large amount of data.

  • nwk_host_mode_set(NET_HOST_RX_ON_IDLE,0) A function call to trigger MLE handshake update automatically. From NET_HOST_RX_ON_IDLE state back to polling state causes an MLE handshake with parent:
  • nwk_host_mode_set (NET_HOST_FAST_POLL_MODE,0), Enter fast mode.
  • nwk_host_mode_set (NET_HOST_SLOW_POLL_MODE,10), Enter slow poll mode by 10 seconds max data poll period.

The stack will tell max sleepy time to the application by selecting min values from the following cases:

  • Next active system timer trigger
  • ND protocol next state trigger
  • MLE handshake trigger
  • PANA key pull trigger
  • Next data poll period

Definition in file net_polling_api.h.


Enumeration Type Documentation

Enumerator:
NET_HOST_FAST_POLL_MODE 

Sleepy host fast poll state, max poll period 400ms.

NET_HOST_SLOW_POLL_MODE 

Sleepy host slow poll state, user-defined max period in seconds.

NET_HOST_RX_ON_IDLE 

Disable polling and enable direct data flow from parent to host.

NET_HOST_MODE_NOT_ACTIVE 

Host mode is not active.

Definition at line 55 of file net_polling_api.h.


Function Documentation

void arm_net_host_enter_sleep_state_set ( int8_t  interface_id,
uint8_t  state 
)

Host sleep state control.

Parameters:
interface_idNetwork interface ID.
state>0 enables power saving between data polling. Otherwise, only radio is disabled.

When the application wants to save more power it can call net_host_enter_sleep_state_set(nwk_interface_id, 1). When the application wants to disable sleep it just calls net_host_enter_sleep_state_set(nwk_interface_id, 0).

int8_t arm_nwk_host_mode_get ( int8_t  interface_id,
net_host_mode_t *  mode 
)

Read current host state.

Parameters:
interface_idNetwork interface ID.
modeA pointer to the location for saving the host state.
Returns:
0, State read update OK.
-1, The host role is router or the stack is idle.
int8_t arm_nwk_host_mode_set ( int8_t  interface_id,
net_host_mode_t  mode,
uint32_t  poll_time 
)

Set new host state.

Parameters:
interface_idNetwork interface ID.
modeNew host state.
poll_timePoll time in seconds, only handled when NET_HOST_SLOW_POLL_MODE is enabled.

Valid poll time for NET_HOST_SLOW_POLL_MODE is 0 < poll_time poll_time < 864001 (1 Day)

Returns:
0, State update OK.
-1, Unknown state.
-2, Invalid time.
-3 MLE handshake trigger failure.