REQUEST(UAM_REQUEST_GET_SERVICE_USERS) \
REQUEST(UAM_REQUEST_GET_SERVICES) \
REQUEST(UAM_REQUEST_ADD_IBEACON_ADV) \
+ REQUEST(UAM_REQUEST_ADD_PAYLOAD) \
REQUEST(UAM_REQUEST_MAX)
#define GENERATE_REQUEST_ENUM(ENUM) ENUM,
g_array_append_vals(in_param2, str, sizeof(str));
g_array_append_vals(in_param3, &tech_type, sizeof(int));
-// ret = _uam_async_request(UAM_REQUEST_ADD_PAYLOAD, in_param1, in_param2,
-// in_param3, in_param4, cb_info.callback, cb_info.user_data);
+ ret = _uam_async_request(UAM_REQUEST_ADD_PAYLOAD, in_param1, in_param2,
+ in_param3, in_param4, cb_info.callback, cb_info.user_data);
UAM_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
void _uam_core_handle_status_changed(unsigned int sensor, void *info);
+int _uam_core_add_payload(uam_ble_payload_s *payload, const char *device_id,
+ int tech_type);
+
#ifdef __cplusplus
}
#endif
FUNC_EXIT;
}
+int _uam_core_add_payload(uam_ble_payload_s *payload,
+ const char *device_id, int tech_type)
+{
+ FUNC_ENTRY;
+ int ret = UAM_ERROR_NONE;
+ uam_db_tech_info_t *tech_info;
+// char *mac;
+
+ retv_if(NULL == payload, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(NULL == device_id, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_NONE >= tech_type, UAM_ERROR_INVALID_PARAMETER);
+ retv_if(UAM_TECH_TYPE_MAX <= tech_type, UAM_ERROR_INVALID_PARAMETER);
+
+ tech_info = __uam_core_get_dev_tech_info(device_id, tech_type);
+ retv_if(NULL == tech_info, UAM_ERROR_INVALID_PARAMETER);
+// mac = __get_mac_addr(tech_info);
+
+ /*** Add payload to database ***/
+// ret = _uam_db_insert_payload(payload, device_id, tech_type, mac);
+ if (UAM_ERROR_NONE != ret) {
+ UAM_ERR("_uam_db_insert_adv_info failed");
+ return ret;
+ }
+
+ FUNC_EXIT;
+ return UAM_ERROR_NONE;
+}
result = _uam_core_add_ibeacon_adv(adv_len, iadv);
break;
}
+ case UAM_REQUEST_ADD_PAYLOAD: {
+ uam_ble_payload_s *payload;
+ const char *device_id;
+ int tech_type;
+
+ __uam_manager_copy_params(in_param1, &payload, sizeof(uam_ble_payload_s));
+ device_id = (char *)g_variant_get_data(in_param2);
+ __uam_manager_copy_params(in_param3, &tech_type, sizeof(int));
+ UAM_DBG("Payload primary key: [%d] device_id: [%s], tech_type: %d",
+ payload->primary_key, device_id, tech_type);
+
+ result = _uam_core_add_payload(payload, device_id, tech_type);
+
+ break;
+ }
default:
UAM_WARN("UnSupported function [%s(0x%4.4X)]",
_uam_manager_request_to_str(function), function);
case UAM_REQUEST_GET_SERVICE_USERS:
case UAM_REQUEST_GET_SERVICES:
case UAM_REQUEST_ADD_IBEACON_ADV:
+ case UAM_REQUEST_ADD_PAYLOAD:
return TRUE;
default:
return FALSE;