char *arg = NULL;
int result;
int cmd;
- std::string group_name, uuid, data;
+ std::string requester_id, group_name, uuid, data;
comp_context_t *comp_ctx;
try {
_print_oc_representation(rep);
- if (!rep.getValue("CMD", cmd)) {
+ ObservationInfo observationInfo = request->getObservationInfo();
+ LOG_DEBUG("Received request from %s:%d",
+ observationInfo.address.c_str(), observationInfo.port);
+
+ if (!rep.getValue("CMD", cmd))
LOG_ERR("CMD not found in representation");
- } else {
+ else
LOG_DEBUG("Command received %d", cmd);
- }
+
+ if (!rep.getValue("device_id", requester_id))
+ LOG_ERR("device_id not found in representation");
+ else
+ LOG_DEBUG("device_id received %s", requester_id.c_str());
+
switch(cmd) {
case COMP_REQ_SEND_DATA:
#ifdef SUPPORT_BASE64_ENCODING
}
notify_request_result(command2string((comp_request_type_e) cmd),
- arg, result);
+ requester_id.c_str(), arg, result);
g_free(arg);
LOG_DEBUG("CMD = %s", command2string(cmd->command));
+ rep.setValue("CMD", cmd->command);
+
+ comp_context_t *comp_ctx = comp_context_get_context();
+ rep.setValue("device_id", std::string(comp_ctx->device_uuid));
+
if (cmd->command == COMP_REQ_CREATE_GROUP) { //request create group
- rep.setValue("CMD", COMP_REQ_CREATE_GROUP);
rep.setValue("name", std::string(cmd->arg1));
} else if (cmd->command == COMP_REQ_INVITE_DEVICE) { //request invite
- rep.setValue("CMD", COMP_REQ_INVITE_DEVICE);
rep.setValue("name", std::string(cmd->arg1));
rep.setValue("id", std::string(cmd->arg2));
rep.setValue("PIN", std::string(cmd->arg3));
} else if (cmd->command == COMP_REQ_EJECT_DEVICE) { //request eject
- rep.setValue("CMD", COMP_REQ_EJECT_DEVICE);
rep.setValue("name", std::string(cmd->arg1));
rep.setValue("id", std::string(cmd->arg2));
} else if (cmd->command == COMP_REQ_DELETE_GROUP) { //request delete group
- rep.setValue("CMD", COMP_REQ_DELETE_GROUP);
rep.setValue("name", std::string(cmd->arg1));
} else { /* Send Data */
- rep.setValue("CMD", COMP_REQ_SEND_DATA);
#ifdef SUPPORT_BASE64_ENCODING
uint32_t outSize = 0;
size_t b64BufSize = B64ENCODE_OUT_SAFESIZE(
OCRepresentation rep;
rep.setValue("CMD", cmd->command);
+
+ comp_context_t *comp_ctx = comp_context_get_context();
+ rep.setValue("device_id", std::string(comp_ctx->device_uuid));
+
switch (cmd->command) {
case COMP_REQ_SEND_DATA:
rep.setValue("data", std::string(cmd->arg1));