THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "%s is empty.", g_things_info_file_path);
is_valid = 0;
}
-
+
if (is_valid == 0) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Try to reset the info file.");
if (set_json_string_into_file(g_things_info_file_path, origin_json_str) == 0) {
wifi_manager_softap_config_s *dm_get_softap_wifi_config(void)
{
- st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)(0));
+ st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)(0));
int ssid_type = (is_artik == true ? 1 : 0);
- unsigned char mac_id[16] = {0, };
+ unsigned char mac_id[16] = { 0, };
wifi_manager_info_s st_wifi_info;
wifi_manager_get_info(&st_wifi_info);
}
if (NULL != manufacturer_url) {
memcpy(node->manufacturer_url, manufacturer_url->valuestring, strlen(manufacturer_url->valuestring) + 1);
- }
+ }
if (NULL != manufacturing_date) {
memcpy(node->manufacturing_date, manufacturing_date->valuestring, strlen(manufacturing_date->valuestring) + 1);
- }
+ }
if (NULL != model_number) {
memcpy(node->model_num, model_number->valuestring, strlen(model_number->valuestring) + 1);
}
node->collection[iter].rt_cnt = type_cnt;
for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
cJSON *type = cJSON_GetArrayItem(types, typeiter);
- node->collection[iter].resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+ node->collection[iter].resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
memcpy(node->collection[iter].resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
THINGS_LOG_D(THINGS_INFO, TAG, "[COLLECTION] collection[iter].resource_types[typeiter] : %s", (node->collection[iter].resource_types[typeiter]));
}
node->collection[iter].if_cnt = if_cnt;
for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
- node->collection[iter].interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+ node->collection[iter].interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
memcpy(node->collection[iter].interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
}
} else {
link_resource->rt_cnt = type_cnt;
for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
cJSON *type = cJSON_GetArrayItem(types, typeiter);
- link_resource->resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+ link_resource->resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
memcpy(link_resource->resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
}
} else {
link_resource->if_cnt = if_cnt;
for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
- link_resource->interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+ link_resource->interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
memcpy(link_resource->interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
}
} else {
node->single[iter].rt_cnt = type_cnt;
for (int typeiter = 0; typeiter < type_cnt; typeiter++) {
cJSON *type = cJSON_GetArrayItem(types, typeiter);
- node->single[iter].resource_types[typeiter] = things_malloc(sizeof(char *) *strlen(type->valuestring) + 1);
+ node->single[iter].resource_types[typeiter] = things_malloc(sizeof(char *) * strlen(type->valuestring) + 1);
memcpy(node->single[iter].resource_types[typeiter], type->valuestring, strlen(type->valuestring) + 1);
}
} else {
node->single[iter].if_cnt = if_cnt;
for (int ifiter = 0; ifiter < if_cnt; ifiter++) {
cJSON *interface = cJSON_GetArrayItem(interfaces, ifiter);
- node->single[iter].interface_types[ifiter] = things_malloc(sizeof(char *) *strlen(interface->valuestring) + 1);
+ node->single[iter].interface_types[ifiter] = things_malloc(sizeof(char *) * strlen(interface->valuestring) + 1);
memcpy(node->single[iter].interface_types[ifiter], interface->valuestring, strlen(interface->valuestring) + 1);
}
} else {
THINGS_LOG_D(THINGS_INFO, TAG, "[configuration] manufature_id : %s / setup_id : %s / artik : %d", manufature_id->valuestring, setup_id->valuestring, is_artik);
- g_manufacturer_name = things_malloc(sizeof(char *) *strlen(manufature_id->valuestring) + 1);
+ g_manufacturer_name = things_malloc(sizeof(char *) * strlen(manufature_id->valuestring) + 1);
strncpy(g_manufacturer_name, manufature_id->valuestring, strlen(manufature_id->valuestring) + 1);
- g_setup_id = things_malloc(sizeof(char *) *strlen(setup_id->valuestring) + 1);
+ g_setup_id = things_malloc(sizeof(char *) * strlen(setup_id->valuestring) + 1);
strncpy(g_setup_id, setup_id->valuestring, strlen(setup_id->valuestring) + 1);
} else {
return 0;
//THINGS_LOG_D(THINGS_DEBUG, TAG, THINGS_FUNC_ENTRY);
st_device_s *device = NULL;
- device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)device_id);
+ device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)device_id);
if (device == NULL) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
st_device_s *dm_get_info_of_dev(unsigned long number)
{
- return (st_device_s *) hashmap_get(g_device_hmap, number);
+ return (st_device_s *)hashmap_get(g_device_hmap, number);
}
static void dm_delete_user_define_device_id(void)
return false;
}
- if ((dev_list = (st_device_s **) things_malloc(sizeof(st_device_s *) *device_cnt)) == NULL) {
+ if ((dev_list = (st_device_s **)things_malloc(sizeof(st_device_s *) * device_cnt)) == NULL) {
THINGS_LOG_ERROR(THINGS_ERROR, TAG, "st_device_s mem allocation is failed.");
return false;
}
// Set Main-Device ID
id = OCGetServerInstanceIDString();
- dev_list[0] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+ dev_list[0] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
if (id == NULL || dev_list[0] == NULL) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Error : id = %s, Main-device =0x%X", id, dev_list[0]);
// Set Sub-Device ID
for (i = 1; i < device_cnt; i++) {
- dev_list[i] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)i);
+ dev_list[i] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)i);
if (dev_list[i] == NULL) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Error : device[%d] =0x%X", i, dev_list[i]);
goto GOTO_ERROR;
// 2. Device Capability Resources Registration
THINGS_LOG_D(THINGS_DEBUG, TAG, "BEFORE SEARCHING THE DEVICE ITEM FROM HASH TABLE");
- device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)device_num);
+ device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)device_num);
if (NULL != device) {
snprintf(id, sizeof(id), "%d", device->no);
int device_cnt = (int)hashmap_count(g_device_hmap);
if (device_cnt > 0 && device_cnt > id) {
- st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)(id));
+ st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)(id));
if (device) {
for (int index = 0; index < MAX_DEVICE_CAPABILTY_CNT; index++) {
int device_cnt = (int)hashmap_count(g_device_hmap);
if (device_cnt > 0) {
st_device_s **devices = NULL;
- if ((devices = (st_device_s **) things_malloc(sizeof(st_device_s *) *device_cnt)) == NULL) {
+ if ((devices = (st_device_s **)things_malloc(sizeof(st_device_s *) * device_cnt)) == NULL) {
THINGS_LOG_ERROR(THINGS_ERROR, TAG, "st_device_s memory allocation is failed.");
return ret;
}
for (int index = 0; index < device_cnt; index++) {
- devices[index] = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)index);
+ devices[index] = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)index);
}
(*list) = devices;
if (rt != NULL && payload != NULL) {
// 1. Get index with resource type
unsigned long index = hashmap_get_hashval((unsigned char *)rt);
- OCRepPayload *r_payload = (OCRepPayload *) payload;
+ OCRepPayload *r_payload = (OCRepPayload *)payload;
// 2. Get resource type instance
THINGS_LOG_D(THINGS_INFO, TAG, "Index : %u rt : %s", index, rt);
THINGS_LOG_D(THINGS_DEBUG, TAG, "things_get_resource_type : %s", resource_uri);
int device_cnt = (int)hashmap_count(g_device_hmap);
if (device_cnt > 0) {
- st_device_s *device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+ st_device_s *device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
if (device != NULL) {
if (device->sig_cnt > 0) {
if (device_cnt > 0) {
st_device_s *device = NULL;
- device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+ device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
if (device == NULL) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
return NULL;
{
st_device_s *device = NULL;
- device = (st_device_s *) hashmap_get(g_device_hmap, (unsigned long)0);
+ device = (st_device_s *)hashmap_get(g_device_hmap, (unsigned long)0);
if (device == NULL) {
THINGS_LOG_V_ERROR(THINGS_ERROR, TAG, "Device Not Exist");
return NULL;