BuildRequires: pkgconfig(capi-network-tethering)
BuildRequires: pkgconfig(capi-network-wifi)
BuildRequires: pkgconfig(capi-network-wifi-direct)
+BuildRequires: pkgconfig(wifi-direct)
BuildRequires: pkgconfig(capi-media-sound-manager)
BuildRequires: pkgconfig(sysman)
BuildRequires: pkgconfig(tapi)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(haptic)
-BuildRequires: pkgconfig(wifi-direct)
BuildRequires: pkgconfig(x11)
BuildRequires: privacy-manager-client-devel
BuildRequires: capi-security-privilege-manager-devel
SET (this_target osp-system-server)
INCLUDE_DIRECTORIES (
+ /usr/include/sysman
+ /usr/include/elementary-1
+ /usr/include/eet-1
+ /usr/include/ecore-1
+ /usr/include/evas-1
+ /usr/include/edje-1
+ /usr/include/e_dbus-1
+ /usr/include/efreet-1
+ /usr/include/ethumb-1
+ /usr/include/libxml
+ /usr/include/telephony
${SLP_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/inc
SET (${this_target}_SOURCE_FILES
system/FSys_SystemInfo.cpp
setting/FSys_SettingInfo.cpp
+ setting/providers/FSys_Icu.cpp
setting/providers/FSys_SettingApplicationProvider.cpp
setting/providers/FSys_SettingFontProvider.cpp
setting/providers/FSys_SettingGeneralProvider.cpp
setting/providers/FSys_SettingSpeechProvider.cpp
setting/providers/FSys_SettingStorageProvider.cpp
setting/providers/FSys_SettingVibrationProvider.cpp
- setting/providers/FSys_Icu.cpp
)
INCLUDE(FindPkgConfig)
pkg_check_modules(system_pkgs REQUIRED
- eina
- elementary
- haptic
- icu-i18n
- libxml-2.0
- vconf
- sysman
- tapi
- wifi-direct
- capi-media-sound-manager
- capi-network-bluetooth
+ capi-system-media-key
capi-network-tethering
+ capi-network-bluetooth
capi-network-wifi
- capi-system-device
- capi-system-info
- capi-system-media-key
- capi-system-runtime-info
- capi-system-system-settings
- capi-telephony-sim
+ capi-media-sound-manager
+ wifi-direct
)
FOREACH(flag ${system_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+FOREACH(ldflag ${system_pkgs_LDFLAGS})
+ SET(EXTRA_LDFLAGS "${EXTRA_LDFLAGS} ${flag}")
+ENDFOREACH(ldflag)
+
## SET EXTRA COMPILER FLAGS
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall" )
## Create Library
ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
-SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
-
TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
-TARGET_LINK_LIBRARIES(${this_target} ${system_pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(${this_target} capi-network-tethering)
+TARGET_LINK_LIBRARIES(${this_target} capi-network-bluetooth)
+TARGET_LINK_LIBRARIES(${this_target} capi-network-wifi)
+TARGET_LINK_LIBRARIES(${this_target} capi-media-sound-manager)
+TARGET_LINK_LIBRARIES(${this_target} wifi-direct)
SET_TARGET_PROPERTIES(${this_target}
PROPERTIES
public:
static _SettingInfo* GetInstance(void);
+
result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
result GetValue(const Tizen::Base::String& key, int& value);
result GetValue(const Tizen::Base::String& key, bool& value);
static const String _SETTING_SOUND_PROVIDER(L"sound");
static const String _SETTING_SPEECH_PROVIDER(L"speech");
static const String _SETTING_STORAGE_PROVIDER(L"storage");
-static const String _SETTING_VIBRATION_PROVIDER(L"vibration");
+static const String _SETTING_USB_PROVIDER(L"usb");
+static const String _SETTING_VIBRATION_PROVIDER(L"vibrator");
static const wchar_t* _SETTING_PREFIX = L"http://tizen.org/setting/";
_SettingNetworkProvider* networkProvider = new (std::nothrow) _SettingNetworkProvider();
RegisterProvider(_SETTING_NETWORK_PROVIDER, (_ISettingProvider*)networkProvider);
+ RegisterProvider(_SETTING_USB_PROVIDER, (_ISettingProvider*)networkProvider);
_SettingScreenProvider* screenProvider = new (std::nothrow) _SettingScreenProvider();
RegisterProvider(_SETTING_SCREEN_PROVIDER, (_ISettingProvider*)screenProvider);
_ISettingProvider* provider = null;
key.SubString(prefix.GetLength(), requiredKey);
- key.IndexOf(L".", 0, index);
- requiredKey.SubString(index, requiredKey);
+ requiredKey.IndexOf(L".", 0, index);
+ requiredKey.SubString(0, index, requiredKey);
+
result r = __settingProviderList.GetValue(requiredKey, provider);
if(r != E_SUCCESS || provider == null)
return provider->GetValue(key, value);
}
-bool HasKey(const String& key)
+bool
+_SettingInfo::HasKey(const String& key)
{
return false;
}
result
_SettingInfo::AnnounceSettingEvent(const String& key)
-{
+{
IEnumeratorT< ISettingEventListener*>* pEnum = __settingEventList.GetEnumeratorN();
SysTryReturnResult(NID_SYS, pEnum != null, E_SYSTEM, "It is failed to get event listener list.");
+ SysLog(NID_SYS, "Setting event[%ls] is occured.", key.GetPointer());
while(pEnum->MoveNext() == E_SUCCESS)
{
ISettingEventListener* pEventListener = null;
{
String eventKey = key;
pEventListener->OnSettingChanged(eventKey);
+
+ SysLog(NID_SYS, "Event is delivered to %x.", pEventListener);
+
}
}
{
_ISettingProvider* provider = GetProvider(key);
SysTryReturnResult(NID_SYS, provider != null, E_SYSTEM, "It is failed to find provider.");
- return provider->SetValueAsyncForPrivilegedKey(key, value, listener);
+ return provider->SetValueAsync(key, value, listener);
}
result
namespace Tizen { namespace System
{
+static const wchar_t* _DEVICE_NAME = L"http://tizen.org/setting/device_name";
-static const int _NUM_OF_GENERAL_PROVIDER = 6;
+static const wchar_t* _MOTION_UI = L"http://tizen.org/setting/motion.ui";
-static const wchar_t* _DEVICE_NAME = L"device_name";
-
-static const wchar_t* _MOTION_UI = L"motion.ui";
-
-static const wchar_t* _CONTACT_ORDER_FIRSTNAME = L"contacts.order.firstname";
+static const wchar_t* _CONTACT_ORDER_FIRSTNAME = L"http://tizen.org/setting/contacts.order.firstname";
static const int _CONTACT_ORDER_FIRSTNAME_FIRSTLAST = 0;
static const int _CONTACT_ORDER_FIRSTNAME_LASTFIRST = 1;
-static const wchar_t* _DEVELOPER_USBDEBUGGING = L"developer.usb_debugging";
+static const wchar_t* _DEVELOPER_USBDEBUGGING = L"http://tizen.org/setting/developer.usb_debugging";
-static const wchar_t* _BATTERY_FORMAT_PERCENTAGE = L"battery.format.percentage";
+static const wchar_t* _BATTERY_FORMAT_PERCENTAGE = L"http://tizen.org/setting/battery.format.percentage";
-static const wchar_t* _GRAPHICS_GPU_RENDERING = L"graphics.gpu.rendering";
+static const wchar_t* _GRAPHICS_GPU_RENDERING = L"http://tizen.org/setting/graphics.gpu.rendering";
static const char* _GRAPHICS_GPU_RENDERING_HW = "opengl_x11";
static const char* _GRAPHICS_GPU_RENDERING_SW = "software_x11";
_SettingInfo* pSettingInfo = _SettingInfo::GetInstance();
SysTryReturnVoidResult(NID_SYS, pSettingInfo != null, E_SYSTEM, "_SettingInfo is not ready.");
String settingKey;
+ SysLog(NID_SYS, "SettingEvent callback is called");
if(key == SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION)
{
static const int _LOCALE_WEEK_FORMAT_VCONF_MONDAY = 1;
//Timezone
-static const wchar_t* _LOCALE_TIMEZONE = L"locale.time_zone";
-static const wchar_t* _LOCALE_UPDATE_AUTO= L"locale.update.auto";
+static const wchar_t* _LOCALE_TIMEZONE = L"http://tizen.org/setting/locale.time_zone";
+static const wchar_t* _LOCALE_UPDATE_AUTO= L"http://tizen.org/setting/locale.update.auto";
static const char* _LOCALE_TIMEZONE_ROOT_PATH = "/usr/share/zoneinfo/";
static const char* _LOCALE_TIMEZONE_LINK = "/opt/etc/localtime";
static const int _LOCALE_TIMEZONE_ROOT_PATH_LENGTH = 20;
//Date time
-static const wchar_t* _LOCALE_DATE = L"locale.date";
-static const wchar_t* _LOCALE_TIME = L"locale.time";
-static const wchar_t* _LOCALE_DATETIME = L"locale.date_time";
+static const wchar_t* _LOCALE_DATE = L"http://tizen.org/setting/locale.date";
+static const wchar_t* _LOCALE_TIME = L"http://tizen.org/setting/locale.time";
+static const wchar_t* _LOCALE_DATETIME = L"http://tizen.org/setting/locale.date_time";
struct charDeleter
{
static const wchar_t* _SYSTEM_NETWORK_BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
-static const wchar_t* _NETWORK_RESULT_SUCCESS = L"osp.system.result.success";
-static const wchar_t* _NETWORK_RESULT_SYSTEM = L"osp.system.result.system";
-
struct charDeleter
{
void operator()(char* pValue)
__stateOfBluetooth = 1;
__pBluetoothListener = listener;
+ SysLog(NID_SYS, "Required bluetooth value is %d.", value);
if(value == true)
{
ret = bt_adapter_enable();
break;
case BT_ERROR_ALREADY_DONE:
+ SysLog(NID_SYS, "Bluetooth is already changed.");
+ SettingEventBluetooth(BT_ERROR_NONE, BT_ADAPTER_ENABLED, (void*)this);
+ break;
case BT_ERROR_NOT_ENABLED:
- SysLog(NID_SYS, "Bluetooth is already enabled.");
+ SysLog(NID_SYS, "Bluetooth is not enabled.");
SettingEventBluetooth(BT_ERROR_NONE, BT_ADAPTER_ENABLED, (void*)this);
break;
{
result r = E_SUCCESS;
String settingKey(_NETWORK_WIFI_DIRECT);
- String returnValue = _NETWORK_RESULT_SUCCESS;
_SettingNetworkProvider* pProvider = (_SettingNetworkProvider*)data;
_SettingInfo* pSettingInfo = _SettingInfo::GetInstance();
public:
result GetValue(const Tizen::Base::String& key, bool& value);
- //result SetValue(const Tizen::Base::String& key, const bool value);
result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
result GetValue(const Tizen::Base::String& key, int& value);
FSys_EnvironmentImpl.cpp
FSys_DeviceEventListenerContainer.cpp
FSys_SettingClient.cpp
+ FSys_SettingClientEx.cpp
FSys_SystemClient.cpp
)
--- /dev/null
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSys_SettingClientEx.cpp
+ * @brief This is the implementation file for _SettingClientEx class.
+ */
+
+#include <unique_ptr.h>
+
+#include <FBaseBoolean.h>
+#include <FBaseSysLog.h>
+
+#include <FApp_AppInfo.h>
+#include <FIo_AppServiceIpcMessages.h>
+
+#include "FSys_CommunicationDispatcherClient.h"
+#include "FSys_SettingClientEx.h"
+
+using namespace std;
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Io;
+
+namespace Tizen { namespace System
+{
+//MOTION
+static const wchar_t* _MOTION_UI = L"http://tizen.org/setting/motion.ui";
+static const wchar_t* _ENABLE_MOTION = L"EnableMotion";
+
+//Font
+static const wchar_t* _FONT_SIZE = L"http://tizen.org/setting/font.size";
+static const wchar_t* _FONTSIZE = L"FontSize";
+
+static const wchar_t* _FONT_TYPE = L"http://tizen.org/setting/font.type";
+static const wchar_t* _FONTTYPE = L"FontType";
+
+
+//Locale
+//Locale Country
+static const wchar_t* _LOCALE_COUNTRY = L"http://tizen.org/setting/locale.country";
+static const wchar_t* _COUNTRY = L"Country";
+
+//Locale Format
+static const wchar_t* _LOCALE_DATE_FORMAT = L"http://tizen.org/setting/locale.date.format";
+static const wchar_t* _DATE_FORMAT = L"DateFormat";
+
+static const wchar_t* _LOCALE_TIME_FORMAT = L"http://tizen.org/setting/locale.time.format";
+static const wchar_t* _TIME_FORMAT = L"TimeFormat";
+
+static const wchar_t* _LOCALE_TIME_FORMAT_24HOUR = L"http://tizen.org/setting/locale.time.format.24hour";
+static const wchar_t* _HOUR_FORMAT_SELECTED = L"24HourFormatSelected";
+
+//Locale Language
+static const wchar_t* _LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
+static const wchar_t* _LANGUAGE = L"Language";
+
+//Locale Time
+static const wchar_t* _LOCALE_DATETIME_FORMAT = L"http://tizen.org/setting/locale.date_time.format";
+static const wchar_t* _DATE_TIME_FORMAT = L"DateTimeFormat";
+
+
+//Location
+static const wchar_t* _LOCATION_GPS = L"http://tizen.org/setting/location.gps";
+static const wchar_t* _GPS_ENABLED = L"GPSEnabled";
+
+static const wchar_t* _LOCATION_WPS = L"http://tizen.org/setting/location.wps";
+static const wchar_t* _WPS_ENABLED = L"WPSEnabled";
+
+//Network
+static const wchar_t* _NETWORK_FLIGHTMODE = L"http://tizen.org/setting/network.flight_mode";
+static const wchar_t* _FLIGHT_MODE_ENABLED = L"FlightModeEnabled";
+
+//Network Telephony
+static const wchar_t* _NETWORK_TELEPHONY_PACKETSERVICE = L"http://tizen.org/setting/network.telephony.packet_service";
+static const wchar_t* _PACKET_SERVICE_ALLOWED = L"PacketServiceAllowed";
+
+static const wchar_t* _NETWORK_TELEPHONY_ROAMING = L"http://tizen.org/setting/network.telephony.roaming";
+static const wchar_t* _DATA_ROAMING_ENABLED = L"DataRoamingEnabled";
+
+//Screen
+static const wchar_t* _SCREEN_WALLPAPER = L"http://tizen.org/setting/screen.wallpaper";
+static const wchar_t* _WALLPAPER = L"Wallpaper";
+
+//Sound
+static const wchar_t* _SOUND_MEDIA_VOLUME = L"http://tizen.org/setting/sound.media.volume";
+static const wchar_t* _MEDIA_SOUND_VOLUME = L"MediaSoundVolume";
+
+static const wchar_t* _SOUND_NOTIFICATION_VOLUME = L"http://tizen.org/setting/sound.notification.volume";
+static const wchar_t* _NOTIFICATION_SOUND_VOLUME = L"NotificationSoundVolume";
+
+static const wchar_t* _SOUND_RINGTONE = L"http://tizen.org/setting/sound.ringtone";
+static const wchar_t* _RINGTONE = L"Ringtone";
+
+static const wchar_t* _SOUND_RINGTONE_VOLUME = L"http://tizen.org/setting/sound.ringtone.volume";
+static const wchar_t* _RINGTONE_SOUND_VOLUME = L"RingtoneSoundVolume";
+
+static const wchar_t* _SOUND_SYSTEM_VOLUME = L"http://tizen.org/setting/sound.system.volume";
+static const wchar_t* _SYSTEM_SOUND_VOLUME = L"SystemSoundVolume";
+
+static const wchar_t* _SOUND_SILENTMODE = L"http://tizen.org/setting/sound.silent_mode";
+static const wchar_t* _SILENT_MODE = L"SilentMode";
+
+//Vibration
+static const wchar_t* _TOUCH_VIBRATION_LEVEL = L"TouchVibrationLevel";
+static const wchar_t* _VIBRATOR_LEVEL = L"http://tizen.org/setting/vibrator.level";
+
+static const wchar_t* _SETTING_COMMAND_FACTORY_RESET = L"osp.setting.command.factory.reset";
+
+//USB
+static const wchar_t* _USBMODE = L"UsbMode";
+static const wchar_t* _USBMODE_MTP = L"MTP";
+
+const static wchar_t* SETTING_SERVICE_ID = L"osp.sys.ipcserver.setting_service";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_BOOL = L"osp.sys.ipcserver.setting_service.command.get.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_INT = L"osp.sys.ipcserver.setting_service.command.get.int";
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_STRING = L"osp.sys.ipcserver.setting_service.command.get.string";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_BOOL = L"osp.sys.ipcserver.setting_service.command.set.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_INT = L"osp.sys.ipcserver.setting_service.command.set.int";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_STRING = L"osp.sys.ipcserver.setting_service.command.set.string";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_BOOL = L"osp.sys.ipcserver.setting_service.command.set.priv.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_STRING = L"osp.sys.ipcserver.setting_service.command.set.priv.string";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_ASYNC_BOOL = L"osp.sys.ipcserver.setting_service.command.set.async.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_ASYNC_BOOL = L"osp.sys.ipcserver.setting_service.command.set.priv.async.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_RESULT = L"osp.sys.ipcserver.setting_service.command.result";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUBSCRIBE = L"osp.sys.ipcserver.setting_service.command.subscribe";
+const static wchar_t* SETTING_SERVICE_COMMAND_UNSUBSCRIBE = L"osp.sys.ipcserver.setting_service.command.unsubscribe";
+const static wchar_t* SETTING_SERVICE_COMMAND_EVENT = L"osp.sys.ipcserver.setting_service.command.event";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUPPORTED = L"osp.sys.ipcserver.setting_service.command.supported";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUBSCRIBE_INTERNAL = L"osp.sys.ipcserver.setting_service.command.subscribe.internal";
+const static wchar_t* SETTING_SERVICE_COMMAND_UNSUBSCRIBE_INTERNAL = L"osp.sys.ipcserver.setting_service.command.unsubscribe.internal";
+const static wchar_t* SETTING_SERVICE_COMMAND_EVENT_INTERNAL = L"osp.sys.ipcserver.setting_service.command.event.internal";
+
+const static int SETTING_SERVICE_IPC_MSG_COMMAND = 0;
+const static int SETTING_SERVICE_IPC_MSG_KEY = 1;
+const static int SETTING_SERVICE_IPC_MSG_VALUE = 2;
+const static int SETTING_SERVICE_IPC_MSG_RESULT = 1;
+
+const static wchar_t* _SETTING_RESULT_SUCCESS = L"E_SUCCESS";
+const static wchar_t* _SETTING_RESULT_INVALID_ARG = L"E_INVALID_ARG";
+const static wchar_t* _SETTING_RESULT_PRIVILEGE_DENIED = L"E_PRIVILEGE_DENIED";
+const static wchar_t* _SETTING_RESULT_UNSUPPORTED_OPERATION = L"E_UNSUPPORTED_OPERATION";
+const static wchar_t* _SETTING_RESULT_OBJ_NOT_FOUND = L"E_OBJ_NOT_FOUND";
+const static wchar_t* _SETTING_RESULT_OBJ_ALREADY_EXIST = L"E_OBJ_ALREADY_EXIST";
+const static wchar_t* _SETTING_RESULT_IN_PROGRESS = L"E_IN_PROGRESS";
+const static wchar_t* _SETTING_RESULT_SYSTEM = L"E_SYSTEM";
+
+_SettingClientEx* _SettingClientEx::__pSettingClient = null;
+
+int common_service = 1;
+
+void
+_SettingClientEx::InitSettingClient(void)
+{
+ static _SettingClientEx settingManager;
+ __pSettingClient = &settingManager;
+}
+
+_SettingClientEx*
+_SettingClientEx::GetInstance(void)
+{
+ static pthread_once_t once_block = PTHREAD_ONCE_INIT;
+ if(__pSettingClient == null)
+ {
+ pthread_once(&once_block, InitSettingClient);
+ }
+ return __pSettingClient;
+}
+
+_SettingClientEx::_SettingClientEx()
+ : __subscribed(false)
+ , __subscribedForInternal(false)
+ , __pListener(null)
+ , __pSettingEvent(null)
+ , __pSettingEventForInternal(null)
+{
+ result r = E_SUCCESS;
+ static String serviceId(SETTING_SERVICE_ID);
+
+ unique_ptr<_SettingEvent> settingEvent(new(nothrow) _SettingEvent());
+ unique_ptr<_SettingEvent> settingEventForInternal(new(nothrow) _SettingEvent());
+
+ r = __ipcClient.Construct(serviceId, this);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to construct IPC client.");
+ r = __asyncEventList.Construct();
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to construct asyn event list.");
+
+ SysTryCatch(NID_SYS, settingEvent.get() != null && settingEventForInternal.get() != null, r = E_SYSTEM, r, "It is failed to create event instances.");
+
+CATCH:
+ if(r == E_SUCCESS)
+ {
+ __pSettingEvent = settingEvent.release();
+ __pSettingEventForInternal = settingEventForInternal.release();
+ }
+ SetLastResult(r);
+}
+
+_SettingClientEx::~_SettingClientEx()
+{
+ __subscribed = false;
+ __subscribedForInternal = false;
+ __pListener = null;
+
+ if(__pSettingEvent != null)
+ {
+ delete __pSettingEvent;
+ }
+
+ if(__pSettingEventForInternal != null)
+ {
+ delete __pSettingEventForInternal;
+ }
+}
+
+result
+_SettingClientEx::ConvertCode(String code)
+{
+ result r = E_SUCCESS;
+ if(code == _SETTING_RESULT_SUCCESS)
+ {
+ r = E_SUCCESS;
+ }
+ else if(code == _SETTING_RESULT_INVALID_ARG)
+ {
+ r = E_INVALID_ARG;
+ }
+ else if(code == _SETTING_RESULT_PRIVILEGE_DENIED)
+ {
+ r = E_PRIVILEGE_DENIED;
+ }
+ else if(code == _SETTING_RESULT_UNSUPPORTED_OPERATION)
+ {
+ r = E_UNSUPPORTED_OPERATION;
+ }
+ else if(code == _SETTING_RESULT_OBJ_NOT_FOUND)
+ {
+ r = E_OBJ_NOT_FOUND;
+ }
+ else if(code == _SETTING_RESULT_OBJ_ALREADY_EXIST)
+ {
+ r = E_OBJ_ALREADY_EXIST;
+ }
+ else if(code == _SETTING_RESULT_IN_PROGRESS)
+ {
+ r = E_IN_PROGRESS;
+ }
+ else if(code == _SETTING_RESULT_SYSTEM)
+ {
+ r = E_SYSTEM;
+ }
+ else
+ {
+ r = E_SYSTEM;
+ }
+ return r;
+}
+
+String
+_SettingClientEx::ConvertKeyOspToTizen(String ospKey)
+{
+ String tizenKey = ospKey;
+
+ if(tizenKey == _HOUR_FORMAT_SELECTED)
+ tizenKey = _LOCALE_TIME_FORMAT_24HOUR;
+
+ else if(tizenKey == _ENABLE_MOTION)
+ tizenKey = _MOTION_UI;
+
+ else if(tizenKey == _DATA_ROAMING_ENABLED)
+ tizenKey = _NETWORK_TELEPHONY_ROAMING;
+
+ else if(tizenKey == _GPS_ENABLED)
+ tizenKey = _LOCATION_GPS;
+
+ else if(tizenKey == _PACKET_SERVICE_ALLOWED)
+ tizenKey = _NETWORK_TELEPHONY_PACKETSERVICE;
+
+ else if(tizenKey == _SILENT_MODE)
+ tizenKey = _SOUND_SILENTMODE;
+
+ else if(tizenKey == _WPS_ENABLED)
+ tizenKey = _LOCATION_WPS;
+
+ else if(tizenKey == _FLIGHT_MODE_ENABLED)
+ tizenKey = _NETWORK_FLIGHTMODE;
+
+ else if(tizenKey == _TOUCH_VIBRATION_LEVEL)
+ tizenKey = _VIBRATOR_LEVEL;
+
+ else if(tizenKey == _MEDIA_SOUND_VOLUME)
+ tizenKey = _SOUND_MEDIA_VOLUME;
+
+ else if(tizenKey == _NOTIFICATION_SOUND_VOLUME)
+ tizenKey = _SOUND_NOTIFICATION_VOLUME;
+
+ else if(tizenKey == _RINGTONE_SOUND_VOLUME)
+ tizenKey = _SOUND_RINGTONE_VOLUME;
+
+ else if(tizenKey == _SYSTEM_SOUND_VOLUME)
+ tizenKey = _SOUND_SYSTEM_VOLUME;
+
+ else if(tizenKey == _COUNTRY)
+ tizenKey = _LOCALE_COUNTRY;
+
+ else if(tizenKey == _DATE_FORMAT)
+ tizenKey = _LOCALE_DATE_FORMAT;
+
+ else if(tizenKey == _DATE_TIME_FORMAT)
+ tizenKey = _LOCALE_DATETIME_FORMAT;
+
+ else if(tizenKey == _FONTTYPE)
+ tizenKey = _FONT_TYPE;
+
+ else if(tizenKey == _FONTSIZE)
+ tizenKey = _FONT_SIZE;
+
+ else if(tizenKey == _RINGTONE)
+ tizenKey = _SOUND_RINGTONE;
+
+ else if(tizenKey == _TIME_FORMAT)
+ tizenKey = _LOCALE_TIME_FORMAT;
+
+ else if(tizenKey == _WALLPAPER)
+ tizenKey = _SCREEN_WALLPAPER;
+
+ return tizenKey;
+}
+
+result
+_SettingClientEx::ConvertKeyTizenToOsp(String tizenKey, String& ospKey)
+{
+ result r = E_SUCCESS;
+ if(tizenKey == _LOCALE_TIME_FORMAT_24HOUR)
+ {
+ ospKey = _HOUR_FORMAT_SELECTED;
+ }
+ else if(tizenKey == _MOTION_UI)
+ {
+ ospKey = _ENABLE_MOTION;
+ }
+ else if(tizenKey == _NETWORK_TELEPHONY_ROAMING)
+ {
+ ospKey = _DATA_ROAMING_ENABLED;
+ }
+ else if(tizenKey == _LOCATION_GPS)
+ {
+ ospKey = _GPS_ENABLED;
+ }
+ else if(tizenKey == _NETWORK_TELEPHONY_PACKETSERVICE)
+ {
+ ospKey = _PACKET_SERVICE_ALLOWED;
+ }
+ else if(tizenKey == _SOUND_SILENTMODE)
+ {
+ ospKey = _SILENT_MODE;
+ }
+ else if(tizenKey == _LOCATION_WPS)
+ {
+ ospKey = _WPS_ENABLED;
+ }
+ else if(tizenKey == _NETWORK_FLIGHTMODE)
+ {
+ ospKey = _FLIGHT_MODE_ENABLED;
+ }
+ else if(tizenKey == _VIBRATOR_LEVEL)
+ {
+ ospKey = _TOUCH_VIBRATION_LEVEL;
+ }
+ else if(tizenKey == _SOUND_MEDIA_VOLUME)
+ {
+ ospKey = _MEDIA_SOUND_VOLUME;
+ }
+ else if(tizenKey == _SOUND_NOTIFICATION_VOLUME)
+ {
+ ospKey = _NOTIFICATION_SOUND_VOLUME;
+ }
+ else if(tizenKey == _SOUND_RINGTONE_VOLUME)
+ {
+ ospKey = _RINGTONE_SOUND_VOLUME;
+ }
+ else if(tizenKey == _SOUND_SYSTEM_VOLUME)
+ {
+ ospKey = _SYSTEM_SOUND_VOLUME;
+ }
+ else if(tizenKey == _LOCALE_COUNTRY)
+ {
+ ospKey = _COUNTRY;
+ }
+ else if(tizenKey == _LOCALE_DATE_FORMAT)
+ {
+ ospKey = _DATE_FORMAT;
+ }
+ else if(tizenKey == _LOCALE_DATETIME_FORMAT)
+ {
+ ospKey = _DATE_TIME_FORMAT;
+ }
+ else if(tizenKey == _FONT_TYPE)
+ {
+ ospKey = _FONTTYPE;
+ }
+ else if(tizenKey == _FONT_SIZE)
+ {
+ ospKey = _FONTSIZE;
+ }
+ else if(tizenKey == _SOUND_RINGTONE)
+ {
+ ospKey = _RINGTONE;
+ }
+ else if(tizenKey == _LOCALE_TIME_FORMAT)
+ {
+ ospKey = _TIME_FORMAT;
+ }
+ else if(tizenKey == _SCREEN_WALLPAPER)
+ {
+ ospKey = _WALLPAPER;
+ }
+ else
+ {
+ r = E_INVALID_ARG;
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::GetOnService(String commandId, String key, String& response)
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_SYS, commandId.GetLength() > 0 && key.GetLength() > 0, E_INVALID_ARG, "There are invalid parameters.");
+ String requestKey = ConvertKeyOspToTizen(key);
+ String* pResult = null;
+ String* pValue = null;
+
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ r = requestMessages.Construct();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to construct request message.");
+ r = responseMessages.Construct();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to construct response message.");
+
+ r = requestMessages.Add(commandId);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id on request message.");
+ r = requestMessages.Add(requestKey);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add required key on request message.");
+
+ //unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ IoService_Request message(requestMessages, &responseMessages);
+
+ //r = __ipcClient.SendRequest(*(pMsg.get()));
+ r = __ipcClient.SendRequest(message);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryCatch(NID_SYS, pResult != null, r = E_SYSTEM, r, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+ if(r == E_SUCCESS)
+ {
+ pValue = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ SysTryCatch(NID_SYS, pValue != null, r = E_SYSTEM, r, "There is no result value.");
+ response = *pValue;
+ }
+
+CATCH:
+ responseMessages.RemoveAll(true);
+ return r;
+}
+
+result
+_SettingClientEx::SetOnService(String commandId, String key, String value)
+{
+ result r = E_SUCCESS;
+
+ SysTryReturnResult(NID_SYS, commandId.GetLength() > 0 && key.GetLength() > 0 && value.GetLength() > 0, E_INVALID_ARG, "There are invalid parameters.");
+ String requestKey = ConvertKeyOspToTizen(key);
+ String* pResult = null;
+
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ r = requestMessages.Construct();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to construct request message.");
+ r = responseMessages.Construct();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to construct response message.");
+
+ r = requestMessages.Add(commandId);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add command id on request message.");
+ r = requestMessages.Add(requestKey);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add required key on request message.");
+ r = requestMessages.Add(value);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add required value on request message.");
+
+ IoService_Request message(requestMessages, &responseMessages);
+
+ r = __ipcClient.SendRequest(message);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryCatch(NID_SYS, pResult != null, r = E_SYSTEM, r, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+CATCH:
+ responseMessages.RemoveAll(true);
+ return r;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, bool& value)
+{
+ String response;
+ result r = GetOnService(SETTING_SERVICE_COMMAND_GET_BOOL, key, response);
+
+ SysLog(NID_SYS, "result is %ls.", response.GetPointer());
+ if(r == E_SUCCESS)
+ {
+ if(response == L"1")
+ {
+ value = true;
+ }
+ else
+ {
+ value = false;
+ }
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, int& value)
+{
+ String response;
+ result r = GetOnService(SETTING_SERVICE_COMMAND_GET_INT, key, response);
+
+ if(r == E_SUCCESS)
+ {
+ r = Integer::Parse(response, value);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to convert to integer from [%s]", response.GetPointer());
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, long long& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, double& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, UuId& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
+
+result
+_SettingClientEx::GetValue(const String& key, String& value)
+{
+ String response;
+ result r = E_SUCCESS;
+
+ if(key == _USBMODE) //This is compatible issue. USB mode is fixed on Tizen.
+ {
+ value = _USBMODE_MTP;
+ return E_SUCCESS;
+ }
+
+ if(key == _LANGUAGE) //This is not full compatible.
+ {
+ r = GetOnService(SETTING_SERVICE_COMMAND_GET_STRING, _LOCALE_LANGUAGE, response);
+ }
+ else
+ {
+ r = GetOnService(SETTING_SERVICE_COMMAND_GET_STRING, key, response);
+ }
+
+ if(r == E_SUCCESS)
+ {
+ value = response;
+ }
+
+ if(key == _LANGUAGE) //This is not full compatible.
+ {
+ r = value.SubString(0, 3, value);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to sub string on %ls.", value.GetPointer());
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::GetValueForPrivilegedKey(const String& key, bool& value)
+{
+ return E_OBJ_NOT_FOUND;
+}
+
+result
+_SettingClientEx::SetValue(const String& key, const bool& value)
+{
+ String requestValue;
+ requestValue = Boolean::ToString(value);
+ return SetOnService(SETTING_SERVICE_COMMAND_SET_BOOL, key, requestValue);
+}
+
+result
+_SettingClientEx::SetValue(const String& key, const int& value)
+{
+ String requestValue;
+ requestValue.Append(value);
+ return SetOnService(SETTING_SERVICE_COMMAND_SET_INT, key, requestValue);
+}
+
+result
+_SettingClientEx::SetValue(const String& key, const String& value)
+{
+ String requestValue;
+ requestValue.Append(value);
+ return SetOnService(SETTING_SERVICE_COMMAND_SET_STRING, key, requestValue);
+}
+
+result
+_SettingClientEx::SetValueForPrivilegedKey(const String& key, bool value)
+{
+ String requestValue;
+ requestValue = Boolean::ToString(value);
+ return SetOnService(SETTING_SERVICE_COMMAND_SET_BOOL, key, requestValue);
+}
+
+result
+_SettingClientEx::SetValueForPrivilegedKey(const String& key, String value)
+{
+ String requestValue;
+ requestValue.Append(value);
+ return SetOnService(SETTING_SERVICE_COMMAND_SET_PRIV_STRING, key, requestValue);
+}
+
+
+result
+_SettingClientEx::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ result r = E_SUCCESS;
+ String requestValue;
+
+ SysTryReturnResult(NID_SYS, __asyncEventList.ContainsKey(key) == false, E_IN_PROGRESS, "Required key[%ls] is already in progress.", key.GetPointer());
+
+ requestValue = Boolean::ToString(value);
+ r = SetOnService(SETTING_SERVICE_COMMAND_SET_ASYNC_BOOL, key, requestValue);
+
+ if(r == E_SUCCESS)
+ {
+ if(listener != null)
+ {
+ _SettingAsyncEvent* pEvent = new (std::nothrow) _SettingAsyncEvent();
+ pEvent->AddListener(*listener);
+
+ __asyncEventList.Add(new String(key), pEvent);
+ }
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
+{
+ result r = E_SUCCESS;
+ String requestValue;
+
+ SysTryReturnResult(NID_SYS, __asyncEventList.ContainsKey(key) == false, E_IN_PROGRESS, "Required key[%ls] is already in progress.", key.GetPointer());
+
+ requestValue = Boolean::ToString(value);
+ r = SetOnService(SETTING_SERVICE_COMMAND_SET_PRIV_ASYNC_BOOL, key, requestValue);
+
+ if(r == E_SUCCESS)
+ {
+ if(listener != null)
+ {
+ _SettingAsyncEvent* pEvent = new (std::nothrow) _SettingAsyncEvent();
+ pEvent->AddListener(*listener);
+
+ __asyncEventList.Add(new String(key), pEvent);
+ }
+ }
+
+ return r;
+}
+
+void
+_SettingClientEx::OnIpcResponseReceived(_IpcClient& client, const IPC::Message& message)
+{
+ IPC_BEGIN_MESSAGE_MAP(_SettingClientEx, message)
+ IPC_MESSAGE_HANDLER_EX(IoService_Data, &client, OnDataReceived)
+ IPC_END_MESSAGE_MAP_EX()
+}
+
+void
+_SettingClientEx::OnDataReceived(const ArrayList& data)
+{
+ result r = E_SUCCESS;
+ String* pCommandCode = (String*)data.GetAt(SETTING_SERVICE_IPC_MSG_COMMAND);
+ String* pKey = (String*)data.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ String* pValue = null;
+
+ SysTryCatch(NID_SYS, pCommandCode != null && pKey != null, r = E_SYSTEM, r, "There is no valid data.");
+
+ SysLog(NID_SYS, "CommandCode: %ls", pCommandCode->GetPointer());
+ SysLog(NID_SYS, "Key: %ls", pKey->GetPointer());
+
+ if(*pCommandCode == SETTING_SERVICE_COMMAND_RESULT)
+ {
+ pValue = (String*)(data.GetAt(SETTING_SERVICE_IPC_MSG_VALUE));
+ SysTryCatch(NID_SYS, pValue != null, r = E_SYSTEM, r, "There is no valid value.");
+
+ r = ConvertCode(*pValue);
+
+ _SettingAsyncEvent* pEvent = dynamic_cast <_SettingAsyncEvent*> (__asyncEventList.GetValue(*pKey));
+
+ SysTryCatch(NID_SYS, pEvent != null, r = E_SYSTEM, r, "There is no reserved event.");
+
+ _SettingAsyncEventArg* pSettingAsyncEventArg = new (std::nothrow) _SettingAsyncEventArg;
+ SysTryCatch(NID_SYS, pSettingAsyncEventArg != null, r = E_SYSTEM, r, "There is no reserved event.");
+
+ pSettingAsyncEventArg->Key = *pKey;
+ pSettingAsyncEventArg->errorCode = r;
+ pEvent->Fire(*pSettingAsyncEventArg);
+
+ r = __asyncEventList.Remove(*pKey, true);
+ }
+ else if(*pCommandCode == SETTING_SERVICE_COMMAND_EVENT)
+ {
+ SysTryReturnVoidResult(NID_SYS, __pSettingEvent != null, E_SYSTEM, "Event is not ready.");
+
+ _SettingEventArg* pSettingEventArg = new (std::nothrow) _SettingEventArg();
+ pSettingEventArg->KeyName = *pKey;
+
+ if(_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat() == true)
+ {
+ String ospKey;
+ r = ConvertKeyTizenToOsp(pSettingEventArg->KeyName, ospKey);
+ if(r == E_SUCCESS)
+ {
+ pSettingEventArg->KeyName = ospKey;
+ __pSettingEvent->Fire(*pSettingEventArg);
+ }
+ }
+ else
+ {
+ __pSettingEvent->Fire(*pSettingEventArg);
+ }
+ }
+ else if(*pCommandCode == SETTING_SERVICE_COMMAND_EVENT_INTERNAL)
+ {
+ SysTryReturnVoidResult(NID_SYS, __pSettingEvent != null, E_SYSTEM, "Event is not ready.");
+
+ _SettingEventArg* pSettingEventArg = new (std::nothrow) _SettingEventArg();
+ pSettingEventArg->KeyName = *pKey;
+
+ __pSettingEventForInternal->Fire(*pSettingEventArg);
+ }
+
+CATCH:
+ ArrayList* pData = const_cast< ArrayList *> (&data);
+ pData->RemoveAll(true);
+}
+
+bool
+_SettingClientEx::HasKey(const String& key)
+{
+ String response;
+ result r = GetOnService(SETTING_SERVICE_COMMAND_SUPPORTED, key, response);
+
+ SysLog(NID_SYS, "HasKey result key:%ls, %ls", key.GetPointer(), response.GetPointer());
+ if(response == L"1" && r == E_SUCCESS)
+ {
+ return true;
+ }
+ return false;
+}
+
+result
+_SettingClientEx::ResetToFactoryDefault(void)
+{
+ String value;
+ String response;
+ value = "none";
+ result r = GetOnService(_SETTING_COMMAND_FACTORY_RESET, value, response);
+ SysLog(NID_SYS, "Reset result is %s[%ls].", GetErrorMessage(r), response.GetPointer());
+ return r;
+}
+
+//For OSP_COMPAT mode
+result
+_SettingClientEx::SetVolume(const String& soundCategory, int level)
+{
+ result r = SetValue(soundCategory, level);
+ if (r == E_INVALID_ARG)
+ {
+ r = E_OUT_OF_RANGE;
+ }
+ else if(r == E_OBJ_NOT_FOUND)
+ {
+ r = E_INVALID_ARG;
+ }
+ else if(r == E_UNSUPPORTED_OPERATION)
+ {
+ r = E_SYSTEM;
+ }
+ return r;
+}
+
+//Event Management
+result
+_SettingClientEx::SubscribeEvent(void)
+{
+ result r = E_SUCCESS;
+ SysTryReturnResult(NID_SYS, __pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+ _SettingEvent* pSettingEvent = dynamic_cast<_SettingEvent*> (__pSettingEvent);
+ SysTryReturnResult(NID_SYS, pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+
+ SysTryReturnResult(NID_SYS, __pSettingEventForInternal != null, E_SYSTEM, "listener list is not ready.");
+ _SettingEvent* pSettingEventForInternal = dynamic_cast<_SettingEvent*> (__pSettingEventForInternal);
+ SysTryReturnResult(NID_SYS, pSettingEventForInternal != null, E_SYSTEM, "listener list is not ready.");
+
+ if(pSettingEvent->GetCount() > 0 && __subscribed == false)
+ {
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ requestMessages.Construct();
+ responseMessages.Construct();
+
+ String commandId(SETTING_SERVICE_COMMAND_SUBSCRIBE);
+
+ requestMessages.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ r = __ipcClient.SendRequest(*(pMsg.get()));
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+ if(r == E_SUCCESS)
+ {
+ __subscribed = true;
+ }
+ responseMessages.RemoveAll(true);
+ }
+ else if(pSettingEvent->GetCount() == 0 && __subscribed == true)
+ {
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ requestMessages.Construct();
+ responseMessages.Construct();
+
+ String commandId(SETTING_SERVICE_COMMAND_UNSUBSCRIBE);
+
+ requestMessages.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ r = __ipcClient.SendRequest(*(pMsg.get()));
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+ if(r == E_SUCCESS)
+ {
+ __subscribed = false;
+ }
+ responseMessages.RemoveAll(true);
+ }
+
+ if(pSettingEventForInternal->GetCount() > 0 && __subscribedForInternal == false)
+ {
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ requestMessages.Construct();
+ responseMessages.Construct();
+
+ String commandId(SETTING_SERVICE_COMMAND_SUBSCRIBE_INTERNAL);
+
+ requestMessages.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ r = __ipcClient.SendRequest(*(pMsg.get()));
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+ if(r == E_SUCCESS)
+ {
+ __subscribedForInternal = true;
+ }
+ responseMessages.RemoveAll(true);
+ }
+ else if(pSettingEventForInternal->GetCount() == 0 && __subscribedForInternal == true)
+ {
+ ArrayList requestMessages;
+ ArrayList responseMessages;
+
+ requestMessages.Construct();
+ responseMessages.Construct();
+
+ String commandId(SETTING_SERVICE_COMMAND_UNSUBSCRIBE_INTERNAL);
+
+ requestMessages.Add(commandId);
+
+ unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessages, &responseMessages));
+
+ r = __ipcClient.SendRequest(*(pMsg.get()));
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to send request by IPC [%s]", GetErrorMessage(r));
+
+ String* pResult = (String*)responseMessages.GetAt(SETTING_SERVICE_IPC_MSG_RESULT);
+ SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "There is no result code.");
+ r = ConvertCode(*pResult);
+
+ if(r == E_SUCCESS)
+ {
+ __subscribedForInternal = false;
+ }
+ responseMessages.RemoveAll(true);
+ }
+
+ return r;
+}
+
+result
+_SettingClientEx::AddSettingEventListener(ISettingEventListener& listener)
+{
+ SysTryReturnResult(NID_SYS, __pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+ _SettingEvent* pSettingEvent = dynamic_cast<_SettingEvent*> (__pSettingEvent);
+ SysTryReturnResult(NID_SYS, pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+
+ result r = pSettingEvent->AddSettingEventListener(listener);
+ if (r == E_INVALID_OPERATION)
+ {
+ r = E_SYSTEM;
+ }
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to add event listener.");
+
+ r = SubscribeEvent();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to request to add event listener.");
+
+ return r;
+}
+
+result
+_SettingClientEx::RemoveSettingEventListener(ISettingEventListener& listener)
+{
+ SysTryReturnResult(NID_SYS, __pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+ _SettingEvent* pSettingEvent = dynamic_cast<_SettingEvent*> (__pSettingEvent);
+ SysTryReturnResult(NID_SYS, pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+
+ result r = pSettingEvent->RemoveSettingEventListener(listener);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to remove event listener.");
+
+ r = SubscribeEvent();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to request to remove event listener.");
+
+ return r;
+}
+
+// Event for internal
+result
+_SettingClientEx::AddSettingEventListenerForInternal(ISettingEventListener& listener)
+{
+ SysTryReturnResult(NID_SYS, __pSettingEventForInternal != null, E_SYSTEM, "listener event is not ready.");
+ _SettingEvent* pSettingEvent = dynamic_cast<_SettingEvent*> (__pSettingEventForInternal);
+ SysTryReturnResult(NID_SYS, pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+
+ result r = pSettingEvent->AddSettingEventListener(listener);
+ SysLog(NID_SYS, "Add Setting event result is %s for internal.", GetErrorMessage(r));
+
+ if (r == E_INVALID_OPERATION)
+ {
+ r = E_SYSTEM;
+ }
+
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to add event listener.");
+
+ r = SubscribeEvent();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to request to add event listener.");
+
+ return r;
+}
+
+result
+_SettingClientEx::RemoveSettingEventListenerForInternal(ISettingEventListener& listener)
+{
+ SysTryReturnResult(NID_SYS, __pSettingEventForInternal != null, E_SYSTEM, "listener list is not ready.");
+ _SettingEvent* pSettingEvent = dynamic_cast<_SettingEvent*> (__pSettingEventForInternal);
+ SysTryReturnResult(NID_SYS, pSettingEvent != null, E_SYSTEM, "listener event is not ready.");
+
+ result r = pSettingEvent->RemoveSettingEventListener(listener);
+ SysLog(NID_SYS, "Remove setting event result is %s for internal.", GetErrorMessage(r));
+
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to remove event listener.");
+
+ r = SubscribeEvent();
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, "It is failed to request to remove event listener.");
+
+ return r;
+}
+
+//For OSP_COMPAT mode
+result
+_SettingClientEx::SetSettingEventListener(ISettingEventListener* pListener)
+{
+ result r = E_SUCCESS;
+ if(__pListener != null)
+ {
+ r = RemoveSettingEventListener(*pListener);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to unregister exist listener.");
+ if(pListener != null)
+ {
+ r = AddSettingEventListener(*pListener);
+ SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to register listener.");
+ }
+ }
+
+ __pListener = pListener;
+
+ return r;
+}
+
+} } // Tizen::System
--- /dev/null
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSys_SettingClientEx.h
+ * @brief This is the header file for _SettingClientEx class.
+ */
+
+#ifndef _FSYSTEM_INTERNAL_SETTING_CLIENT_EX_H_
+#define _FSYSTEM_INTERNAL_SETTING_CLIENT_EX_H_
+
+#include <FBaseColArrayList.h>
+#include <FBaseColHashMap.h>
+#include <FBaseObject.h>
+#include <FBaseRtEvent.h>
+#include <FBaseRtIEventArg.h>
+#include <FBaseRtIEventListener.h>
+#include <FBaseString.h>
+#include <FBaseInteger.h>
+#include <FBaseUuId.h>
+#include <FSysISettingEventListener.h>
+#include <FSysISettingInfoSetValueAsyncResultListener.h>
+
+#include <FIo_IIpcClientEventListener.h>
+#include <FIo_IpcClient.h>
+
+namespace Tizen { namespace System
+{
+
+class _SettingEventArg : public Tizen::Base::Runtime::IEventArg
+{
+public:
+ Tizen::Base::String KeyName;
+};
+
+class _SettingEvent : public Tizen::Base::Runtime::Event
+{
+public:
+ _SettingEvent()
+ : __count(0)
+ {
+ }
+
+ result AddSettingEventListener(ISettingEventListener& listener)
+ {
+ result r = AddListener(listener);
+ SysTryReturnResult(NID_SYS, __count >= 0, E_SYSTEM, "Listenr count[%d] is error.", __count);
+
+ if(r == E_SUCCESS)
+ {
+ __count++;
+ }
+ return r;
+ }
+
+ result RemoveSettingEventListener(ISettingEventListener& listener)
+ {
+ result r = RemoveListener(listener);
+ SysTryReturnResult(NID_SYS, __count > 0, E_SYSTEM, "Listenr count[%d] is error.", __count);
+ if(r == E_SUCCESS)
+ {
+ __count--;
+ }
+ return r;
+ }
+
+ int GetCount(void)
+ {
+ return __count;
+ }
+
+private:
+ int __count;
+protected:
+ virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
+ {
+ ISettingEventListener* pListener = dynamic_cast<ISettingEventListener*> (&listener);
+ const _SettingEventArg* pArg = dynamic_cast<const _SettingEventArg*>(&arg);
+
+ if(pListener == null || pArg == null)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to get listner or arguemnt");
+ return;
+ }
+
+ Tizen::Base::String value =pArg->KeyName;
+ pListener->OnSettingChanged(value);
+ }
+};
+
+class _SettingAsyncEventArg : public Tizen::Base::Runtime::IEventArg
+{
+public:
+ Tizen::Base::String Key;
+ result errorCode;
+};
+
+class _SettingAsyncEvent : public Tizen::Base::Runtime::Event
+{
+protected:
+ virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
+ {
+ ISettingInfoSetValueAsyncResultListener* pListener = dynamic_cast<ISettingInfoSetValueAsyncResultListener*> (&listener);
+ const _SettingAsyncEventArg* pArg = dynamic_cast<const _SettingAsyncEventArg*>(&arg);
+
+ if(pListener == null || pArg == null)
+ {
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to get listner or arguemnts [%x/%x].", pListener, pArg);
+ return;
+ }
+
+ result r = pArg->errorCode;
+ pListener->OnResultReceivedForSetValueAsync(pArg->Key, r);
+ RemoveListener(listener);
+ }
+};
+
+class _SettingClientEx
+ : public Tizen::Base::Object
+ , public Tizen::Io::_IIpcClientEventListener
+{
+private:
+ _SettingClientEx(void);
+ virtual ~_SettingClientEx(void);
+
+public:
+ result GetValue(const Tizen::Base::String& key, bool& value);
+ result GetValueForPrivilegedKey(const Tizen::Base::String& key, bool& value);
+ result GetValue(const Tizen::Base::String& key, double& value);
+ result GetValue(const Tizen::Base::String& key, int& value);
+ result GetValue(const Tizen::Base::String& key, long long& value);
+ result GetValue(const Tizen::Base::String& key, Tizen::Base::String& value);
+ result GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value);
+
+ bool HasKey(const Tizen::Base::String& key);
+
+ result SetValue(const Tizen::Base::String& key, const bool& value);
+ result SetValueForPrivilegedKey(const Tizen::Base::String& key, bool value);
+ result SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
+ result SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener);
+ result SetValue(const Tizen::Base::String& key, const int& value);
+ result SetValue(const Tizen::Base::String& key, const Tizen::Base::String& value);
+ result SetValueForPrivilegedKey(const Tizen::Base::String& key, Tizen::Base::String value);
+
+ result AddSettingEventListenerForInternal(ISettingEventListener& listener);
+ result RemoveSettingEventListenerForInternal(ISettingEventListener& listener);
+ result AddSettingEventListener(ISettingEventListener& listener);
+ result RemoveSettingEventListener(ISettingEventListener& listener);
+
+ result SetSettingEventListener(ISettingEventListener* pListener);
+
+ result ResetToFactoryDefault(void);
+
+ void OnIpcResponseReceived(Tizen::Io::_IpcClient& client, const IPC::Message& message);
+
+ static _SettingClientEx* GetInstance(void);
+
+private:
+ void OnDataReceived(const Tizen::Base::Collection::ArrayList& data);
+ result ConvertCode(Tizen::Base::String code);
+
+ Tizen::Base::String ConvertKeyOspToTizen(Tizen::Base::String ospKey);
+ result ConvertKeyTizenToOsp(Tizen::Base::String tizenKey, Tizen::Base::String& ospKey);
+
+ result GetOnService(Tizen::Base::String commandId, Tizen::Base::String key, Tizen::Base::String& response);
+ result SetOnService(Tizen::Base::String commandId, Tizen::Base::String key, Tizen::Base::String value);
+ result SetVolume(const Tizen::Base::String& soundCategory, int level);
+
+ result SubscribeEvent(void);
+
+ static void InitSettingClient(void);
+private:
+ Tizen::Base::Collection::HashMap __asyncEventList;
+ Tizen::Io::_IpcClient __ipcClient;
+
+ bool __subscribed;
+ bool __subscribedForInternal;
+ ISettingEventListener* __pListener;
+
+ _SettingEvent* __pSettingEvent;
+ _SettingEvent* __pSettingEventForInternal;
+ static _SettingClientEx* __pSettingClient;
+};
+
+} } // Tizen::System
+
+#endif //_FSYSTEM_INTERNAL_SETTING_CLIENT_EX_H_
#include <unique_ptr.h>
#include <system/system_settings.h>
-#include <FBase.h>
#include <FBaseColArrayList.h>
#include <FBaseSysLog.h>
+#include <FBaseUtilStringUtil.h>
+#include <FIoFile.h>
#include <FApp_AppInfo.h>
#include <FBase_StringConverter.h>
#include <FSys_SettingInfoImpl.h>
#include "FSys_SettingClient.h"
+#include "FSys_SettingClientEx.h"
using namespace std;
static _SettingClient* pSettingClient = null;
+static _SettingClientEx* pSettingClientEx = null;
+static const wchar_t* _COMMON_SERVICE_ENABLED = L"/opt/usr/etc/setting_common";
+static bool common_mode = false;
void
_SettingInfoImpl::InitSettingClient(void)
{
- if(pSettingClient == null)
+ if(pSettingClient == null && pSettingClientEx == null)
{
- pSettingClient = _SettingClient::GetInstance();
+ if(File::IsFileExist(_COMMON_SERVICE_ENABLED) == false)
+ {
+ if(pSettingClient == null)
+ {
+ pSettingClient = _SettingClient::GetInstance();
+ }
+ }
+ else
+ {
+ common_mode = true;
+ if(pSettingClientEx == null)
+ {
+ pSettingClientEx = _SettingClientEx::GetInstance();
+ }
+ }
}
}
result
else
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- r = pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->GetValue(key, value);
+ }
}
return r;
}
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, int& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, long long& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, double& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, bool& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::GetValue(const Tizen::Base::String& key, Tizen::Base::UuId& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValue(key, value);
+ }
}
result
_SettingInfoImpl::SetWallpaper(const Tizen::Base::String& filePath)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- result r = pSettingClient->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ result r = E_SUCCESS;
+
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(_SETTING_SCREEN_WALLPAPER, filePath);
+ }
if(r == E_INVALID_ARG)
r = E_FILE_NOT_FOUND;
_SettingInfoImpl::GetValueForPrivilegedKey(const String& key, bool& value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->GetValueForPrivilegedKey(key, value);
+
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->GetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->GetValueForPrivilegedKey(key, value);
+ }
}
result
_SettingInfoImpl::SetValue(const String& key, bool value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
}
result
_SettingInfoImpl::SetValue(const String& key, int value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
}
else
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- r = pSettingClient->SetValue(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValue(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValue(key, value);
+ }
}
return r;
}
_SettingInfoImpl::SetValueForPrivilegedKey(const String& key, bool value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueForPrivilegedKey(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueForPrivilegedKey(key, value);
+ }
}
result
_SettingInfoImpl::SetValueForPrivilegedKey(const String& key, String value)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueForPrivilegedKey(key, value);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueForPrivilegedKey(key, value);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueForPrivilegedKey(key, value);
+ }
}
bool
_SettingInfoImpl::HasKey(const String& key)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->HasKey(key);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->HasKey(key);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->HasKey(key);
+ }
}
result
_SettingInfoImpl::ResetToFactoryDefault(void)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->ResetToFactoryDefault();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->ResetToFactoryDefault();
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->ResetToFactoryDefault();
+ }
}
result
_SettingInfoImpl::SetRingtone(const Tizen::Base::String& filePath)
{
+ result r = E_SUCCESS;
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- result r = pSettingClient->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(_SETTING_SOUND_RINGTONE, filePath);
+ }
if(r == E_INVALID_ARG)
r = E_FILE_NOT_FOUND;
result r = E_SUCCESS;
String key;
- InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
-
if (soundCategory == _SETTING_SYSTEM_SOUND_VOLUME)
{
key = _SETTING_SOUND_SYSTEM_VOLUME;
key = soundCategory;
}
- r = pSettingClient->SetValue(key, level);
+ InitSettingClient();
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClient->SetValue(key, level);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ r = pSettingClientEx->SetValue(key, level);
+ }
if (r == E_OBJ_NOT_FOUND)
{
_SettingInfoImpl::AddSettingEventListener(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->AddSettingEventListener(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->AddSettingEventListener(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->AddSettingEventListener(listener);
+ }
}
result
_SettingInfoImpl::RemoveSettingEventListener(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->RemoveSettingEventListener(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->RemoveSettingEventListener(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->RemoveSettingEventListener(listener);
+ }
}
result
_SettingInfoImpl::AddSettingEventListenerForInternal(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->AddSettingEventListenerForInternal(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->AddSettingEventListenerForInternal(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->AddSettingEventListenerForInternal(listener);
+ }
}
result
_SettingInfoImpl::RemoveSettingEventListenerForInternal(ISettingEventListener& listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->RemoveSettingEventListenerForInternal(listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->RemoveSettingEventListenerForInternal(listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->RemoveSettingEventListenerForInternal(listener);
+ }
}
result
_SettingInfoImpl::SetSettingEventListener(ISettingEventListener* pListener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetSettingEventListener(pListener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetSettingEventListener(pListener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetSettingEventListener(pListener);
+ }
}
result
_SettingInfoImpl::SetValueAsync(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueAsync(key, value, listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueAsync(key, value, listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueAsync(key, value, listener);
+ }
}
result
_SettingInfoImpl::SetValueAsyncForPrivilegedKey(const Tizen::Base::String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
{
InitSettingClient();
- SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
- return pSettingClient->SetValueAsyncForPrivilegedKey(key, value, listener);
+ if(common_mode == false)
+ {
+ SysTryReturnResult(NID_SYS, pSettingClient != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClient->SetValueAsyncForPrivilegedKey(key, value, listener);
+ }
+ else
+ {
+ SysTryReturnResult(NID_SYS, pSettingClientEx != null, E_SYSTEM, "It is failed to intialize setting manager");
+ return pSettingClientEx->SetValueAsyncForPrivilegedKey(key, value, listener);
+ }
}
_SettingInfoImpl*