}
}
- if (comp_group_add_device_in_group(group_name, uuid) < 0)
- return COMP_ERROR_UNKNOWN;
-
#else
ret = agent_pair(pin, comp_ctx->device_uuid, uuid, "/comp/data/1", "core.comp.data",
"oic.if.baseline", FULL_PERMISSION, uuid, comp_ctx->device_uuid, "/comp/data/1", "core.comp.data", "oic.if.baseline", FULL_PERMISSION);
#endif
+
+ if (comp_group_add_device_in_group(group_name, uuid) < 0)
+ return COMP_ERROR_UNKNOWN;
+
LOG_END();
return ret;
int ret = COMP_ERROR_NONE;
comp_command_t *cmd = g_new0(comp_command_t, 1);
- cmd->command = g_strdup("create_subgroup");
+ cmd->command = g_strdup("1");
cmd->uuid = g_strdup(uuid);
cmd->arg1 = g_strdup(group_name);
cmd->arg2 = g_strdup(subgroup_name);
return NULL;
}
+
int comp_group_add_device_to_subgroup(char *subgroup_name, char *uuid)
{
//get uuid from subgroup_name.
LOG_ERR("send remote data : %s, %s, %s", subgroup_name, subgroup_uuid, uuid);
if (subgroup_uuid != NULL) {
cmd = g_new0(comp_command_t, 1);
- cmd->command = g_strdup("add_device_to_subgroup");
+ cmd->command = g_strdup("2");
cmd->uuid = g_strdup(subgroup_uuid);
cmd->arg1 = g_strdup(subgroup_name);
cmd->arg2 = g_strdup(uuid);
char *command;
iotcon_query_lookup(query, "CMD", &command);
- if (strcmp(command, "create_subgroup") == 0) {
+ if (strcmp(command, "1") == 0) {
LOG_DEBUG("Another device request create sub group");
char *group_name;
iotcon_query_lookup(query, "group_name", &group_name);
comp_group_create(group_name);
- } else if (strcmp(command, "add_device_to_subgroup") == 0) {
+ } else if (strcmp(command, "2") == 0) {
LOG_DEBUG("Another device request add device to sub group");
char *group_name;
char *uuid;
- iotcon_query_lookup(query, "group_name", &group_name);
- iotcon_query_lookup(query, "device_id", &uuid);
+ iotcon_query_lookup(query, "name", &group_name);
+ iotcon_query_lookup(query, "id", &uuid);
LOG_DEBUG("group_name : %s, UUID : %s", group_name, uuid);
if (IOTCON_ERROR_NONE != ret)
return IOTCON_FUNC_CONTINUE;
- if (strcmp(cmd->command, "create_subgroup") == 0) {
+ if (strcmp(cmd->command, "1") == 0) {
LOG_DEBUG("CMD : %s, group_name : %s", cmd->command, cmd->arg2);
iotcon_query_add(query, "CMD", cmd->command);
iotcon_query_add(query, "group_name", cmd->arg2);
- } else if (strcmp(cmd->command, "add_device_to_subgroup") == 0) {
+ } else if (strcmp(cmd->command, "2") == 0) {
LOG_DEBUG("CMD : %s, group_name : %s, UUID : %s", cmd->command, cmd->arg1, cmd->arg2);
iotcon_query_add(query, "CMD", cmd->command);
- iotcon_query_add(query, "group_name", cmd->arg1);
- iotcon_query_add(query, "device_id", cmd->arg2);
+ iotcon_query_add(query, "name", cmd->arg1);
+ iotcon_query_add(query, "id", cmd->arg2);
}
ret = iotcon_remote_resource_get(resource_clone, query, _on_get, NULL);