monitor->user_data = user_data;
monitor->presence_detection_started = TRUE;
+ g_free(service);
+
FUNC_EXIT;
return UA_ERROR_NONE;
}
if (monitor->service)
if ((service && g_strcmp0(monitor->service, service)) ||
- (!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT)))
+ (!service && g_strcmp0(monitor->service, UA_SERVICE_DEFAULT))) {
+ g_free(service);
return UA_ERROR_NOT_PERMITTED;
+ }
retv_if(UA_DETECT_MODE_INVALID <= mode, UA_ERROR_INVALID_PARAMETER);
retv_if(0 == monitor->sensor_bitmask, UA_ERROR_NO_DATA);
monitor->user_data = user_data;
monitor->absence_detection_started = TRUE;
+ g_free(service);
+
FUNC_EXIT;
return UA_ERROR_NONE;
}
if (strlen(g_presence_and_cond))
bitmask_and = (unsigned char)strtol(g_presence_and_cond, NULL, 10);
- if (strlen(g_presence_and_cond))
- bitmask_or = (unsigned char)strtol(g_absence_and_cond, NULL, 10);
+ if (strlen(g_presence_or_cond))
+ bitmask_or = (unsigned char)strtol(g_absence_or_cond, NULL, 10);
msgb("AND [0x%u] OR [0x%u]", bitmask_and, bitmask_or);
static void __user_presence_detected_foreach_devices(gpointer data,
gpointer user_data)
{
+ int ret;
ua_device_h device_handle = (ua_device_h)data;
char *account = (char *)user_data;
ua_mac_type_e mac_type;
char *mac = NULL;
- ua_device_get_mac_address(device_handle, &mac);
- ua_device_get_mac_type(device_handle, &mac_type);
+ ret = ua_device_get_mac_address(device_handle, &mac);
+ if (UA_ERROR_NONE != ret) {
+ msg(" - ua_device_get_mac_address() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+ }
+ ret = ua_device_get_mac_type(device_handle, &mac_type);
+ if (UA_ERROR_NONE != ret) {
+ msg(" - ua_device_get_mac_type() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+ }
msgb("[%s] detected on [%s][%s]", account,
__convert_device_mac_type_to_txt(mac_type), mac);
+
+ g_free(mac);
}
static void __user_presence_detected_cb(int result, ua_monitor_h monitor,
ua_user_h user_handle, GSList *device_handles,
void *user_data)
{
+ int ret;
char *account = NULL;
char *pbuf = uat_get_time();
msg("\n[%s]", pbuf);
free(pbuf);
- ua_user_get_account(user_handle, &account);
+ ret = ua_user_get_account(user_handle, &account);
+ if (UA_ERROR_NONE != ret) {
+ msg(" - ua_user_get_account() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+ }
msgb("[%s] PRESENCE detected [%s]", account, uat_get_error_str(result));
g_slist_foreach(device_handles,
__user_presence_detected_foreach_devices,
account);
- if (account) {
- free(account);
- }
+ g_free(account);
}
static void __sensor_state_changed_cb(bool ready,