X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fbluetooth-app-control%2FBluetoothAppControlDllEntry.cpp;h=3a7bea06a2fe23861b81a4f787c85ea8b2b1e5d9;hb=e3b9869fde72cd993b6cbf7dbc99fd85cc95b7a1;hp=f156682317e9624a0781fd32bbee87c0164006d7;hpb=4eaf9e46032abb60a8ea418751ac5d81d8fbf6f1;p=platform%2Fframework%2Fnative%2Fapp-controls.git diff --git a/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp b/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp index f156682..3a7bea0 100755 --- a/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp +++ b/src/bluetooth-app-control/BluetoothAppControlDllEntry.cpp @@ -54,19 +54,19 @@ void OnAppControlResult(void*, int, service_result_e, void*); static int __req = -1; static int __processId = -1; -static const wchar_t __allowedAppControlTable[][2][64] = +static const char __allowedAppControlTable[][2][96] = { - {L"osp.appcontrol.BT", L"osp.appcontrol.operation.PICK"}, - {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"}, + {"osp.appcontrol.BT", "osp.appcontrol.operation.PICK"}, + {"osp.appcontrol.provider.bluetooth", "osp.appcontrol.operation.pick"}, + {"tizen.bluetooth", "http://tizen.org/appcontrol/operation/pick"}, + {"tizen.bluetooth", "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; @@ -83,10 +83,13 @@ StartAppControl(int req, const String& aId, const String& oId, const String* pUr msg.AddData(pMap); msg.AddData(L"launch-type", L"pick"); - __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0); + const String& package = _AppControlManager::GetAliasAppId(aId); + SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer()); + + __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pUri, pMime, 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; @@ -113,71 +116,123 @@ OnAppControlResult(void* b, int requestCode, service_result_e res, void* userDat int minClassType = 0; int svcClassType = 0; unsigned long svcType = 0; + int result = SERVICE_RESULT_SUCCEEDED; + const char* pBuf; HashMap* pResult = new (std::nothrow) HashMap(); SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure."); r = pResult->Construct(); - switch (res) + pBuf = appsvc_get_data(pBundle, "result"); + if (strcmp(pBuf, "success") == 0) + { + result = SERVICE_RESULT_SUCCEEDED; + } + else + { + result = SERVICE_RESULT_FAILED; + } + + SysLog(NID_APP, "The service result %s", result == SERVICE_RESULT_SUCCEEDED? "succeeded." : "failed."); + + switch (result) { case SERVICE_RESULT_SUCCEEDED: { - const char* pBuf = appsvc_get_data(pBundle, "address"); + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/address"); if (pBuf) { + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/address")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/address"), new (std::nothrow) String(pBuf)); + pResult->Remove(String(L"addr_val")); pResult->Add(new (std::nothrow) String(L"addr_val"), new (std::nothrow) String(pBuf)); } - pBuf = appsvc_get_data(pBundle, "name"); + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/name"); if (pBuf) { + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/name")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/name"), new (std::nothrow) String(pBuf)); + pResult->Remove(String(L"dev_name")); pResult->Add(new (std::nothrow) String(L"dev_name"), new (std::nothrow) String(pBuf)); } - pBuf = appsvc_get_data(pBundle, "major_class"); + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/rssi"); + if (pBuf) + { + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/rssi")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/rssi"), new (std::nothrow) String(pBuf)); + } + + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/is_paired"); + if (pBuf) + { + if (*pBuf == '1') + { + pBuf = "true"; + } + else + { + pBuf = "false"; + } + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/is_paired")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/is_paired"), new (std::nothrow) String(pBuf)); + } + + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/major_class"); if (pBuf) { Integer::Decode(String(pBuf), majClassType); majClassType = (int)_BluetoothAdapterUtility::ConvertToMajorDeviceClassType((bt_major_device_class_e)majClassType); + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/major_class")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/major_class"), new (std::nothrow) String(Integer::ToString(majClassType))); + pResult->Remove(String(L"maj_cls_type")); pResult->Add(new (std::nothrow) String(L"maj_cls_type"), new (std::nothrow) String(Integer::ToString(majClassType))); } - pBuf = appsvc_get_data(pBundle, "minor_class"); + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/minor_class"); if (pBuf) { Integer::Decode(String(pBuf), minClassType); minClassType = (int)_BluetoothAdapterUtility::ConvertToMinorDeviceClassType((bt_major_device_class_e)majClassType, (bt_minor_device_class_e)minClassType); + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/minor_class")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/minor_class"), new (std::nothrow) String(Integer::ToString(minClassType))); + pResult->Remove(String(L"min_cls_type")); pResult->Add(new (std::nothrow) String(L"min_cls_type"), new (std::nothrow) String(Integer::ToString(minClassType))); } - pBuf = appsvc_get_data(pBundle, "service_class"); + pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/service_class"); if (pBuf) { Integer::Decode(String(pBuf), svcClassType); svcClassType = (int)_BluetoothAdapterUtility::ConvertToServiceClassList(svcClassType); + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/service_class")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/service_class"), new (std::nothrow) String(Integer::ToString(svcClassType))); + pResult->Remove(String(L"svc_cls_type")); pResult->Add(new (std::nothrow) String(L"svc_cls_type"), new (std::nothrow) String(Integer::ToString(svcClassType))); } int len = 0; - char** ppArrayBuf = (char**)appsvc_get_data_array(pBundle, "uuids", &len); + char** ppArrayBuf = (char**)appsvc_get_data_array(pBundle, "http://tizen.org/appcontrol/data/bluetooth/uuid_list", &len); + ArrayList* pUuidList = null; + if (len > 0 && ppArrayBuf != null) { svcType = _BluetoothAdapterUtility::ConvertToServiceList(ppArrayBuf, len); - for (int i = 0; i < len; i++) - { - if (ppArrayBuf[i]) - { - free(ppArrayBuf[i]); - } - } - free(ppArrayBuf); - } + pUuidList = dynamic_cast(_BluetoothAdapterUtility::ConvertServiceUuidListN(ppArrayBuf, len)); + + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/service_type")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/service_type"), new (std::nothrow) String(Long::ToString(svcType))); + pResult->Remove(String(L"svc_type")); + pResult->Add(new (std::nothrow) String(L"svc_type"), new (std::nothrow) String(Long::ToString(svcType))); - pResult->Add(new (std::nothrow) String(L"svc_type"), new (std::nothrow) String(Long::ToString(svcType))); + pResult->Remove(String(L"http://tizen.org/appcontrol/data/bluetooth/uuid_list")); + pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/uuid_list"), pUuidList); + } } break; case SERVICE_RESULT_FAILED: @@ -188,7 +243,7 @@ OnAppControlResult(void* b, int requestCode, service_result_e res, void* userDat break; } - _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult); + _AppControlManager::GetInstance()->FinishAppControl(__req, result, pResult); CATCH: __req = -1;