}
// 3. Notify the client that the requested discovery has been finished
- RequestMap::iterator request_itr = __requestMap.find(client);
- if (request_itr != __requestMap.end()) {
+ RequestMap::iterator requestIter = __requestMap.find(client);
+ if (requestIter != __requestMap.end()) {
Json noData;
- Request* currentRequest = request_itr->second;
+ Request* currentRequest = requestIter->second;
currentRequest->publish(CONV_DISCOVERY_FINISHED, noData);
+ __requestMap.erase(requestIter);
}
return CONV_ERROR_NONE;
if ( error < 0 ) {
_E("vconf error (%d)", error);
- // temporary code
+// temporary code for binary without vconf
__activationState = 1;
}
}
error = vconf_notify_key_changed(VCONFKEY_SETAPPL_D2D_CONVERGENCE, vconf_update_cb, this);
+// temporarily commented out for binary without vconf
// IF_FAIL_RETURN_TAG(error >= 0, CONV_ERROR_INVALID_OPERATION, _E, "vconf error (%d)", error);
return CONV_ERROR_NONE;
if (error != 0) {
_D("vconf_get_int failed %d", error);
- return false;
+// return false;
+// temporary code for binary without vconf
+ return true;
}
if ((serviceValue & currentState) > 0) {
payload.set(NULL, CONV_JSON_PAYLOAD_SIZE, message.m_payload_size);
payload.set(NULL, CONV_JSON_RESULT_TYPE, CONV_JSON_ON_MESSAGE);
- payload.set(NULL, CONV_JSON_MESSAGE, message_json);
+// payload.set(NULL, CONV_JSON_MESSAGE, message_json);
+ payload.set(NULL, CONV_JSON_MESSAGE, message_json.dupCstr());
+ payload.set(NULL, CONV_JSON_FROM, message.m_from);
description = (*requestObj)->getDescription();
client_json.set(NULL, CONV_JSON_CLIENT_ID, client->getId());
payload.set(NULL, CONV_JSON_RESULT_TYPE, result_type);
- payload.set(NULL, CONV_JSON_CLIENT, client_json);
+// payload.set(NULL, CONV_JSON_CLIENT, client_json);
+ payload.set(NULL, CONV_JSON_CLIENT, client_json.dupCstr());
description = (*requestObj)->getDescription();
channel.get(NULL, CONV_JSON_URI, &uri);
channel.get(NULL, CONV_JSON_CHANNEL_ID, &channelId);
+ IF_FAIL_RETURN_TAG(!uri.empty() || svcInfo->isLocal, CONV_ERROR_INVALID_PARAMETER, _E, "uri is empty");
+ IF_FAIL_RETURN_TAG(!channelId.empty(), CONV_ERROR_INVALID_PARAMETER, _E, "channelId is empty");
+
ApplicationInstance *appInfo = NULL;
for (ApplicationInstanceList::iterator iter = svcInfo->applicationInstanceList.begin(); iter != svcInfo->applicationInstanceList.end(); ++iter) {
channel.get(NULL, CONV_JSON_URI, &uri);
channel.get(NULL, CONV_JSON_CHANNEL_ID, &channelId);
+ IF_FAIL_RETURN_TAG(!uri.empty() || svcInfo->isLocal, CONV_ERROR_INVALID_PARAMETER, _E, "uri is empty");
+ IF_FAIL_RETURN_TAG(!channelId.empty(), CONV_ERROR_INVALID_PARAMETER, _E, "channelId is empty");
+
for (ApplicationInstanceList::iterator iter = svcInfo->applicationInstanceList.begin(); iter != svcInfo->applicationInstanceList.end(); ++iter) {
_D("%s, %s", (*iter)->uri.c_str(), (*iter)->channelId.c_str());
if ( (*iter) != NULL && !(*iter)->uri.compare(uri) && !(*iter)->channelId.compare(channelId) ) {
channel.get(NULL, CONV_JSON_URI, &uri);
channel.get(NULL, CONV_JSON_CHANNEL_ID, &channelId);
+ IF_FAIL_RETURN_TAG(!uri.empty() || svcInfo->isLocal, CONV_ERROR_INVALID_PARAMETER, _E, "uri is empty");
+ IF_FAIL_RETURN_TAG(!channelId.empty(), CONV_ERROR_INVALID_PARAMETER, _E, "channelId is empty");
+
ApplicationInstance *appInfo = NULL;
Json result;
if (cha != NULL)
client.set(NULL, CONV_JSON_CHANNEL_URI, cha->getChannelUri(NULL).c_str());
- result.appendArray(NULL, CONV_JSON_CLIENT_LIST, client);
+// result.appendArray(NULL, CONV_JSON_CLIENT_LIST, client);
+ result.appendArray(NULL, CONV_JSON_CLIENT_LIST, client.dupCstr());
}
sendReadResponse(result, CONV_JSON_GET_CLIENTS, CONV_ERROR_NONE, svcInfo->registeredRequest);
channel.get(NULL, CONV_JSON_URI, &uri);
channel.get(NULL, CONV_JSON_CHANNEL_ID, &channelId);
+ IF_FAIL_RETURN_TAG(!uri.empty() || svcInfo->isLocal, CONV_ERROR_INVALID_PARAMETER, _E, "uri is empty");
+ IF_FAIL_RETURN_TAG(!channelId.empty(), CONV_ERROR_INVALID_PARAMETER, _E, "channelId is empty");
+
for (ApplicationInstanceList::iterator iter = svcInfo->applicationInstanceList.begin(); iter != svcInfo->applicationInstanceList.end(); ++iter) {
_D("iteration");
if ( (*iter) != NULL && !(*iter)->uri.compare(uri) && !(*iter)->channelId.compare(channelId) ) {
}
device_callback_info_s* callback_info = itor->second;
callback_info->cb(device, (conv_discovery_result_e)error, callback_info->user_data);
+
+ // unset callback..on finished
+ if (error == CONV_DISCOVERY_RESULT_FINISHED) {
+ _D("free memory for callback[id:%d]", req_id);
+ delete callback_map[req_id];
+ callback_map.erase(itor);
+ }
}
static void register_subject_callbacks()
int err = conv::dbus_client::request(REQ_WRITE, &req_id, CONV_SUBJECT_DISCOVERY_STOP, NULL, NULL, NULL);
IF_FAIL_RETURN_TAG(err == CONV_ERROR_NONE, err, _E, "Failed in starting flow service");
- // unset callback..
- std::list<int>::iterator req_itr = handle->request_ids.begin();
- for (; req_itr != handle->request_ids.end(); req_itr++) {
- int cur_req_id = *req_itr;
- if (callback_map[cur_req_id] != NULL) {
- _D("free memory for callback[id:%d]", cur_req_id);
- delete callback_map[cur_req_id];
- callback_map.erase(callback_map.find(cur_req_id));
- }
- }
-
return CONV_ERROR_NONE;
}