I'm just getting started with the RazBerry and the C API, in combination with a Vision ZD2102 door/window sensor.
I've got the callback for status updates working fine, so when the sensor is triggered I get notified properly. What I'm not sure about is how to properly get the battery status using the zway_cc_battery_get function.
My code is (in a simple form):
Code: Select all
zway_cc_battery_get(zway, 3, 0, batteryStatusCallback, NULL, NULL);
void batteryStatusCallback(const ZWay zway, ZWBYTE functionId, void* arg)
{
zway_data_acquire_lock(zway);
ZDataHolder data = zway_find_device_instance_cc_data(zway, 3, 0, 0x80, "last");
int batteryStatus;
zway_data_get_integer(zway, data, &batteryStatus);
// batteryStatus is now updated
zway_data_release_lock(zway);
}
Also, what is the purpose of the functionId? I've failed to find any function in the API that takes a function ID as a parameter, so I'm not sure what I'm supposed to do with it.
Thanks in advance!