Add uuid_list
authordukan.kim <dukan.kim@samsung.com>
Wed, 3 Apr 2013 07:49:27 +0000 (16:49 +0900)
committerdukan.kim <dukan.kim@samsung.com>
Wed, 3 Apr 2013 07:49:27 +0000 (16:49 +0900)
Change-Id: Ia2287b4ffccd45954d249c0421d333f557ed697a
Signed-off-by: dukan.kim <dukan.kim@samsung.com>
src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp

index 25c829c..8fb7f39 100755 (executable)
@@ -60,13 +60,14 @@ static const wchar_t __allowedAppControlTable[][2][64] =
        {L"osp.appcontrol.provider.bluetooth", L"osp.appcontrol.operation.pick"},
        {L"http://tizen.org/appcontrol/provider/bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
        {L"tizen.bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
+       {L"tizen.bluetooth", L"http://tizen.org/appcontrol/operation/bluetooth/pick"},
 };
 
 
 result
 StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
 {
-       SysLog(NID_APP, "StartAppControl: Entry to Bluetooth AppControl");
+       SysLog(NID_APP, "Entry to Bluetooth AppControl");
 
        result r = E_SUCCESS;
        bool isBtSupported = false;
@@ -75,7 +76,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
        r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/network.bluetooth", isBtSupported);
        SysTryReturnResult(NID_APP, (r == E_SUCCESS) && (isBtSupported == true), E_SYSTEM, "[%s] Bluetooth is not supported.", GetErrorMessage(r));
 
-       const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
+       const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 5, aId, oId);
        SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
 
        SysLog(NID_APP, "Bluetooth AppControl.");
@@ -86,7 +87,7 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr
        __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
 
        SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Bluetooth AppControl is failed.");
-       SysLog(NID_APP, "StartAppControl: Launching Bluetooth AppControl succeeded.");
+       SysLog(NID_APP, "Launching Bluetooth AppControl succeeded.");
 
        __req = req;
 
@@ -131,6 +132,8 @@ OnAppControlResult(void* b, int requestCode, service_result_e res, void* userDat
                result = SERVICE_RESULT_FAILED;
        }
 
+       SysLog(NID_APP, "The service result %s", result == SERVICE_RESULT_SUCCEEDED? "succeeded." : "failed.");
+
        switch (result)
        {
        case SERVICE_RESULT_SUCCEEDED:
@@ -196,11 +199,12 @@ OnAppControlResult(void* b, int requestCode, service_result_e res, void* userDat
 
                        int len = 0;
                        char** ppArrayBuf = (char**)appsvc_get_data_array(pBundle, "uuids", &len);
+                       ArrayList* pUuidList = null;
 
-                       // TODO: Parsing routine for uuid_list should be added.
                        if (len > 0 && ppArrayBuf != null)
                        {
                                svcType = _BluetoothAdapterUtility::ConvertToServiceList(ppArrayBuf, len);
+                               pUuidList = dynamic_cast<ArrayList*>(_BluetoothAdapterUtility::ConvertServiceUuidListN(ppArrayBuf, len));
                                for (int i = 0; i < len; i++)
                                {
                                        if (ppArrayBuf[i])
@@ -209,10 +213,10 @@ OnAppControlResult(void* b, int requestCode, service_result_e res, void* userDat
                                        }
                                }
                                free(ppArrayBuf);
-                       }
 
-                       // TODO: the uuid_list value should be added to pResult.
-                       pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/service_type"), new (std::nothrow) String(Long::ToString(svcType)));
+                               pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/service_type"), new (std::nothrow) String(Long::ToString(svcType)));
+                               pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/uuid_list"), pUuidList);
+                       }
                }
                break;
        case SERVICE_RESULT_FAILED: