FUNC_EXIT;
}
+static void __add_svc_dev_to_dev_tech_mapping(
+ uam_db_tech_info_t *tech, uam_svc_dev_info_t *svc_dev)
+{
+ FUNC_ENTRY;
+
+ ret_if(NULL == tech);
+ ret_if(NULL == svc_dev);
+
+ tech->svc_dev_list = g_slist_append(tech->svc_dev_list, svc_dev);
+ g_slist_foreach(tech->svc_dev_list, __print_svc_dev, NULL);
+
+ FUNC_EXIT;
+}
+
static void __remove_service_to_dev_tech_mapping(
uam_db_tech_info_t *tech, uam_db_service_info_t *service)
{
int ret = UAM_ERROR_NONE;
uam_db_tech_info_t *tech_info;
uam_db_service_info_t *service;
+ uam_svc_dev_info_t *svc_dev = NULL;
retv_if(NULL == svc_name, UAM_ERROR_INVALID_PARAMETER);
retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
__add_service_to_dev_tech_mapping(tech_info, service);
+ _uam_core_update_svc_dev_info(device_id, tech_type,
+ service->name, -1, -1, NULL);
+ svc_dev = _uam_core_find_svc_dev_info(device_id, tech_type, service->name);
+ __add_svc_dev_to_dev_tech_mapping(tech_info, svc_dev);
+
mac = __get_mac_addr(tech_info);
/* Insert device service info to db */
ret = _uam_db_insert_device_service_info(device_id, tech_type, mac,
uam_db_service_info_t *service;
uam_db_payload_info_t *db_payload;
uam_svc_dev_info_t *svc_dev;
- uam_db_device_info_t *device;
GSList *l;
retv_if(NULL == payload, UAM_ERROR_INVALID_PARAMETER);
retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
db_payload = l->data;
- // <TO-DO> check if this device-service pair exist
+ /* Retrieve device from list */
+ l = g_slist_find_custom(devices, db_payload->device_id, __compare_device_id);
+ retv_if(NULL == l, UAM_ERROR_INVALID_PARAMETER);
- /**Update svc_dev*/
- _uam_core_update_svc_dev_info(db_payload->device_id, db_payload->tech_type,
- service->name, -1, -1, payload);
svc_dev = _uam_core_find_svc_dev_info(db_payload->device_id,
db_payload->tech_type, service->name);
retv_if(NULL == svc_dev, UAM_ERROR_INVALID_PARAMETER);
- /**Update svc_dev list for device*/
- l = g_slist_find_custom(devices, db_payload->device_id, __compare_device_id);
- device = l->data;
-
- for (l = device->tech_list; NULL != l; l = g_slist_next(l)) {
- uam_db_tech_info_t *tech = l->data;
-
- if (!tech)
- continue;
-
- if (db_payload->tech_type != tech->tech_type)
- continue;
-
- tech->svc_dev_list = g_slist_append(tech->svc_dev_list, svc_dev);
- }
+ /**Update svc_dev*/
+ _uam_core_update_svc_dev_info(db_payload->device_id, db_payload->tech_type,
+ service->name, -1, -1, payload);
/* Set/update registered device list to plugins */
if (UAM_ERROR_NONE != _uam_pm_set_registered_devices(devices))
UAM_ERR("_uam_pm_set_registered_devices failed");
-
/*** Add payload service mapping to database ***/
ret = _uam_db_update_device_service_payload_info(payload, service->name);
if (UAM_ERROR_NONE != ret) {