FUNC_ENTRY;
int user_data_len = 0;
- ret_if (NULL == src_payload);
+ ret_if(NULL == src_payload);
dst_payload->primary_key = src_payload->primary_key;
dst_payload->device_icon = src_payload->device_icon;
FUNC_ENTRY;
int user_data_len = 0;
- ret_if (NULL == src_payload);
+ ret_if(NULL == src_payload);
dst_payload->primary_key = src_payload->primary_key;
dst_payload->device_icon = src_payload->device_icon;
if (discriminant >= 0)
svc->discriminant = discriminant;
- if (last_seen >= 0)
+ if (last_seen > 0)
svc->last_seen = last_seen;
if (payload_info)
__uam_copy_uam_payload_info(svc->payload, payload_info);
GSList *svc_dev_list = NULL;
uam_db_user_info_t *user = NULL;
uam_svc_dev_info_t *svc_dev = NULL;
+ uam_db_service_info_t *service = NULL;
UAM_INFO("[%d]", user_id);
}
user = l->data;
- /* Get default service and add it to device's service list by default */
- l = g_slist_find_custom(services, UAM_SERVICE_DEFAULT, __compare_svc_name);
- if (!l) {
- uam_db_service_info_t *service = g_new0(uam_db_service_info_t, 1);
- service->name = g_strdup(UAM_SERVICE_DEFAULT);
- service->cycle = UAM_DETECTION_CYCLE_DEFAULT;
- services = g_slist_append(services, service);
- svc_list = g_slist_append(svc_list, service);
- } else {
- uam_db_service_info_t *service = l->data;
- svc_list = g_slist_append(svc_list, service);
- }
-
/** updates for svc dev*/
ret = _uam_core_update_svc_dev_info(dev_info->device_id, dev_info->type,
UAM_SERVICE_DEFAULT, dev_info->discriminant, 0, NULL);
return ret;
}
+ /* Get default service and add it to device's service list by default */
+ l = g_slist_find_custom(services, UAM_SERVICE_DEFAULT, __compare_svc_name);
+ if (!l) {
+ service = g_new0(uam_db_service_info_t, 1);
+ service->name = g_strdup(UAM_SERVICE_DEFAULT);
+ service->cycle = UAM_DETECTION_CYCLE_DEFAULT;
+ services = g_slist_append(services, service);
+ } else {
+ service = l->data;
+ }
+
+ svc_list = g_slist_append(svc_list, service);
svc_dev = _uam_core_find_svc_dev_info(dev_info->device_id,
dev_info->type, UAM_SERVICE_DEFAULT);
svc_dev_list = g_slist_append(svc_dev_list, svc_dev);
/** Compare device payload*/
/** If payload is NULL, send event to all services */
- UAM_DBG("Compare payload - primary_key detected: [%d], svc_dev: [%d] ",
- payload->primary_key, svc_dev->payload->primary_key);
+ if (payload) {
+ UAM_DBG("Compare payload - primary_key detected: [%d], svc_dev: [%d] ",
+ payload->primary_key, svc_dev->payload->primary_key);
- if (payload && (0 != __compare_payload(svc_dev->payload, payload)))
- continue;
+ if (0 != __compare_payload(svc_dev->payload, payload))
+ continue;
+ } else {
+ UAM_DBG("Detected payload is NULL");
+ }
UAM_DBG("Send event");
for (l1 = svc->monitors; NULL != l1; l1 = g_slist_next(l1)) {
/** Update payload info in list with user data */
l = g_slist_find_custom(payloads, payload, __compare_payload);
- if (l) {
+ if (l)
__uam_copy_uam_payload_info(l->data, payload);
- }
retv_if(UAM_ERROR_NONE != __uam_db_begin_transaction(), UAM_ERROR_INVALID_PARAMETER);
FUNC_ENTRY;
int ret = UAM_ERROR_NONE;
uam_db_tech_info_t *tech_info;
- uam_db_payload_info_t *db_payload = g_new0(uam_db_payload_info_t, 1);
+ uam_db_payload_info_t *db_payload;
char *mac;
retv_if(NULL == payload, UAM_ERROR_INVALID_PARAMETER);
retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAMETER);
mac = __get_mac_addr(tech_info);
+ db_payload = g_new0(uam_db_payload_info_t, 1);
__uam_copy_uam_payload_info(db_payload, payload);
db_payload->device_id = g_strdup(device_id);
db_payload->tech_type = tech_type;