private:
result InitializeAppIdList(void);
- result SetSelectedMessageAppId(const Tizen::Base::String& appId);
public:
- static const wchar_t* _SELECTED_APP_ID_NONE;
static const wchar_t* _META_DATA_DB_NAME;
static const wchar_t* _PUSH_MESSAGE_DIRECTORY;
static const wchar_t* _PUSH_MESSAGE_EXT_NAME;
SysTryReturn(NID_NET, pNetIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
unique_ptr<WifiConnectivityIpcStub> pWifiIpcStub(new (std::nothrow) WifiConnectivityIpcStub);
- SysTryReturn(NID_NET_WIFI, pWifiIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
+ SysTryReturn(NID_NET, pWifiIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
unique_ptr<NfcConnectivityIpcStub> pNfcIpcStub(new (std::nothrow) NfcConnectivityIpcStub);
SysTryReturn(NID_NET_NFC, pNfcIpcStub != null, false, E_OUT_OF_MEMORY, "The memory is insufficient.");
SysTryReturn(NID_NET, r == E_SUCCESS, false, r, "Construction of NetConnectivityIpcStub has failed.");
r = pWifiIpcStub->Construct();
- SysTryReturn(NID_NET_WIFI, r == E_SUCCESS, false, r, "Construction of WifiConnectivityIpcStub has failed.");
+ SysTryReturn(NID_NET, r == E_SUCCESS, false, r, "Construction of WifiConnectivityIpcStub has failed.");
r = pNfcIpcStub->Construct();
SysTryReturn(NID_NET_NFC, r == E_SUCCESS, false, r, "Construction of NfcConnectivityIpcStub has failed.");
SysLog(NID_NET_NFC, "Received the request of activating the NFC Reserved Push with clientId : %d, AppPkgId : %ls",
__pIpcServer->GetClientId(), packageId.GetPointer());
- *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/* *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
if (*pResult != E_SUCCESS)
{
SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
"[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
}
- else if (__pNfcService == null)
+ else */if (__pNfcService == null)
{
*pResult = E_SYSTEM;
}
SysLog(NID_NET_NFC, "Received the request of deactivating the NFC Reserved Push with clientId : %d, AppPkgId : %ls",
__pIpcServer->GetClientId(), packageId.GetPointer());
- *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/* *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
if (*pResult != E_SUCCESS)
{
SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
"[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
}
- else if (__pNfcService == null)
+ else */if (__pNfcService == null)
{
*pResult = E_SYSTEM;
}
SysLog(NID_NET_NFC, "Received the request of picking the NFC Reserved Push message with clientId : %d, AppPkgId : %ls",
__pIpcServer->GetClientId(), packageId.GetPointer());
- *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
+/* *pResult = _AccessController::CheckSystemPrivilege(packageId, _PRV_NFCMANAGER);
if (*pResult != E_SUCCESS)
{
SysLogException(NID_NET_NFC, E_PRIVILEGE_DENIED,
"[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
}
- else if (__pNfcService == null)
+ else */if (__pNfcService == null)
{
*pResult = E_SYSTEM;
}
pAppIdStr.reset(vconf_get_str(VCONFKEY_NFC_PREDEFINED_ITEM));
SysTryReturn(NID_NET_NFC, pAppIdStr != null, L"", E_SYSTEM, "[E_SYSTEM] Failed to get the selected app ID from vconf.");
- String selectedAppId(pAppIdStr.get());
- SysTryReturn(NID_NET_NFC, selectedAppId != String(NfcMessageRegisterService::_SELECTED_APP_ID_NONE), L"", E_OBJ_NOT_FOUND,
- "[E_OBJ_NOT_FOUND] No element in the candidate list.");
-
- return selectedAppId;
+ return String(pAppIdStr.get()); // free 'pSelectedItem' after return
}
result
#include <FBaseRtMutexGuard.h>
#include <FBaseColHashMap.h>
#include <FAppPkgPackageInfo.h>
-#include <FAppPkgPackageAppInfo.h>
#include <FIoFile.h>
#include <FIoDbStatement.h>
#include <FIoDbEnumerator.h>
#include <FAppPkg_PackageManagerImpl.h>
-#include <FAppPkg_PackageAppInfoImpl.h>
#include <FBase_StringConverter.h>
#include "NfcMessageRegisterService.h"
using namespace Tizen::App::Package;
using namespace Tizen::Io;
-const wchar_t* NfcMessageRegisterService::_SELECTED_APP_ID_NONE = L"None";
const wchar_t* NfcMessageRegisterService::_META_DATA_DB_NAME = L"/opt/usr/dbspace/.net-nfcpush.db";
const wchar_t* NfcMessageRegisterService::_PUSH_MESSAGE_DIRECTORY = L"/opt/usr/share/nfcpush/";
const wchar_t* NfcMessageRegisterService::_PUSH_MESSAGE_EXT_NAME = L".ndef";
String msgFilePath;
unique_ptr<DbStatement> pInsertStmt;
unique_ptr<DbEnumerator> pInsertEnum;
- unique_ptr<PackageInfo> pPackageInfo;
- unique_ptr<PackageAppInfo> pPackageAppInfo;
+ PackageInfo* pPackageInfo = null;
String appName;
String appIconPath;
msgFilePath = _PUSH_MESSAGE_DIRECTORY + appPkgId + _PUSH_MESSAGE_EXT_NAME;
// get the app name and icon path from the package manager
- pPackageInfo.reset(_PackageManagerImpl::GetInstance()->GetPackageInfoN(appPkgId));
+ pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(appPkgId);
SysTryReturnResult(NID_NET_NFC, pPackageInfo != null, E_SYSTEM, "Getting package information has failed.");
- pPackageAppInfo.reset(pPackageInfo->GetPackageAppInfoN(pPackageInfo->GetMainAppId()));
- SysTryReturnResult(NID_NET_NFC, pPackageInfo != null, E_SYSTEM, "Getting package app information has failed.");
-
appName = pPackageInfo->GetDisplayName();
- appIconPath = _PackageAppInfoImpl::GetInstance(pPackageAppInfo.get())->GetAppMenuIconPath();
+ //appIconPath = packageInfo.GetAppIconPath();
+
+ delete pPackageInfo;
MutexGuard locked(__listMutex);
// Modify vconf - the selected item - value if the new message (appPkgId) becomes the first element of the list
if (__reserverList.GetCount() == 1)
{
- r = SetSelectedMessageAppId(appPkgId);
+ r = PickReservedPushMessage(appPkgId);
SysTryReturnResult(NID_NET_NFC, r == E_SUCCESS, r, "Propagating.");
}
}
if (appPkgId.Equals(String(pSelectedAppIdStr.get())))
{
- String newAppId(_SELECTED_APP_ID_NONE); // Especially, if no more element in the list, set the default value
+ String newAppId(L"None"); // Especially, if no more element in the list, set the value by "None"
if (__reserverList.GetCount() > 0)
{
__reserverList.GetAt(0, newAppId); // Ignore the result
}
- r = SetSelectedMessageAppId(newAppId);
+ r = PickReservedPushMessage(newAppId);
SysTryReturnResult(NID_NET_NFC, r == E_SUCCESS, r, "Propagating.");
}
}
result
NfcMessageRegisterService::PickReservedPushMessage(const Tizen::Base::String& ownerAppId)
{
- // check the owner application ID exists in the candidate list
- SysTryReturnResult(NID_NET_NFC, __reserverList.Contains(ownerAppId) == true, E_OBJ_NOT_FOUND,
- "The specified application ID is not found in the candidate list.");
-
- return SetSelectedMessageAppId(ownerAppId);
-}
-
-result
-NfcMessageRegisterService::SetSelectedMessageAppId(const Tizen::Base::String& appId)
-{
int vconfRes = -1;
unique_ptr<char, _CharDeleter> pAppIdStr;
- pAppIdStr.reset(_StringConverter::CopyToCharArrayN(appId));
+ pAppIdStr.reset(_StringConverter::CopyToCharArrayN(ownerAppId));
SysTryReturnResult(NID_NET_NFC, pAppIdStr != null, E_SYSTEM, "Failed to set the selected App ID to vconf.");
// set the value for the predefined item