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 FApp_MapDataControlImpl.cpp
20 * @brief This is the implementation for the %_MapDataControlImpl class.
25 #include <unique_ptr.h>
27 #include <appsvc/appsvc.h>
29 #include <FBaseInteger.h>
30 #include <FBaseString.h>
31 #include <FBaseRtIEventArg.h>
32 #include <FAppMapDataControl.h>
33 #include <FAppIMapDataControlResponseListener.h>
35 #include <FBaseSysLog.h>
37 #include "FApp_AppControlManager.h"
38 #include "FApp_MapDataControlImpl.h"
39 #include "FApp_AppArg.h"
40 #include "FApp_DataControlManager.h"
44 using namespace Tizen::Base;
45 using namespace Tizen::Base::Collection;
46 using namespace Tizen::Base::Runtime;
47 using namespace Tizen::App;
48 using namespace Tizen::Io;
50 namespace Tizen { namespace App
53 static const int MAX_REQUEST_COUNT = 128;
54 static const int _MAX_ARGUMENT_SIZE = 16384; // 16KB
56 class _MapDataControlEventArg
60 _MapDataControlEventArg(_DataControlRequestType requestType, RequestId reqId, String providerId, String dataId,
61 IList* pResultValueList, bool providerResult, String* pErrorMsg)
62 : __requestType(requestType)
64 , __providerId(providerId)
66 , __pResultValueList(pResultValueList)
67 , __providerResult(providerResult)
68 , __pErrorMsg(pErrorMsg)
71 ~_MapDataControlEventArg(void)
73 if (__pResultValueList)
75 __pResultValueList->RemoveAll(true);
76 delete __pResultValueList;
81 _DataControlRequestType __requestType;
85 IList* __pResultValueList;
86 bool __providerResult;
90 class _MapDataControlEvent
94 virtual void FireImpl(IEventListener& listener, const IEventArg& arg);
98 _MapDataControlEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
100 const _MapDataControlEventArg* pArg = dynamic_cast<const _MapDataControlEventArg*>(&arg);
103 IMapDataControlResponseListener* pListener = dynamic_cast<IMapDataControlResponseListener*> (&listener);
104 if (pListener != null)
106 switch (pArg->__requestType)
108 case _DATACONTROL_REQUEST_TYPE_MAP_QUERY:
109 pListener->OnMapDataControlGetValueResponseReceived(pArg->__reqId, pArg->__providerId, pArg->__dataId,
110 *(pArg->__pResultValueList), pArg->__providerResult, pArg->__pErrorMsg);
112 case _DATACONTROL_REQUEST_TYPE_MAP_INSERT:
113 pListener->OnMapDataControlAddValueResponseReceived(pArg->__reqId, pArg->__providerId, pArg->__dataId,
114 pArg->__providerResult, pArg->__pErrorMsg);
116 case _DATACONTROL_REQUEST_TYPE_MAP_UPDATE:
117 pListener->OnMapDataControlSetValueResponseReceived(pArg->__reqId, pArg->__providerId, pArg->__dataId,
118 pArg->__providerResult, pArg->__pErrorMsg);
120 case _DATACONTROL_REQUEST_TYPE_MAP_DELETE:
121 pListener->OnMapDataControlRemoveValueResponseReceived(pArg->__reqId, pArg->__providerId, pArg->__dataId,
122 pArg->__providerResult, pArg->__pErrorMsg);
132 _MapDataControlImpl::_MapDataControlImpl(void)
135 , __access(_DATACONTROL_ACCESS_UNDEFINED)
136 , __pPreviousListener(null)
137 , __pMapDataControlEvent(null)
141 _MapDataControlImpl::~_MapDataControlImpl(void)
143 delete __pMapDataControlEvent;
147 _MapDataControlImpl::GetInstance(MapDataControl& dc)
149 return dc.__pMapDataControlImpl;
152 const _MapDataControlImpl*
153 _MapDataControlImpl::GetInstance(const MapDataControl& dc)
155 return dc.__pMapDataControlImpl;
159 _MapDataControlImpl::StartMapDataControl(int type, const IList* pDataList, int* pReq)
161 Integer* pReqId = null;
162 _DataControlRequestInfo* pReqInfo = null;
163 result r = E_SUCCESS;
166 _AppControlManager* pAppManagerImpl = _AppControlManager::GetInstance();
168 // Check the request count of DataControl operation
169 int count = pAppManagerImpl->GetLaunchRequestCount();
170 SysLog(NID_APP, "Current launch request count: %d", count);
172 SysTryReturnResult(NID_APP, count < MAX_REQUEST_COUNT, E_MAX_EXCEEDED, "The number of requests has exceeded the maximum limit.");
174 _AppArg* pArg = new(std::nothrow) _AppArg; // XXX: pArg will be released in _AppManagerImpl::LaunchApp().
175 SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
177 pArg->Construct(*this, static_cast <_DataControlRequestType>(type), pDataList);
179 if (__pMapDataControlEvent)
181 // reqId is system-wide id because the bundle is system-wide.
183 _AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, MapDataControlCallback, __pMapDataControlEvent, -1);
184 req = reqObj.GetRequestNumber();
186 _DataControlManager* pDcMgr = _DataControlManager::GetInstance();
187 _AppControlManager::_RequestGuard reqObj = _AppControlManager::_RequestGuard(*pAppManagerImpl, pArg, MapDataControlCallback, pDcMgr, -1);
188 req = reqObj.GetRequestNumber();
190 pReqId = new (std::nothrow) Integer(req);
191 SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
192 "[E_OUT_OF_MEMORY] The memory is insufficient");
194 pReqInfo = new (std::nothrow) _DataControlRequestInfo(__pMapDataControlEvent);
195 SysTryCatch(NID_APP, pReqId != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
196 "[E_OUT_OF_MEMORY] The memory is insufficient");
198 r = pDcMgr->AddRequestInfo(pReqId, pReqInfo);
199 SysTryCatch(NID_APP, !IsFailed(r), r = E_SYSTEM, E_SYSTEM, "[%s] Failed to add request info", GetErrorMessage(r));
201 r = pAppManagerImpl->LaunchApp(__appId, pArg, req);
204 SysPropagate(NID_APP, r);
206 pDcMgr->RemoveRequestInfo(*pReqId);
218 r = pAppManagerImpl->LaunchApp(__appId, pArg);
219 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
233 _MapDataControlImpl::GetValue(const String& dataId, const String& key,
234 RequestId& reqId, int pageNo, int countPerPage)
236 SysTryReturnResult(NID_APP, pageNo > 0, E_INVALID_ARG, "The specified pageNo parameter is less than 1");
237 SysTryReturnResult(NID_APP, countPerPage > 0, E_INVALID_ARG, "The specified countPerPage parameter is less than 1");
238 SysTryReturnResult(NID_APP, (__access & _DATACONTROL_ACCESS_READ) > 0, E_ILLEGAL_ACCESS,
239 "The GetValue query is not permitted by DataControl provider.");
241 String* pPageNo = null;
242 String* pCountPerPage = null;
244 result r = E_SUCCESS;
246 ArrayList* pArgList = new ArrayList();
247 pArgList->Construct();
249 pArgList->Add(*(new String(dataId)));
250 pArgList->Add(*(new String(key)));
251 long long argSize = dataId.GetLength() * sizeof(wchar_t);
252 argSize += key.GetLength() * sizeof(wchar_t);
253 SysTryCatch(NID_APP, argSize <= _MAX_ARGUMENT_SIZE, r = E_MAX_EXCEEDED, E_MAX_EXCEEDED,
254 "[E_MAX_EXCEEDED] The size of sending argument (%d) exceeds the maximum limit.", argSize);
256 pPageNo = new (std::nothrow) String();
257 pPageNo->Append(pageNo);
258 pArgList->Add(*pPageNo);
260 pCountPerPage = new (std::nothrow) String();
261 pCountPerPage->Append(countPerPage);
262 pArgList->Add(*pCountPerPage);
264 r = StartMapDataControl(_DATACONTROL_REQUEST_TYPE_MAP_QUERY, pArgList, &id);
265 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
267 reqId = static_cast< RequestId >(id);
269 SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, reqId: %d, pageNo: %d, countPerPage: %d",
270 dataId.GetPointer(), key.GetPointer(), reqId, pageNo, countPerPage);
274 pArgList->RemoveAll(true);
281 _MapDataControlImpl::MapDataControlCallback(void* data, _AppArg* pArg, _AppArg* pResArg, service_result_e res, int prop)
283 ArrayList* pResultList = null;
284 String* pResult = null;
285 String* pProviderId = null;
286 String* pDataId = null;
287 String* pErrorMessage = null;
288 String* pErrorMsg = null;
289 String* pResultCount = null;
290 String* pValue = null;
291 ArrayList* pResultValueList = null;
296 bool providerResult = true;
297 //bundle* origBundle = null;
298 bundle* resBundle = null;
299 _MapDataControlEventArg* pEventArg = null;
300 result r = E_SUCCESS;
302 SysTryReturnResult(NID_APP, pResArg != null, E_INVALID_ARG, "Empty result callback.");
303 SysLog(NID_APP, "appsvc result value: %d", res);
305 resBundle = pResArg->GetBundle();
308 const char* p = appsvc_get_data(resBundle, OSP_K_REQUEST_ID);
309 SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
313 _DataControlManager* pDcMgr = static_cast< _DataControlManager* >(data);
314 _DataControlRequestInfo* pReqInfo = pDcMgr->GetRequestInfo(key);
315 SysTryCatch(NID_APP, pReqInfo != null, r = E_SYSTEM, E_SYSTEM,
316 "[E_SYSTEM] Failed to get request info");
318 _MapDataControlEvent* pMapDataControlEvent = dynamic_cast< _MapDataControlEvent* >(pReqInfo->GetEvent());
319 SysTryCatch(NID_APP, pMapDataControlEvent != null, r = E_SYSTEM, E_SYSTEM,
320 "[E_SYSTEM] invalid request info");
322 pDcMgr->RemoveRequestInfo(key);
324 if (pMapDataControlEvent != null && typeid(pMapDataControlEvent) == typeid(_MapDataControlEvent*))
328 pResultList = _AppArg::GetListN(resBundle, OSP_K_ARG);
329 SysTryCatch(NID_APP, pResultList, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
331 pResult = dynamic_cast <String*>(pResultList->GetAt(0)); // result list[0]
332 SysTryCatch(NID_APP, pResult, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
333 Integer::Parse(*pResult, providerRes);
334 providerResult = static_cast< bool >(providerRes);
336 pErrorMessage = dynamic_cast< String* >(pResultList->GetAt(1)); // result list[1]
337 SysTryCatch(NID_APP, pErrorMessage, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid result");
338 pErrorMsg = new (std::nothrow) String(*pErrorMessage);
339 SysTryCatch(NID_APP, pErrorMsg, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
340 "[E_OUT_OF_MEMORY] The memory is insufficient.");
343 //origBundle = pArg->GetBundle();
345 p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_REQUEST_TYPE);
346 SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
347 requestType = atoi(p);
349 p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_PROVIDER);
350 SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
351 pProviderId = new (std::nothrow) String(p);
352 SysTryCatch(NID_APP, pProviderId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
353 "[E_OUT_OF_MEMORY] The memory is insufficient.");
355 p = appsvc_get_data(resBundle, OSP_K_DATACONTROL_DATA);
356 SysTryCatch(NID_APP, p, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] invalid bundle");
357 pDataId = new (std::nothrow) String(p);
358 SysTryCatch(NID_APP, pDataId, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
359 "[E_OUT_OF_MEMORY] The memory is insufficient.");
361 SysLog(NID_APP, "[DC_CALLER_RECV] provider result: %ld, requestType: %d, reqId: %d, providerId: %ls, dataId: %ls, errorMsg: %ls ",
362 providerRes, requestType, reqId, pProviderId->GetPointer(), pDataId->GetPointer(), pErrorMsg->GetPointer());
364 switch (static_cast< _DataControlRequestType >(requestType))
366 case _DATACONTROL_REQUEST_TYPE_MAP_QUERY:
368 pResultValueList = new (std::nothrow) ArrayList();
369 SysTryCatch(NID_APP, pResultValueList, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
370 "[E_OUT_OF_MEMORY] The memory is insufficient.");
372 if (providerResult == true)
374 pResultCount = dynamic_cast< String* >(pResultList->GetAt(2)); // result list[2]
375 if (pResultCount == null)
377 SysLogException(NID_APP, E_SYSTEM, "[E_SYSTEM] invalid result");
378 pResultValueList->RemoveAll(true);
379 delete pResultValueList;
382 Integer::Parse(*pResultCount, resultCount);
387 pValue = dynamic_cast< String* >(pResultList->GetAt(index));
390 SysLogException(NID_APP, E_SYSTEM, "[E_SYSTEM] invalid result");
391 pResultValueList->RemoveAll(true);
392 delete pResultValueList;
396 pResultValueList->Add(*(new (std::nothrow) String(*pValue)));
402 pEventArg = new (std::nothrow) _MapDataControlEventArg(_DATACONTROL_REQUEST_TYPE_MAP_QUERY, static_cast <RequestId>(reqId),
403 *pProviderId, *pDataId, pResultValueList, providerResult, pErrorMsg);
404 SysTryCatch(NID_APP, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
405 pMapDataControlEvent->Fire(*pEventArg);
409 case _DATACONTROL_REQUEST_TYPE_MAP_INSERT:
411 pEventArg = new (std::nothrow) _MapDataControlEventArg(_DATACONTROL_REQUEST_TYPE_MAP_INSERT, static_cast <RequestId>(reqId),
412 *pProviderId, *pDataId, null, providerResult, pErrorMsg);
413 SysTryCatch(NID_APP, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
414 pMapDataControlEvent->Fire(*pEventArg);
417 case _DATACONTROL_REQUEST_TYPE_MAP_UPDATE:
419 pEventArg = new (std::nothrow) _MapDataControlEventArg(_DATACONTROL_REQUEST_TYPE_MAP_UPDATE, static_cast <RequestId>(reqId),
420 *pProviderId, *pDataId, null, providerResult, pErrorMsg);
421 SysTryCatch(NID_APP, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
422 pMapDataControlEvent->Fire(*pEventArg);
425 case _DATACONTROL_REQUEST_TYPE_MAP_DELETE:
427 pEventArg = new (std::nothrow) _MapDataControlEventArg(_DATACONTROL_REQUEST_TYPE_MAP_DELETE, static_cast <RequestId>(reqId),
428 *pProviderId, *pDataId, null, providerResult, pErrorMsg);
429 SysTryCatch(NID_APP, pEventArg != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
430 pMapDataControlEvent->Fire(*pEventArg);
437 pResultList->RemoveAll(true);
443 // Remove the request count
444 SysLog(NID_APP, "Remove a launch request: reqId: %d", reqId);
445 _AppControlManager::GetInstance()->RemoveLaunchRequest(reqId);
452 pResultList->RemoveAll(true);
461 _MapDataControlImpl::AddValue(const String& dataId, const String& key,
462 const String& value, RequestId& reqId)
464 SysTryReturnResult(NID_APP, (__access & _DATACONTROL_ACCESS_WRITE) > 0, E_ILLEGAL_ACCESS,
465 "The AddValue query is not permitted by DataControl provider.");
468 result r = E_SUCCESS;
470 ArrayList* pArgList = null;
471 pArgList = new ArrayList();
472 pArgList->Construct();
474 pArgList->Add(*(new String(dataId)));
475 pArgList->Add(*(new String(key)));
476 pArgList->Add(*(new String(value)));
477 long long argSize = dataId.GetLength() * sizeof(wchar_t);
478 argSize += key.GetLength() * sizeof(wchar_t);
479 argSize += value.GetLength() * sizeof(wchar_t);
480 SysTryCatch(NID_APP, argSize <= _MAX_ARGUMENT_SIZE, r = E_MAX_EXCEEDED, E_MAX_EXCEEDED,
481 "[E_MAX_EXCEEDED] The size of sending argument (%d) exceeds the maximum limit.", argSize);
483 r = StartMapDataControl(_DATACONTROL_REQUEST_TYPE_MAP_INSERT, pArgList, &id);
484 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
486 reqId = static_cast< RequestId >(id);
488 SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, value: %ls, reqId: %d",
489 dataId.GetPointer(), key.GetPointer(), value.GetPointer(), reqId);
493 pArgList->RemoveAll(true);
500 _MapDataControlImpl::SetValue(const String& dataId, const String& key,
501 const String& oldValue, const String& newValue, RequestId& reqId)
503 SysTryReturnResult(NID_APP, (__access & _DATACONTROL_ACCESS_WRITE) > 0, E_ILLEGAL_ACCESS,
504 "The SetValue query is not permitted by DataControl provider.");
507 result r = E_SUCCESS;
509 ArrayList* pArgList = null;
510 pArgList = new ArrayList();
511 pArgList->Construct();
513 pArgList->Add(*(new String(dataId)));
514 pArgList->Add(*(new String(key)));
515 pArgList->Add(*(new String(oldValue)));
516 pArgList->Add(*(new String(newValue)));
517 long long argSize = dataId.GetLength() * sizeof(wchar_t);
518 argSize += key.GetLength() * sizeof(wchar_t);
519 argSize += oldValue.GetLength() * sizeof(wchar_t);
520 argSize += newValue.GetLength() * sizeof(wchar_t);
521 SysTryCatch(NID_APP, argSize <= _MAX_ARGUMENT_SIZE, r = E_MAX_EXCEEDED, E_MAX_EXCEEDED,
522 "[E_MAX_EXCEEDED] The size of sending argument (%d) exceeds the maximum limit.", argSize);
524 r = StartMapDataControl(_DATACONTROL_REQUEST_TYPE_MAP_UPDATE, pArgList, &id);
525 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
527 reqId = static_cast< RequestId >(id);
529 SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, oldValue: %ls, newValue: %ls, reqId: %d",
530 dataId.GetPointer(), key.GetPointer(), oldValue.GetPointer(), newValue.GetPointer(), reqId);
534 pArgList->RemoveAll(true);
541 _MapDataControlImpl::RemoveValue(const String& dataId, const String& key,
542 const String& value, RequestId& reqId)
544 SysTryReturnResult(NID_APP, (__access & _DATACONTROL_ACCESS_WRITE) > 0, E_ILLEGAL_ACCESS,
545 "The RemoveValue query is not permitted by DataControl provider.");
548 result r = E_SUCCESS;
550 ArrayList* pArgList = null;
551 pArgList = new ArrayList();
552 pArgList->Construct();
554 pArgList->Add(*(new String(dataId)));
555 pArgList->Add(*(new String(key)));
556 pArgList->Add(*(new String(value)));
557 long long argSize = dataId.GetLength() * sizeof(wchar_t);
558 argSize += key.GetLength() * sizeof(wchar_t);
559 argSize += value.GetLength() * sizeof(wchar_t);
560 SysTryCatch(NID_APP, argSize <= _MAX_ARGUMENT_SIZE, r = E_MAX_EXCEEDED, E_MAX_EXCEEDED,
561 "[E_MAX_EXCEEDED] The size of sending argument (%d) exceeds the maximum limit.", argSize);
563 r = StartMapDataControl(_DATACONTROL_REQUEST_TYPE_MAP_DELETE, pArgList, &id);
564 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating to caller...", GetErrorMessage(r));
566 reqId = static_cast< RequestId >(id);
568 SysLog(NID_APP, "[DC_CALLER_SEND] dataId: %ls, key: %ls, value: %ls, reqId: %d",
569 dataId.GetPointer(), key.GetPointer(), value.GetPointer(), reqId);
573 pArgList->RemoveAll(true);
580 _MapDataControlImpl::SetMapDataControlResponseListener(IMapDataControlResponseListener* pListener)
582 result r = E_SUCCESS;
584 if (__pPreviousListener != null)
586 r = __pMapDataControlEvent->RemoveListener(*__pPreviousListener);
587 SysTryReturnResult(NID_APP, !IsFailed(r), E_SYSTEM, "Remove listener failed.");
588 __pPreviousListener = null;
591 if (pListener != null)
593 r = __pMapDataControlEvent->AddListener(*pListener);
598 case E_OBJ_ALREADY_EXIST:
600 case E_INVALID_OPERATION:
601 SysLogException(NID_APP, E_SYSTEM, "[E_SYSTEM] The thread setting the listener is worker thread.");
604 SysLogException(NID_APP, r, "[%s] Propagating to caller...", GetErrorMessage(r));
610 __pPreviousListener = pListener;
617 _MapDataControlImpl::CreateMapDataControl(const AppId& appId, const String& providerId, const String& access)
619 unique_ptr<MapDataControl> pDc(new (std::nothrow) MapDataControl);
620 SysTryReturn(NID_APP, pDc != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
622 _MapDataControlImpl* pDcImpl = _MapDataControlImpl::GetInstance(*pDc);
623 unique_ptr<_MapDataControlEvent> pMapDataControlEvent(new (std::nothrow) _MapDataControlEvent);
624 SysTryReturn(NID_IO, pMapDataControlEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
626 pDcImpl->__pMapDataControlEvent = pMapDataControlEvent.release();
627 pDcImpl->__appId = appId;
628 pDcImpl->__providerId = providerId;
630 if (access == L"readonly")
632 pDcImpl->__access = _DATACONTROL_ACCESS_READ;
634 else if (access == L"writeonly")
636 pDcImpl->__access = _DATACONTROL_ACCESS_WRITE;
638 else if (access == L"readwrite")
640 pDcImpl->__access = _DATACONTROL_ACCESS_READWRITE;
644 pDcImpl->__access = _DATACONTROL_ACCESS_UNDEFINED;
645 SysLog(NID_IO, "The accessibility of DataControl provider is invalid.");
648 return pDc.release();