Battery#

This command class can be used for reporting the device's battery level with additional features.

Additional functionality may be added to the application, if needed. See CC_Battery_BatteryGet_handler() in zwave_soc_sensor_pir's app.c source file as an example.

Modules#

SBatteryData

Enumerations#

enum
CMD_CLASS_BATTERY_LEVEL_LOW = 0x00
CMD_CLASS_BATTERY_LEVEL_HIGH = 0x10
CMD_CLASS_BATTERY_LEVEL_FULL = 0x64
CMD_CLASS_BATTERY_LEVEL_WARNING = 0xFF
}

Battery value can range from 0 to 100 (0x00 to 0x64) representing the battery level in percentage from 0 to 100%.

Typedefs#

typedef struct SBatteryData

Used to store the last reported battery level.

Functions#

bool
CC_Battery_LevelReport_tx(const AGI_PROFILE *pProfile, uint8_t sourceEndpoint, void(*pCbFunc)(TRANSMISSION_RESULT *pTransmissionResult))

Send unsolicited battery report.

uint8_t

Get current battery level from application.

bool

Function for periodically checking if the battery level differs from what was last reported.

uint8_t

Gets the reporting decrements value.

bool
cc_battery_write(SBatteryData *battery_data)
bool
cc_battery_read(SBatteryData *battery_data)

Enumeration Documentation#

cc_battery_level_t#

cc_battery_level_t

Battery value can range from 0 to 100 (0x00 to 0x64) representing the battery level in percentage from 0 to 100%.

The value 255 (0xFF) is used to indicate low-battery warning. All other values are reserved and SHALL be ignored by the receiving device.

Enumerator
CMD_CLASS_BATTERY_LEVEL_LOW

battery level low

CMD_CLASS_BATTERY_LEVEL_HIGH

battery level high

CMD_CLASS_BATTERY_LEVEL_FULL

battery level full

CMD_CLASS_BATTERY_LEVEL_WARNING

battery low-level warning


Definition at line 39 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

Typedef Documentation#

SBatteryData#

typedef struct SBatteryData SBatteryData

Used to store the last reported battery level.


Definition at line 54 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

Function Documentation#

CC_Battery_LevelReport_tx#

bool CC_Battery_LevelReport_tx (const AGI_PROFILE * pProfile, uint8_t sourceEndpoint, void(*)(TRANSMISSION_RESULT *pTransmissionResult) pCbFunc)

Send unsolicited battery report.

Parameters
[in]pProfile

pointer to AGI profile

[in]sourceEndpoint

source endpoint

[out]pCbFunc

callback funtion returning status destination node receive job.

Returns

  • true if a Battery Report was succesfully enqueued for transmission, false otherwise.


Definition at line 63 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

CC_Battery_BatteryGet_handler#

uint8_t CC_Battery_BatteryGet_handler (uint8_t endpoint)

Get current battery level from application.

Parameters
[in]endpoint

binary switch endpoint

This function must be implemented in the application code. Called by battery command class handler.

Returns

  • current battery level


Definition at line 77 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

cc_battery_check_level_changed#

bool cc_battery_check_level_changed (void )

Function for periodically checking if the battery level differs from what was last reported.

Parameters
N/A

Returns

  • true if the battery level has changed since last reported

  • false if the battery level hasn't changed


Definition at line 85 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

cc_battery_config_get_reporting_decrements#

uint8_t cc_battery_config_get_reporting_decrements (void )

Gets the reporting decrements value.

Parameters
N/A

Returns

  • uint8_t reporting decrements value


Definition at line 92 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/inc/CC_Battery.h

cc_battery_write#

bool cc_battery_write (SBatteryData * battery_data)
Parameters
N/Abattery_data

Definition at line 17 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/src/cc_battery_io.h

cc_battery_read#

bool cc_battery_read (SBatteryData * battery_data)
Parameters
N/Abattery_data

Definition at line 18 of file /mnt/raid/workspaces/ws.T7KR5OZRo/overlay/gsdk/protocol/z-wave/ZAF/CommandClasses/Battery/src/cc_battery_io.h