2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file AppControlDllEntry.cpp
20 * @brief This is the implementation for the AppControlDllEntry.cpp class.
23 #include <appsvc/appsvc.h>
25 #include <FBaseSysLog.h>
26 #include <FBaseColHashMap.h>
27 #include <FAppAppControl.h>
29 #include <FBase_StringConverter.h>
30 #include <FApp_AppControlManager.h>
31 #include <FApp_AppMessageImpl.h>
32 #include <FApp_AppArg.h>
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
45 result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
46 result _OSP_EXPORT_ TerminateAppControl(int req);
47 static void OnAppControlResult(void*, int, service_result_e, void*);
49 static int __req = -1;
52 StartAppControl(int req, const String& aId, const String& operationId, const String* pUri, const String* pMime, const IMap* pMap)
54 SysLog(NID_APP, "StartAppControl: Entry to Call AppControl");
60 const String* pActualUri = pUri;
67 // if there is not pUri, then search for "url" key.
68 String data = msg.GetValue(L"tel");
75 data = msg.GetValue(L"type");
78 msg.AddData(L"http://tizen.org/appcontrol/data/call/type", data);
79 msg.RemoveData(L"type");
83 bool noResult = (operationId == L"http://tizen.org/appcontrol/operation/call"
84 || operationId == L"http://tizen.org/appcontrol/operation/dial");
86 const String& package = _AppControlManager::GetAliasAppId(aId);
87 SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
90 int pid = _AppControlManager::GetInstance()->Launch(msg, package, operationId, pActualUri, pMime, (noResult) ? NULL : OnAppControlResult, 0);
94 SysLog(NID_APP, "[%s] System error.", GetErrorMessage(r));
97 SysLog(NID_APP, "StartAppControl: Launching Call AppControl succeeded");
103 TerminateAppControl(int req)
109 OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
111 SysLog(NID_APP, "Received request %d.", requestCode);
114 bundle* pBundle = static_cast<bundle*>(b);
116 HashMap* pResult = new (std::nothrow) HashMap();
117 SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
119 r = pResult->Construct();
121 _AppArg::SetArgMap(pBundle, pResult);
123 _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);