Changed iotcon API connectivity parameters 98/96998/2
authorkmook <kmook.choi@samsung.com>
Fri, 11 Nov 2016 01:30:48 +0000 (10:30 +0900)
committerkmook <kmook.choi@samsung.com>
Fri, 11 Nov 2016 01:53:08 +0000 (10:53 +0900)
Change-Id: I7b91fd0ba4fa81330b9f2ef345d5e78ede7b8ee5
Signed-off-by: kmook <kmook.choi@samsung.com>
daemon/discovery_provider/IotconDiscoveryProvider.cpp
daemon/service_provider/RemoteAppControlServiceProvider.cpp

index 4db7db7ca9544e090266efcca59e446bfdebbd7d..58aebb214f559e7255f0fd40438258443c9fb19b 100755 (executable)
@@ -352,7 +352,7 @@ int conv::IotconDiscoveryProvider::start()
                return CONV_ERROR_INVALID_OPERATION;
        }
 
-       ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4,
+       ret = iotcon_find_resource(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_IPV4_ONLY | IOTCON_CONNECTIVITY_PREFER_UDP,
                        query, __found_resource, NULL);
 
        iotcon_query_destroy(query);
index cf5560a472a3ab30f953b5c421ae235a7fa835a3..c03610ce23feefc82792d67cf3b367b6581ef88b 100755 (executable)
@@ -221,7 +221,7 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
        string hostAddressString(hostAddress);
        string ip = conv::util::getIpAddress(hostAddressString);
 
-       char macAddress[127] = {0,};
+       char macAddress[127] = {0, };
 
        IF_FAIL_RETURN_TAG(conv::util::getPeerMac(ip, -1, macAddress), CONV_ERROR_INVALID_PARAMETER, _E, "getPeerMac failed");
 
@@ -233,7 +233,6 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
        IF_FAIL_RETURN_TAG(ret == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_PARAMETER, _E, "iotcon_representation_get_attributes() Fail(%d)", ret);
 
        if(!strcmp(CONV_ACCESS_CONTROL_REQUEST, access_request_type)) {
-
                ACManagerPolicy acManagerPolicy = ACMANAGER_POLICY_U;
                IF_FAIL_RETURN_TAG(AddACLDevice(macAddress, deviceName, ip.c_str(), &acManagerPolicy) == ACLResult_OK, CONV_ERROR_INVALID_OPERATION, _E, "AddACLDevice failed");
 
@@ -246,20 +245,18 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
                } else if (acManagerPolicy == ACMANAGER_POLICY_U){
                        _D("UNDECIDED");
                        policy = CONV_ACCESS_CONTROL_DENIED;
-               }
 #if defined(_D2D_INTERNAL_ACL_)
-               else if (acManagerPolicy == ACMANAGER_POLICY_U2) {
+               else if (acManagerPolicy == ACMANAGER_POLICY_U2) {
                        _D("UNDECIDED");
                        conv::acl_manager::LaunchPasscodeShowPopup(deviceName);
                        policy = CONV_ACCESS_CONTROL_PASSCODE_REQUEST;
                }
+#else
+               }
 #endif
                _D("acManagerPolicy:%d", acManagerPolicy);
-
-       }
 #if defined(_D2D_INTERNAL_ACL_)
-       else if (!strcmp(CONV_ACCESS_CONTROL_PASSCODE_RESPONSE, access_request_type)) {
-
+       } else if (!strcmp(CONV_ACCESS_CONTROL_PASSCODE_RESPONSE, access_request_type)) {
                char *input_passcode;
                ret = iotcon_attributes_get_str(attributes, CONV_JSON_PASSCODE, &input_passcode);
                IF_FAIL_RETURN_TAG(ret == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_PARAMETER, _E, "iotcon_attributes_get_str() Fail(%d)", ret);
@@ -276,11 +273,12 @@ static int __access_control(iotcon_request_h request, iotcon_attributes_h attrib
                }
 
        } else if (!strcmp(CONV_ACCESS_CONTROL_PASSCODE_CANCEL, access_request_type)) {
-
                _D("Access Cancel Handling");
                policy = CONV_ACCESS_CONTROL_DENIED;
                conv::acl_manager::LaunchPopupCancelToast();
        }
+#else
+       }
 #endif
        iotcon_response_result_e result;
        result = IOTCON_RESPONSE_OK;
@@ -310,7 +308,7 @@ static int __app_control_launch(iotcon_request_h request, iotcon_attributes_h at
        string hostAddressString(hostAddress);
        string ip = conv::util::getIpAddress(hostAddressString);
 
-       char macAddress[127] = {0,};
+       char macAddress[127] = {0, };
        IF_FAIL_RETURN_TAG(conv::util::getPeerMac(ip, -1, macAddress), CONV_ERROR_INVALID_PARAMETER, _E, "getPeerMac failed");
 
        _D("Device IP : %s, Mac : %s", ip.c_str(), macAddress);
@@ -569,10 +567,8 @@ static void __on_access_response(iotcon_remote_resource_h resource, iotcon_error
                svcInfo->accessControlState = ACCESS_CONTROL_STATE_PERMITTED;
                sendResponse(result, CONV_JSON_ON_START, CONV_ERROR_NONE, svcInfo->registeredRequest);
                return;
-
-       }
 #if defined(_D2D_INTERNAL_ACL_)
-       else if (!strcmp(CONV_ACCESS_CONTROL_PASSCODE_REQUEST, accessControlResult)) {
+       else if (!strcmp(CONV_ACCESS_CONTROL_PASSCODE_REQUEST, accessControlResult)) {
                _D("__on_access_response PASSCODE REQUEST");
                conv::acl_manager::LaunchPasscodeInputPopup(passcode_popup_callback, svcInfo);
                return;
@@ -597,10 +593,8 @@ static void __on_access_response(iotcon_remote_resource_h resource, iotcon_error
                svcInfo->accessControlState = ACCESS_CONTROL_STATE_DENIED;
                sendResponse(result, CONV_JSON_ON_START, CONV_ERROR_INVALID_OPERATION, svcInfo->registeredRequest);
                return;
-
-       }
 #endif
-       else {
+       else {
                _D("__on_access_response DENIED");
                conv::Json result;
                svcInfo->accessControlState = ACCESS_CONTROL_STATE_DENIED;
@@ -671,7 +665,7 @@ int conv::RemoteAppControlServiceProvider::startRequest(Request* requestObj)
 
        iotcon_resource_interfaces_add(resource_ifaces, IOTCON_INTERFACE_DEFAULT);
 
-       error = iotcon_remote_resource_create(svcInfo->iotconInfoObj.address.c_str(), IOTCON_CONNECTIVITY_IPV4, svcInfo->iotconInfoObj.uri.c_str(), properties, resource_types, resource_ifaces,
+       error = iotcon_remote_resource_create(svcInfo->iotconInfoObj.address.c_str(), IOTCON_CONNECTIVITY_IPV4_ONLY, svcInfo->iotconInfoObj.uri.c_str(), properties, resource_types, resource_ifaces,
                        &(svcInfo->iotconInfoObj.iotconResourceHandle));
 
        _D("remote resource created : %s, %s", svcInfo->iotconInfoObj.address.c_str(), svcInfo->iotconInfoObj.uri.c_str());