Sleep Control#

API for the Sleep Control functionality in the Application Framework.

Sleep Control description.

API#

EmberStatus
sl_zigbee_zcl_schedule_tick_extended(uint8_t endpoint, EmberAfClusterId clusterId, bool isClient, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster-related event inside the application framework's event mechanism. This function provides a wrapper for the Ember stack event mechanism which allows the cluster code to access its events by their endpoint, cluster ID, and client/server identity. The passed poll and sleep controls allow the cluster to indicate whether it needs to long or short poll and whether it needs to stay awake or if it can sleep.

EmberStatus
sl_zigbee_zcl_schedule_cluster_tick(uint8_t endpoint, EmberAfClusterId clusterId, bool isClient, uint32_t delayMs, EmberAfEventSleepControl sleepControl)

Schedule a cluster-related event inside the application framework's event mechanism. This function is a wrapper for ::emberAfScheduleTickExtended. The cluster on the given endpoint will be set to long poll if sleepControl is set to EMBER_AF_OK_TO_HIBERNATE or will be set to short poll otherwise. It will stay awake if sleepControl is EMBER_AF_STAY_AWAKE and will sleep otherwise.

EmberStatus
sl_zigbee_zcl_schedule_client_tick_extended(uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster client event. This function is a wrapper for sl_zigbee_zcl_schedule_tick_extended.

EmberStatus
sl_zigbee_zcl_schedule_client_tick(uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs)

Schedule a cluster client event. This function is a wrapper for sl_zigbee_zcl_schedule_client_tick_extended. It indicates that the cluster client on the given endpoint can long poll and can sleep.

EmberStatus
sl_zigbee_zcl_schedule_server_tick_extended(uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster server event. This function is a wrapper for sl_zigbee_zcl_schedule_tick_extended.

EmberStatus
sl_zigbee_zcl_schedule_server_tick(uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs)

Schedule a cluster server event. This function is a wrapper for sl_zigbee_zcl_schedule_server_tick_extended. It indicates that the cluster server on the given endpoint can long poll and can sleep.

EmberStatus
sl_zigbee_zcl_deactivate_cluster_tick(uint8_t endpoint, EmberAfClusterId clusterId, bool isClient)

Deactivate a cluster-related event. This function provides a wrapper for the Ember stack's event mechanism, which allows an event to be accessed by its endpoint, cluster ID, and client/server identity.

EmberStatus
sl_zigbee_zcl_deactivate_client_tick(uint8_t endpoint, EmberAfClusterId clusterId)

Deactivate a cluster client event. This function is a wrapper for sl_zigbee_zcl_deactivate_cluster_tick.

EmberStatus
sl_zigbee_zcl_deactivate_server_tick(uint8_t endpoint, EmberAfClusterId clusterId)

Deactivate a cluster server event. This function is a wrapper for sl_zigbee_zcl_deactivate_cluster_tick.

#define

Friendly define for use in the scheduling or canceling client events with sl_zigbee_zcl_schedule_cluster_tick() and sl_zigbee_zcl_deactivate_cluster_tick().

#define

Friendly define for use in the scheduling or canceling server events with sl_zigbee_zcl_schedule_cluster_tick() and sl_zigbee_zcl_deactivate_cluster_tick().

#define

Retrieve the most restrictive sleep control value for all scheduled events. This function is used by emberAfOkToNap and emberAfOkToHibernate to makes sure that there are no events scheduled, which will keep the device from hibernating or napping.

#define

Set the default sleep control value against which all scheduled event sleep control values will be evaluated. This can be used to keep a device awake for an extended period of time by setting the default to EMBER_AF_STAY_AWAKE and then resetting the value to EMBER_AF_OK_TO_HIBERNATE once the wake period is complete.

#define

Retrieve the default sleep control against which all event sleep control values are evaluated. The default sleep control value is initialized to EMBER_AF_OK_TO_HIBERNATE but can be changed by the application at any time using the emberAfSetDefaultSleepControl() function.

API Documentation#

sl_zigbee_zcl_schedule_tick_extended#

EmberStatus sl_zigbee_zcl_schedule_tick_extended (uint8_t endpoint, EmberAfClusterId clusterId, bool isClient, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster-related event inside the application framework's event mechanism. This function provides a wrapper for the Ember stack event mechanism which allows the cluster code to access its events by their endpoint, cluster ID, and client/server identity. The passed poll and sleep controls allow the cluster to indicate whether it needs to long or short poll and whether it needs to stay awake or if it can sleep.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled.

N/AclusterId

The cluster id of the event to be scheduled.

N/AisClient

EMBER_AF_CLIENT_CLUSTER_TICK if the event to be scheduled is associated with a client cluster or EMBER_AF_SERVER_CLUSTER_TICK otherwise.

N/AdelayMs

The number of milliseconds until the event should be called.

N/ApollControl

EMBER_AF_SHORT_POLL if the cluster needs to short poll or EMBER_AF_LONG_POLL otherwise.

N/AsleepControl

EMBER_AF_STAY_AWAKE if the cluster needs to stay awake or EMBER_AF_OK_TO_SLEEP otherwise.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1185 of file app/framework/include/af.h

sl_zigbee_zcl_schedule_cluster_tick#

EmberStatus sl_zigbee_zcl_schedule_cluster_tick (uint8_t endpoint, EmberAfClusterId clusterId, bool isClient, uint32_t delayMs, EmberAfEventSleepControl sleepControl)

Schedule a cluster-related event inside the application framework's event mechanism. This function is a wrapper for ::emberAfScheduleTickExtended. The cluster on the given endpoint will be set to long poll if sleepControl is set to EMBER_AF_OK_TO_HIBERNATE or will be set to short poll otherwise. It will stay awake if sleepControl is EMBER_AF_STAY_AWAKE and will sleep otherwise.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled.

N/AclusterId

The cluster id of the event to be scheduled.

N/AisClient

EMBER_AF_CLIENT_CLUSTER_TICK if the event to be scheduled is associated with a client cluster or EMBER_AF_SERVER_CLUSTER_TICK otherwise.

N/AdelayMs

The number of milliseconds until the event should be called.

N/AsleepControl

the priority of the event, what the processor should be allowed to do in terms of sleeping while the event is active.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1212 of file app/framework/include/af.h

sl_zigbee_zcl_schedule_client_tick_extended#

EmberStatus sl_zigbee_zcl_schedule_client_tick_extended (uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster client event. This function is a wrapper for sl_zigbee_zcl_schedule_tick_extended.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled

N/AclusterId

The cluster id of the event to be scheduled

N/AdelayMs

The number of milliseconds until the event should be called.

N/ApollControl

EMBER_AF_SHORT_POLL if the cluster needs to short poll or EMBER_AF_LONG_POLL otherwise.

N/AsleepControl

EMBER_AF_STAY_AWAKE if the cluster needs to stay awake or EMBER_AF_OK_TO_SLEEP otherwise.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1232 of file app/framework/include/af.h

sl_zigbee_zcl_schedule_client_tick#

EmberStatus sl_zigbee_zcl_schedule_client_tick (uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs)

Schedule a cluster client event. This function is a wrapper for sl_zigbee_zcl_schedule_client_tick_extended. It indicates that the cluster client on the given endpoint can long poll and can sleep.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled.

N/AclusterId

The cluster id of the event to be scheduled.

N/AdelayMs

The number of milliseconds until the event should be called.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1249 of file app/framework/include/af.h

sl_zigbee_zcl_schedule_server_tick_extended#

EmberStatus sl_zigbee_zcl_schedule_server_tick_extended (uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs, EmberAfEventPollControl pollControl, EmberAfEventSleepControl sleepControl)

Schedule a cluster server event. This function is a wrapper for sl_zigbee_zcl_schedule_tick_extended.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled.

N/AclusterId

The cluster id of the event to be scheduled.

N/AdelayMs

The number of milliseconds until the event should be called.

N/ApollControl

EMBER_AF_SHORT_POLL if the cluster needs to short poll or EMBER_AF_LONG_POLL otherwise.

N/AsleepControl

EMBER_AF_STAY_AWAKE if the cluster needs to stay awake or EMBER_AF_OK_TO_SLEEP otherwise.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1267 of file app/framework/include/af.h

sl_zigbee_zcl_schedule_server_tick#

EmberStatus sl_zigbee_zcl_schedule_server_tick (uint8_t endpoint, EmberAfClusterId clusterId, uint32_t delayMs)

Schedule a cluster server event. This function is a wrapper for sl_zigbee_zcl_schedule_server_tick_extended. It indicates that the cluster server on the given endpoint can long poll and can sleep.

Parameters
N/Aendpoint

The endpoint of the event to be scheduled

N/AclusterId

The cluster id of the event to be scheduled.

N/AdelayMs

The number of milliseconds until the event should be called.

Returns

  • EMBER_SUCCESS if the event was scheduled or an error otherwise.


Definition at line 1284 of file app/framework/include/af.h

sl_zigbee_zcl_deactivate_cluster_tick#

EmberStatus sl_zigbee_zcl_deactivate_cluster_tick (uint8_t endpoint, EmberAfClusterId clusterId, bool isClient)

Deactivate a cluster-related event. This function provides a wrapper for the Ember stack's event mechanism, which allows an event to be accessed by its endpoint, cluster ID, and client/server identity.

Parameters
N/Aendpoint

The endpoint of the event to be deactivated.

N/AclusterId

The cluster id of the event to be deactivated.

N/AisClient

EMBER_AF_CLIENT_CLUSTER_TICK if the event to be deactivated is a client cluster EMBER_AF_SERVER_CLUSTER_TICK otherwise.

Returns

  • EMBER_SUCCESS if the event was deactivated or an error otherwise.


Definition at line 1302 of file app/framework/include/af.h

sl_zigbee_zcl_deactivate_client_tick#

EmberStatus sl_zigbee_zcl_deactivate_client_tick (uint8_t endpoint, EmberAfClusterId clusterId)

Deactivate a cluster client event. This function is a wrapper for sl_zigbee_zcl_deactivate_cluster_tick.

Parameters
N/Aendpoint

The endpoint of the event to be deactivated.

N/AclusterId

The cluster id of the event to be deactivated.

Returns

  • EMBER_SUCCESS if the event was deactivated or an error otherwise.


Definition at line 1315 of file app/framework/include/af.h

sl_zigbee_zcl_deactivate_server_tick#

EmberStatus sl_zigbee_zcl_deactivate_server_tick (uint8_t endpoint, EmberAfClusterId clusterId)

Deactivate a cluster server event. This function is a wrapper for sl_zigbee_zcl_deactivate_cluster_tick.

Parameters
N/Aendpoint

The endpoint of the event to be deactivated.

N/AclusterId

The cluster ID of the event to be deactivated.

Returns

  • EMBER_SUCCESS if the event was deactivated or an error otherwise.


Definition at line 1327 of file app/framework/include/af.h

EMBER_AF_CLIENT_CLUSTER_TICK#

#define EMBER_AF_CLIENT_CLUSTER_TICK
Value:
true

Friendly define for use in the scheduling or canceling client events with sl_zigbee_zcl_schedule_cluster_tick() and sl_zigbee_zcl_deactivate_cluster_tick().


Definition at line 1154 of file app/framework/include/af.h

EMBER_AF_SERVER_CLUSTER_TICK#

#define EMBER_AF_SERVER_CLUSTER_TICK
Value:
false

Friendly define for use in the scheduling or canceling server events with sl_zigbee_zcl_schedule_cluster_tick() and sl_zigbee_zcl_deactivate_cluster_tick().


Definition at line 1161 of file app/framework/include/af.h

emberAfGetCurrentSleepControl#

#define emberAfGetCurrentSleepControl
Value:
()

Retrieve the most restrictive sleep control value for all scheduled events. This function is used by emberAfOkToNap and emberAfOkToHibernate to makes sure that there are no events scheduled, which will keep the device from hibernating or napping.

Returns

  • The most restrictive sleep control value for all scheduled events or the value returned by emberAfGetDefaultSleepControl() if no events are currently scheduled. The default sleep control value is initialized to EMBER_AF_OK_TO_HIBERNATE but can be changed at any time using the emberAfSetDefaultSleepControl() function.


Definition at line 1344 of file app/framework/include/af.h

emberAfSetDefaultSleepControl#

#define emberAfSetDefaultSleepControl
Value:
(x)

Set the default sleep control value against which all scheduled event sleep control values will be evaluated. This can be used to keep a device awake for an extended period of time by setting the default to EMBER_AF_STAY_AWAKE and then resetting the value to EMBER_AF_OK_TO_HIBERNATE once the wake period is complete.


Definition at line 1356 of file app/framework/include/af.h

emberAfGetDefaultSleepControl#

#define emberAfGetDefaultSleepControl
Value:
()

Retrieve the default sleep control against which all event sleep control values are evaluated. The default sleep control value is initialized to EMBER_AF_OK_TO_HIBERNATE but can be changed by the application at any time using the emberAfSetDefaultSleepControl() function.

Returns

  • The current default sleep control value.


Definition at line 1367 of file app/framework/include/af.h