Update change log and spec for wrt-plugins-tizen_0.4.20
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 17 Apr 2013 16:25:05 +0000 (01:25 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 17 Apr 2013 17:14:11 +0000 (02:14 +0900)
101 files changed:
packaging/wrt-plugins-tizen.spec
pkgconfigs/wrt-plugins-tizen-systeminfo.pc.in
src/Alarm/AlarmAbsolute.cpp
src/Alarm/AlarmRelative.cpp
src/Alarm/JSAlarmAbsolute.cpp
src/Alarm/JSAlarmRelative.cpp
src/Alarm/plugin_initializer.cpp [changed mode: 0755->0644]
src/Application/AppManagerWrapper.cpp
src/Application/AppManagerWrapper.h
src/Bluetooth/BluetoothAdapter.cpp
src/Bluetooth/BluetoothAdapter.h
src/Bluetooth/BluetoothClass.cpp
src/Bluetooth/BluetoothClass.h
src/Bluetooth/BluetoothDevice.cpp
src/Bluetooth/BluetoothDevice.h
src/Bluetooth/BluetoothSocket.cpp
src/Bluetooth/JSBluetoothAdapter.cpp
src/Bluetooth/JSBluetoothClass.cpp
src/Bluetooth/JSBluetoothDevice.cpp
src/Bluetooth/JSBluetoothDevice.h
src/Bluetooth/JSBluetoothManager.cpp
src/Bluetooth/JSBluetoothServiceHandler.cpp
src/Bluetooth/JSBluetoothSocket.cpp
src/Bluetooth/plugin_initializer.cpp
src/Calendar/Calendar.cpp
src/Calendar/CalendarFilter.cpp
src/Calendar/CalendarFilter.h
src/Calendar/CalendarFilterValidator.cpp
src/Calendar/JSCalendarManager.cpp
src/Callhistory/JSCallHistory.cpp
src/Callhistory/plugin_initializer.cpp
src/Common/CMakeLists.txt
src/Common/JSArray.cpp [new file with mode: 0755]
src/Common/JSArray.h [new file with mode: 0755]
src/Common/StandaloneConsole/StandaloneConsole.cpp
src/Common/TimeTracer/TimeTracer.c
src/Contact/CMakeLists.txt
src/Contact/JSAddressBook.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactManager.cpp
src/Contact/JSPerson.cpp
src/Contact/plugin_initializer.cpp
src/DataControl/plugin_initializer.cpp
src/Filesystem/CMakeLists.txt
src/Filesystem/JSFile.cpp
src/Filesystem/JSFilestream.cpp
src/Filesystem/JSFilesystemManager.cpp
src/Filesystem/Manager.cpp
src/Filesystem/Path.cpp
src/Filesystem/plugin_initializer.cpp
src/Log/JSTizenLog.cpp
src/Log/JSTizenLog.h
src/Log/plugin_initializer.cpp
src/MessagePort/CMakeLists.txt
src/MessagePort/JSLocalMessagePort.cpp
src/MessagePort/JSMessagePortManager.cpp
src/MessagePort/JSRemoteMessagePort.cpp
src/MessagePort/plugin_initializer.cpp
src/Messaging/ConverterMessage.cpp
src/Messaging/JSMessage.cpp
src/Messaging/JSMessage.h
src/Messaging/JSMessageAttachment.cpp
src/Messaging/JSMessageAttachment.h
src/Messaging/JSMessagingService.cpp
src/Messaging/JSMessagingStorage.cpp
src/Messaging/plugin_initializer.cpp
src/NFC/NFCDefaultAdapter.cpp
src/Notification/CMakeLists.txt
src/Notification/JSNotificationDetailInfo.cpp
src/Notification/JSNotificationManager.cpp
src/Notification/JSStatusNotification.cpp
src/Notification/JSStatusNotification.h
src/Notification/NotificationManager.cpp
src/Notification/StatusNotification.cpp
src/Notification/StatusNotification.h
src/Notification/plugin_initializer.cpp
src/Package/CMakeLists.txt
src/Package/JSPackageManager.cpp
src/Package/PackageManager.cpp
src/Package/PackageManager.h [changed mode: 0755->0644]
src/Package/plugin_initializer.cpp
src/Power/CMakeLists.txt
src/Power/JSPowerManager.cpp
src/Power/PowerManager.cpp
src/Power/plugin_initializer.cpp
src/Push/CMakeLists.txt
src/Push/JSPushManager.cpp
src/Push/plugin_initializer.cpp
src/SecureElement/plugin_initializer.cpp
src/SystemSetting/CMakeLists.txt
src/SystemSetting/JSSystemSetting.cpp
src/SystemSetting/plugin_initializer.cpp
src/Systeminfo/CMakeLists.txt
src/Systeminfo/JSDeviceCapabilitiesInfo.cpp
src/Systeminfo/JSSIMInfo.cpp
src/Systeminfo/JSSysteminfo.cpp [changed mode: 0755->0644]
src/Systeminfo/Systeminfo.cpp
src/Systeminfo/Systeminfo.h
src/Systeminfo/plugin_initializer.cpp
src/TimeUtil/plugin_initializer.cpp
src/Tizen/plugin_initializer.cpp

index a826d2e..91241bb 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.19
+Version:    0.4.20
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -42,7 +42,6 @@ BuildRequires:  pkgconfig(capi-telephony-call)
 BuildRequires:  pkgconfig(capi-telephony-sim)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-system-runtime-info)
-BuildRequires:  pkgconfig(capi-telephony-network-info)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(capi-system-sensor)
 BuildRequires:  pkgconfig(capi-system-power)
index d322e18..4219c95 100755 (executable)
@@ -8,6 +8,6 @@ includedir=${prefix}/include/${project_name}
 Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
-Requires: capi-telephony-sim capi-network-connection capi-system-info capi-system-runtime-info capi-system-sensor sensor capi-telephony-network-info
+Requires: capi-telephony-sim capi-network-connection capi-system-info capi-system-runtime-info capi-system-sensor sensor
 Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
index 5816523..5a43024 100755 (executable)
@@ -33,12 +33,14 @@ AlarmAbsolute::AlarmAbsolute()
     service_add_extra_data(m_service_handle, ALARM_ALSOLUTE_RECURRENCE_TYPE_KEY, ALARM_ALSOLUTE_RECURRENCE_TYPE_NONE);
     m_recurrenceType = AbsoluteRecurrence::NoRecurrence;
     m_id = -1;
+       m_interval = -1;
 }
 
 AlarmAbsolute::AlarmAbsolute(service_h handle)
 {
     service_clone(&m_service_handle, handle);
     m_id = -1;
+       m_interval = -1;
 }
 
 AlarmAbsolute::~AlarmAbsolute()
index b8a497f..907e80a 100755 (executable)
@@ -29,14 +29,14 @@ AlarmRelative::AlarmRelative()
     m_isRecurrence = false;
     service_create(&m_service_handle);
     service_add_extra_data(m_service_handle, ALARM_TYPE_KEY, ALARM_TYPE_RELATIVE_VALUE);
-    m_Period = 0;
+    m_Period = -1;
     m_id = -1;
 }
 
 AlarmRelative::AlarmRelative(service_h handle)
 {
     service_clone(&m_service_handle, handle);
-    m_Period = 0;
+    m_Period = -1;
     m_id = -1;
 }
 
index 882ea1f..4664038 100755 (executable)
@@ -144,8 +144,12 @@ JSObjectRef JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRef construct
                     priv->setByDayRecurrence(daysOfTheWeek);    
                 }
                        } else {
-                               long long interval = validator.toLongLong(1);
-                               priv->setInterval(interval);
+                               unsigned long long interval = validator.toULongLong(1);
+                               if (!JSValueIsNull(ctx, arguments[1])) {
+                                       priv->setInterval(interval);
+                               } else {
+                                       priv->setInterval(-1);
+                               }
                        }
                }
 
@@ -318,7 +322,11 @@ JSValueRef JSAlarmAbsolute::getInterval(JSContextRef ctx,
         if(alarmType == AbsoluteRecurrence::Interval) {
                    Converter converter(ctx);
             int interval = privateData->getInterval();
-            return converter.toJSValueRef(interval);
+                       if (interval == -1 ) {
+                               return JSValueMakeNull(ctx);
+                       } else {
+                   return converter.toJSValueRef(interval);
+                       }
         } else {
             return JSValueMakeNull(ctx);    
         }
index 1f40cfe..c12ed5c 100755 (executable)
@@ -114,20 +114,16 @@ bool JSAlarmRelative::hasInstance(JSContextRef context, JSObjectRef constructor,
 JSObjectRef JSAlarmRelative::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
        try {
-               AlarmRelativePtr priv = AlarmRelativePtr(new AlarmRelative());
-               if (!priv) {
-                       throw TypeMismatchException("Private object is null");
-               }
-               
            ArgumentValidator validator(ctx, argumentCount, arguments);
 
                unsigned long long delay = validator.toULongLong(0);
                unsigned long long period = validator.toULongLong(1, true, 0);
 
-               
-        priv->setDelay(validator.toULongLong(0));
-
-               return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception);
+               if ((argumentCount > 1) && !JSValueIsNull(ctx, arguments[1])) {
+                       return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception);
+               } else {
+                       return JSValueToObject(ctx, createJSObject(ctx, delay, -1), exception);
+               }
        } catch (const BasePlatformException& err) {
                JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException(ctx, err);
                *exception = exceptionObj;
@@ -293,7 +289,7 @@ JSValueRef JSAlarmRelative::getPeriod(JSContextRef ctx,
                
         period = privateData->getPeriod();
         LogInfo("JSAlarmRelative interval = " << period);
-         if(period <= 0) {
+         if(period < 0) {
             return JSValueMakeNull(ctx);
         } else {
             return converter.toJSValueRef(period);
old mode 100755 (executable)
new mode 100644 (file)
index 05b4e6c..61f264d
@@ -27,6 +27,9 @@
 
 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
 
+namespace DeviceAPI {
+namespace Alarm {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -94,3 +97,5 @@ PLUGIN_CLASS_MAP_ADD_INTERFACE(
        &ConstructorClassOptions)
 PLUGIN_CLASS_MAP_END
 
+} // Alarm
+} // DeviceAPI
index 4018899..2a139ab 100644 (file)
@@ -99,6 +99,21 @@ long AppManagerWrapper::getWatchIdAndInc()
        return ++m_watchIdAcc;
 }
 
+
+bool AppManagerWrapper::app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
+{
+       if(app_id == NULL) {
+               LogWarning("app_manager listener gave a NULL package name.");
+               return true;
+       }
+
+       std::vector<std::string> *applist = (std::vector<std::string> *)user_data;
+       applist->push_back(app_id);
+
+       return true;
+}
+
+
 void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_type,
                                                const char *appId,
                                                void *user_data)
@@ -117,29 +132,47 @@ void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_typ
 void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_type,
                                                const char *appId)
 {
-       if(appId == NULL)
-       {
-               LogWarning("app_manager listener gave a NULL package name.");
-               return;
-       }
+       package_info_h package_info;
+       std::vector<std::string> applist;
 
-       switch(event_type)
-       {
-       case APP_MANAGER_EVENT_INSTALLED:
-               appListAppInstalled(appId);
-               break;
-       case APP_MANAGER_EVENT_UNINSTALLED:
+       if (event_type == APP_MANAGER_EVENT_UNINSTALLED) {
                appListAppUninstalled(appId);
-               break;
-       case APP_MANAGER_EVENT_UPDATED:
-               appListAppUpdated(appId);
-               break;
-       default:
-               LogWarning("app_manager listener gave wrong event_type : " << event_type);
-               break;
+       } else {
+               int ret = package_manager_get_package_info(appId, &package_info);
+               if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+                       LogDebug("Cannot create package info by : " << appId);
+                       return;
+               }
+
+               ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, (void *)&applist);
+               if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+                       LogDebug("failed while getting appids");
+                       return;
+               }
+
+               ret = package_info_destroy(package_info);
+               if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+                       LogDebug("Cannot destroy package info");
+               }
+
+               for (size_t i = 0; i < applist.size(); i++) {
+                       switch(event_type)
+                       {
+                       case APP_MANAGER_EVENT_INSTALLED:
+                               appListAppInstalled(applist.at(i).c_str());
+                               break;
+                       case APP_MANAGER_EVENT_UPDATED:
+                               appListAppUpdated(applist.at(i).c_str());
+                               break;
+                       default:
+                               LogWarning("app_manager listener gave wrong event_type : " << event_type);
+                               break;
+                       }
+               }
        }
 }
 
+
 void AppManagerWrapper::appListAppInstalled(const char *appId)
 {
        LogDebug("app installed : " << appId);
index 344227f..03f5359 100644 (file)
@@ -26,6 +26,9 @@
 
 #include <app_manager.h>
 #include <package-manager.h>
+#include <package_manager.h>
+#include <package_info.h>
+
 #include "ApplicationInformation.h"
 
 // To get app size and installed time
@@ -66,6 +69,9 @@ public:
        bool initializeAppInfo(ApplicationInformationPtr &appInfo);
 
 private:
+
+       static bool app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data);
+
        // callback for app_manager_set_app_list_changed_cb
        static void appListChangedCallback(app_manger_event_type_e event_type,
                                           const char *package,
index 42bf957..5a97e77 100644 (file)
@@ -27,6 +27,7 @@
 #include "JSBluetoothDevice.h"
 #include "JSBluetoothServiceHandler.h"
 #include "JSBluetoothSocket.h"
+#include "GlobalContextManager.h"
 
 using namespace DeviceAPI::Common;
 
@@ -309,8 +310,8 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void
 {
     LogDebug("Entered");
     
-    BluetoothAdapterPtr object = static_cast<BluetoothAdapterPtr>(userData);
-    if(!object) {
+    BluetoothAdapterPtr adapter = static_cast<BluetoothAdapterPtr>(userData);
+    if(!adapter) {
         LogWarning("userData is NULL");
         return true;
     }
@@ -321,7 +322,7 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void
     }
 
     std::vector<BluetoothDeviceSharedPtr>::iterator iter;
-    for(iter = object->mFoundDevices.begin(); iter != object->mFoundDevices.end(); ++iter) {
+    for(iter = adapter->knownDevices.begin(); iter != adapter->knownDevices.end(); ++iter) {
         BluetoothDeviceSharedPtr foundDevice = *iter;
 
         if(!strcmp(foundDevice->getAddress().c_str(), deviceInfo->remote_address)) {
@@ -331,10 +332,10 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void
         }
     }
 
-    if(iter == object->mFoundDevices.end()) {
+    if(iter == adapter->knownDevices.end()) {
         LogDebug("Add a device into foundDevices");
         BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo));
-        object->mFoundDevices.push_back(device);        
+        adapter->knownDevices.push_back(device);        
     }
 
     return true;
@@ -654,6 +655,32 @@ BluetoothAdapter::~BluetoothAdapter()
     mConnectedSocket.clear();
 }
 
+void BluetoothAdapter::unloadFrame(JSContextRef context)
+{
+    LogDebug("Entered");
+
+    LogDebug("Clean mUserDataList");
+    for(int i = 0; i <= DESTROY_BONDING; i++) {
+        if(mUserDataList[i]) {
+            MultiCallbackUserDataPtr callback = mUserDataList[i];
+            if(!GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) {
+                LogDebug("reset an userData");
+                mUserDataList[i].reset();
+            }
+        }
+    }
+
+    LogDebug("Clean mConnReqMap");
+    for(ConnReqMultiMapT::iterator iter = mConnReqMap.begin(); iter != mConnReqMap.end(); ) {
+        ConnReqMultiMapT::iterator temp = iter++;
+        MultiCallbackUserDataPtr callback = temp->second->mUserData;        
+        if(!callback && !GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) {
+            LogDebug("erase a connectionRequest");
+            mConnReqMap.erase(temp);
+        }
+    }
+}
+
 void BluetoothAdapter::unregisterUUID(std::string &uuid)
 {
     LogDebug("Entered");
@@ -700,7 +727,6 @@ void BluetoothAdapter::removeConnReq(std::string &remoteAddress)
 {
     LogDebug("Entered");
 
-    ConnReqMultiMapT::iterator iter;
     mConnReqMap.erase(remoteAddress);
 
     if(mRegisteredUUID.size() == 0 && mConnReqMap.size() == 0 && mConnectedSocket.size() == 0) {
@@ -808,7 +834,7 @@ void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userD
 
         if(mUserDataList[SET_NAME] == NULL) {
             bt_adapter_set_name_changed_cb(onNameChangedCB, this);
-            mUserDataList[SET_NAME] = static_cast<MultiCallbackUserDataPtr>(userData);
+            mUserDataList[SET_NAME] = userData;
         } else {
             LogError("Already requested");
             UnknownException *error = new UnknownException("Already requested");
@@ -891,7 +917,7 @@ void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userDat
     }
 
     if(mUserDataList[SET_POWERED] == NULL) {
-        mUserDataList[SET_POWERED] = static_cast<MultiCallbackUserDataPtr>(userData);
+        mUserDataList[SET_POWERED] = userData;
     } else {
         // Already requested
         LogError("Already requested");
@@ -1018,7 +1044,7 @@ void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallb
 
         if(mUserDataList[SET_VISIBLE] == NULL) {
             bt_adapter_set_visibility_mode_changed_cb(onVisibilityChangedCB, this);
-            mUserDataList[SET_VISIBLE] = static_cast<MultiCallbackUserDataPtr>(userData);
+            mUserDataList[SET_VISIBLE] = userData;
         } else {
             UnknownException *error = new UnknownException("Already requested");
             BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error);
@@ -1060,11 +1086,12 @@ void BluetoothAdapter::discoverDevices(MultiCallbackUserDataPtr userData)
     LogDebug("Entered");
 
     if(mUserDataList[DISCOVER_DEVICES] == NULL) {
-        mUserDataList[DISCOVER_DEVICES] = static_cast<MultiCallbackUserDataPtr>(userData);
+        mUserDataList[DISCOVER_DEVICES] = userData;
         
         if(mUserDataList[STOP_DISCOVERY] == NULL)
             bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this);     
     } else {
+        LogError("Already requested");
         UnknownException *error = new UnknownException("Already requested");
         BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error);
         return;
@@ -1111,7 +1138,7 @@ void BluetoothAdapter::stopDiscovery(MultiCallbackUserDataPtr userData)
         }
 
         if(mUserDataList[STOP_DISCOVERY] == NULL) {
-            mUserDataList[STOP_DISCOVERY] = static_cast<MultiCallbackUserDataPtr>(userData);
+            mUserDataList[STOP_DISCOVERY] = userData;
             
             if(mUserDataList[DISCOVER_DEVICES] == NULL)
                 bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this);     
@@ -1172,7 +1199,7 @@ void BluetoothAdapter::createBonding(std::string &address, MultiCallbackUserData
     if(mUserDataList[CREATE_BONDING] == NULL) {
         bt_device_set_bond_created_cb(onBondCreatedCB, this);
         mCreateBondingAddress = address;
-        mUserDataList[CREATE_BONDING] = static_cast<MultiCallbackUserDataPtr>(userData);
+        mUserDataList[CREATE_BONDING] = userData;
     } else {
         LogError("Already requested");
         UnknownException *error = new UnknownException("Already requested");
@@ -1228,7 +1255,7 @@ void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDat
     if(mUserDataList[DESTROY_BONDING] == NULL) {
         bt_device_set_bond_destroyed_cb(onBondDestroyedCB, this);
         mDestroyBondingAddress = address;
-        mUserDataList[DESTROY_BONDING] = static_cast<MultiCallbackUserDataPtr>(userData);
+        mUserDataList[DESTROY_BONDING] = userData;
     } else {
         LogDebug("Already requested");
         UnknownException *error = new UnknownException("Already requested");
@@ -1330,14 +1357,15 @@ void BluetoothAdapter::returnKnownDevices(Common::MultiCallbackUserDataPtr userD
 {
     LogDebug("Entered");
 
-    if(mEnabled == true) {            
+    if(mEnabled == true) {
+        knownDevices = mFoundDevices;
         if(bt_adapter_foreach_bonded_device(foreachBondedDevicesCB, this) == BT_ERROR_NONE) {
-            if(mFoundDevices.size() > 0) { // There are found devices
+            if(knownDevices.size() > 0) { // There are found devices
                 LogDebug("There are found devices");                        
-                int num = mFoundDevices.size();
+                int num = knownDevices.size();
                 JSObjectRef devices[num];
                 for(int i = 0; i < num; i++) {
-                    JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), mFoundDevices[i]);                        
+                    JSObjectRef deviceObj = JSBluetoothDevice::createJSObject(userData->getContext(), knownDevices[i]);                        
                     devices[i] = deviceObj;
                 }
 
index 7ba7bc7..841ced6 100644 (file)
@@ -90,7 +90,7 @@ public:
     static bool isBluetoothSupported();
     static bool isValidAddress(std::string &address);
     static bool isValidUUID(std::string &uuid);
-    //void unloadFrame();
+    void unloadFrame(JSContextRef context);
     
 private:  
     BluetoothAdapter();
@@ -123,6 +123,7 @@ private:
     Common::MultiCallbackUserDataPtr mUserDataList[DESTROY_BONDING + 1];    
     std::vector<std::string> mDisappearedDevices;
     std::vector<BluetoothDeviceSharedPtr> mFoundDevices;
+    std::vector<BluetoothDeviceSharedPtr> knownDevices;
 };
 
 typedef BluetoothAdapter* BluetoothAdapterPtr;
index d8d09c2..bb7b353 100644 (file)
@@ -60,6 +60,7 @@ unsigned long BluetoothClass::getMinor() const
 JSValueRef BluetoothClass::getServices(JSContextRef context)
 {
     LogDebug("Enter");
+/*   
     JSValueRef service = mLocalProperty.getProperty(context, BLUETOOTH_CLASS_SERVICES);
     if(service == NULL) {
         service = JSUtil::toJSValueRef_(context, mServices);
@@ -67,6 +68,8 @@ JSValueRef BluetoothClass::getServices(JSContextRef context)
     }
 
     return service;
+*/
+    return JSUtil::toJSValueRef_(context, mServices);
 }
 
 bool BluetoothClass::hasService(unsigned long service)
index 4452fd6..f685247 100644 (file)
@@ -46,7 +46,7 @@ private:
     unsigned long mMajor;
     unsigned long mMinor;
     std::vector<unsigned long> mServices;
-    Common::PropertyBag mLocalProperty;    
+    //Common::PropertyBag mLocalProperty;    
 };
 
 typedef boost::shared_ptr<BluetoothClass> BluetoothClassSharedPtr;
index d99d4e0..f1a4260 100644 (file)
@@ -89,6 +89,7 @@ std::string BluetoothDevice::getAddress() const
 JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context)
 {
     LogDebug("Enter");
+    /*
     JSValueRef deviceClass = mLocalProperty.getProperty(context, BLUETOOTH_DEVICE_DEVICE_CLASS);
     if(deviceClass == NULL) {
         deviceClass = JSBluetoothClass::createJSObject(context, mDeviceClass);
@@ -96,6 +97,8 @@ JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context)
     }
     
     return deviceClass;
+    */
+    return JSBluetoothClass::createJSObject(context, mDeviceClass);
 }
 
 bool BluetoothDevice::isBonded() const
@@ -143,13 +146,15 @@ bool BluetoothDevice::isConnected() const
 JSValueRef BluetoothDevice::getUUIDs(JSContextRef context)
 {
     LogDebug("Enter");
-
+/*
     if(isUpdated == true) {
         mLocalProperty.setProperty(context, BLUETOOTH_DEVICE_UUIDS, JSUtil::toJSValueRef(context, mUUIDs));
         isUpdated = false;
     }
     
     return mLocalProperty.getProperty(context, BLUETOOTH_DEVICE_UUIDS);
+*/
+    return JSUtil::toJSValueRef(context, mUUIDs);
 }
 
 
index 14b8399..1c83925 100644 (file)
@@ -52,7 +52,7 @@ private:
     std::string mAddress;
     BluetoothClassSharedPtr mDeviceClass;
     std::vector<std::string> mUUIDs;
-    Common::PropertyBag mLocalProperty;
+    //Common::PropertyBag mLocalProperty;
     bool isUpdated;
 };
 
index c8e35f6..664575b 100644 (file)
@@ -125,6 +125,7 @@ bool BluetoothSocket::getConnectionState()
 JSValueRef BluetoothSocket::getPeer(JSContextRef context)
 {
     LogDebug("Enter");
+    /*
     JSValueRef peer = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_PEER);
     if(peer == NULL && mPeer != NULL) {
         peer = JSBluetoothDevice::createJSObject(context, mPeer);
@@ -132,6 +133,8 @@ JSValueRef BluetoothSocket::getPeer(JSContextRef context)
     }
     
     return peer;
+    */
+    return JSBluetoothDevice::createJSObject(context, mPeer);
 }
 
 MultiCallbackUserDataPtr BluetoothSocket::getOnMessage() const
index cbfc877..dfd44da 100644 (file)
@@ -148,7 +148,7 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_NAME);
@@ -169,13 +169,16 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
         }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);
+        }      
+        
+        BluetoothAdapter::getInstance()->setName(name, callback);        
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
-        BluetoothAdapter::getInstance()->setName(name, callback);
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -193,7 +196,7 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_POWERED);
@@ -215,14 +218,16 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->setPowered(state, callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -240,7 +245,7 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_SET_VISIBLE);
@@ -265,14 +270,16 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);            
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->setVisible(mode, timeout, callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -290,7 +297,7 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DISCOVER_DEVICES);
@@ -302,54 +309,56 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context,
             throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported");
         }
 
-        MultiCallbackUserDataPtr callback(
-                new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
-        if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiMultiCallbackUserData");
-        }
-
         // Validate arguments
         ArgumentValidator validator(context, argumentCount, arguments);
 
         // successCallback
         JSObjectRef successCallback = validator.toCallbackObject(0, false, "onstarted", "ondevicefound", "ondevicedisappeared", "onfinished", NULL);
 
-        // onstarted
-        JSValueRef onstartedValue = JSUtil::getProperty(context , successCallback, "onstarted");
-        if(!JSValueIsUndefined(context, onstartedValue)) {
-            LogDebug("There is a onstarted()");
-            callback->setCallback("onstarted", JSUtil::JSValueToObject(context, onstartedValue));
-        }
-
-        // ondevicefound
-        JSValueRef ondevicefoundValue = JSUtil::getProperty(context , successCallback, "ondevicefound");
-        if(!JSValueIsUndefined(context, ondevicefoundValue)) {
-            LogDebug("There is a ondevicefound()");
-            callback->setCallback("ondevicefound", JSUtil::JSValueToObject(context, ondevicefoundValue));
-        }
-        
-        // ondevicedisappeared
-        JSValueRef ondevicedisappearedValue = JSUtil::getProperty(context , successCallback, "ondevicedisappeared");
-        if(!JSValueIsUndefined(context, ondevicedisappearedValue)) {
-            LogDebug("There is a ondevicedisappeared()");
-            callback->setCallback("ondevicedisappeared", JSUtil::JSValueToObject(context, ondevicedisappearedValue));
-        }
-
-        // onfinished
-        JSValueRef onfinishedValue = JSUtil::getProperty(context , successCallback, "onfinished");
-        if(!JSValueIsUndefined(context, onfinishedValue)) {
-            LogDebug("There is a onfinished()");
-            callback->setCallback("onfinished", JSUtil::JSValueToObject(context, onfinishedValue));
-        }      
-
         // errorCallback
         JSObjectRef errorCallback = validator.toFunction(1, true);
-        callback->setCallback("error", errorCallback);
 
+        MultiCallbackUserDataPtr callback(
+                new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
+        if(!callback){
+            LogWarning("Can't create MultiMultiCallbackUserData");
+        }
+        else {
+            // onstarted
+            JSValueRef onstartedValue = JSUtil::getProperty(context , successCallback, "onstarted");
+            if(!JSValueIsUndefined(context, onstartedValue)) {
+                LogDebug("There is a onstarted()");
+                callback->setCallback("onstarted", JSUtil::JSValueToObject(context, onstartedValue));
+            }
+            
+            // ondevicefound
+            JSValueRef ondevicefoundValue = JSUtil::getProperty(context , successCallback, "ondevicefound");
+            if(!JSValueIsUndefined(context, ondevicefoundValue)) {
+                LogDebug("There is a ondevicefound()");
+                callback->setCallback("ondevicefound", JSUtil::JSValueToObject(context, ondevicefoundValue));
+            }
+            
+            // ondevicedisappeared
+            JSValueRef ondevicedisappearedValue = JSUtil::getProperty(context , successCallback, "ondevicedisappeared");
+            if(!JSValueIsUndefined(context, ondevicedisappearedValue)) {
+                LogDebug("There is a ondevicedisappeared()");
+                callback->setCallback("ondevicedisappeared", JSUtil::JSValueToObject(context, ondevicedisappearedValue));
+            }
+            
+            // onfinished
+            JSValueRef onfinishedValue = JSUtil::getProperty(context , successCallback, "onfinished");
+            if(!JSValueIsUndefined(context, onfinishedValue)) {
+                LogDebug("There is a onfinished()");
+                callback->setCallback("onfinished", JSUtil::JSValueToObject(context, onfinishedValue));
+            }      
+            
+            callback->setCallback("error", errorCallback);        
+        }
+        
         // perform       
         BluetoothAdapter::getInstance()->discoverDevices(callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -367,7 +376,7 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_STOP_DISCOVERY);
@@ -388,13 +397,15 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->stopDiscovery(callback);
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
@@ -413,7 +424,7 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_KNOWN_DEVICES);
@@ -434,13 +445,16 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->getKnownDevices(callback);
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -458,7 +472,7 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_GET_DEVICE);
@@ -480,13 +494,16 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->getDevice(address, callback);
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -504,7 +521,7 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_CREATE_BONDING);
@@ -526,14 +543,16 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->createBonding(address, callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -551,7 +570,7 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_DESTROY_BONDING);
@@ -573,13 +592,16 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->destroyBonding(address, callback);
-                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -597,7 +619,7 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Entered");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_ADAPTER_API_REGISTER_RFCOMMSERVICE_BY_UUID);
@@ -620,13 +642,16 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->registerRFCOMMServiceByUUID(uuid, name, callback);
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
index 11eb855..f685b03 100644 (file)
@@ -140,7 +140,7 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_CLASS_API_HAS_SERVICE);
@@ -163,8 +163,8 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context,
         if(service > 65535) {
             throw InvalidValuesException("Invalid value");
         }
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSUtil::toJSValueRef(context, priv->mClass->hasService(service));
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
index 9396389..c9306af 100644 (file)
@@ -157,7 +157,7 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_DEVICE_API_CONNECT_TO_SERVICE_BY_UUID);
@@ -185,14 +185,16 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);        
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         BluetoothAdapter::getInstance()->connectToServiceByUUID(remoteAddress, uuid, callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
index 50e3d3e..7d6acf1 100644 (file)
@@ -58,12 +58,6 @@ private:
             JSStringRef propertyName,
             JSValueRef* exception);
 
-    static bool setProperty(JSContextRef context,
-            JSObjectRef object,
-            JSStringRef propertyName,
-            JSValueRef value,
-            JSValueRef* exception);
-
     static JSValueRef connectToServiceByUUID(JSContextRef context,
             JSObjectRef object,
             JSObjectRef thisObject,
index 554e06a..5fb9c1d 100644 (file)
@@ -148,7 +148,7 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_MANAGER_API_GET_DEFAULT_ADAPTER);
@@ -157,8 +157,9 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context,
     try {
         if(!BluetoothAdapter::isBluetoothSupported()) {
             throw DeviceAPI::Common::NotSupportedException("Bluetooth is not supported");
-        }    
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        }
+        
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSBluetoothAdapter::createJSObject(context);
 
     } catch (const BasePlatformException &err) {
index 3591d14..6079c5a 100644 (file)
@@ -191,7 +191,7 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SERVICE_HANDLER_API_UNREGISTER);
@@ -217,14 +217,16 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context,
         MultiCallbackUserDataPtr callback(
                 new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context)));
         if(!callback){
-            throw DeviceAPI::Common::UnknownException("Can't create MultiCallbackUserData");
+            LogWarning("Can't create MultiCallbackUserData");
+        }
+        else {
+            callback->setCallback("success", successCallback);
+            callback->setCallback("error", errorCallback);
         }
         
-        callback->setCallback("success", successCallback);
-        callback->setCallback("error", errorCallback);
         priv->unregister(callback);
-
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
index d514197..2230903 100644 (file)
@@ -253,8 +253,8 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
-    
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_WRITE_DATA);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -268,7 +268,7 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context,
         // Private Object
         BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
-            throw TypeMismatchException("Private object is NULL.");
+            throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
     
         ArgumentValidator validator(context, argumentCount, arguments);
@@ -280,8 +280,8 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context,
             JSValueRef element = JSGetArrayElement(context, dataArrayObj, i);
             buffer[i] = static_cast<char>(JSUtil::JSValueToByte(context, element));
         }
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSUtil::toJSValueRef(context, priv->writeData(buffer, size));
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -299,7 +299,7 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_READ_DATA);
@@ -314,11 +314,12 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context,
         // Private Object
         BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
-            throw TypeMismatchException("Private object is NULL.");
+            throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
 
         std::vector<signed char> data = priv->readData();
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSUtil::toJSValueRef_(context, data);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
@@ -336,7 +337,7 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("Enter");
-       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+    TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     
     // Access Check
     AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(BLUETOOTH_SOCKET_API_CLOSE);
@@ -351,11 +352,12 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context,
         // Private Object
         BluetoothSocketPtr priv = static_cast<BluetoothSocketPtr>(JSObjectGetPrivate(thisObject));
         if (!priv) {
-            throw TypeMismatchException("Private object is NULL.");
+            throw DeviceAPI::Common::UnknownException("Private object is NULL.");
         }
 
         priv->close();
-               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+        
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIException::throwException(context, exception, err);
index 554b4eb..ed41c11 100644 (file)
@@ -22,7 +22,7 @@
 #include <GlobalContextManager.h>
 
 #include "JSBluetoothManager.h"
-//#include "BluetoothAdapter.h"
+#include "BluetoothAdapter.h"
 
 #include <TimeTracer.h>
 #include <Logger.h>
@@ -68,6 +68,7 @@ void on_frame_unload_callback(const void *context)
 {
     LogDebug("[Tizen\\Bluetooth] on_frame_unload_callback (%p)", context);
     GlobalContextManager::getInstance()->removeGlobalContext(static_cast<JSContextRef>(context));
+    BluetoothAdapter::getInstance()->unloadFrame(static_cast<JSContextRef>(context));
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
index 050e02e..55e4e9d 100755 (executable)
@@ -722,7 +722,6 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event)
                 LogDebug("Filter validation has passed.");
             }
 
-                       calendarFilter->setCalendarIdForEvent(calendarId);
                        genericFilter->travel(filterTraversal, 0);
 
                        if(getIsUnified()) {
index f9f3a1a..260f6db 100755 (executable)
@@ -53,6 +53,52 @@ std::map<std::string, unsigned int> CalendarFilter::m_eventAttributeMap = {
     {CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE,                 _calendar_event.freq}
 };
 
+std::map<std::string, unsigned int> CalendarFilter::m_normalInstanceAttributeMap = {
+    {CALENDAR_FILTER_ATTRIBUTE_ID_UID,                          _calendar_instance_normal_calendar_book.event_id},
+    {CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE,              _calendar_instance_normal_calendar_book.last_modified_time},
+    {CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION,                     _calendar_instance_normal_calendar_book.description},
+    {CALENDAR_FILTER_ATTRIBUTE_SUMMARY,                         _calendar_instance_normal_calendar_book.summary},
+    {CALENDAR_FILTER_ATTRIBUTE_START_DATE,                      _calendar_instance_normal_calendar_book.start_time},
+    {CALENDAR_FILTER_ATTRIBUTE_LOCATION,                        _calendar_instance_normal_calendar_book.location},
+    {CALENDAR_FILTER_ATTRIBUTE_LATITUDE,                        _calendar_instance_normal_calendar_book.latitude},
+    {CALENDAR_FILTER_ATTRIBUTE_LONGITUDE,                       _calendar_instance_normal_calendar_book.longitude},
+    //{CALENDAR_FILTER_ATTRIBUTE_ORGANIZER,                       _calendar_instance_normal_calendar_book.organizer_name},
+    {CALENDAR_FILTER_ATTRIBUTE_VISIBILITY,                      _calendar_instance_normal_calendar_book.sensitivity},
+    {CALENDAR_FILTER_ATTRIBUTE_STATUS,                          _calendar_instance_normal_calendar_book.event_status},
+    {CALENDAR_FILTER_ATTRIBUTE_ALARMS,                          _calendar_instance_normal_calendar_book.has_alarm},
+    //{CALENDAR_FILTER_ATTRIBUTE_CATEGORIES,                      _calendar_instance_normal_calendar_book.categories},
+    {CALENDAR_FILTER_ATTRIBUTE_PRIORITY,                        _calendar_instance_normal_calendar_book.priority},
+    {CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED,                     _calendar_instance_normal_calendar_book.original_event_id},
+    /*{CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY,                      _calendar_instance_normal_calendar_book.is_allday}, no meaning for instance. */
+    //{CALENDAR_FILTER_ATTRIBUTE_ATTENDEES,                       _calendar_instance_normal_calendar_book.has_attendee},
+    {CALENDAR_FILTER_ATTRIBUTE_END_DATE,                        _calendar_instance_normal_calendar_book.end_time},
+    {CALENDAR_FILTER_ATTRIBUTE_AVAILABILITY,                    _calendar_instance_normal_calendar_book.busy_status},
+    {CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE,                 _calendar_instance_normal_calendar_book.has_rrule}
+};
+
+std::map<std::string, unsigned int> CalendarFilter::m_alldayInstanceAttributeMap = {
+    {CALENDAR_FILTER_ATTRIBUTE_ID_UID,                          _calendar_instance_allday_calendar_book.event_id},
+    {CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE,              _calendar_instance_allday_calendar_book.last_modified_time},
+    {CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION,                     _calendar_instance_allday_calendar_book.description},
+    {CALENDAR_FILTER_ATTRIBUTE_SUMMARY,                         _calendar_instance_allday_calendar_book.summary},
+    {CALENDAR_FILTER_ATTRIBUTE_START_DATE,                      _calendar_instance_allday_calendar_book.start_time},
+    {CALENDAR_FILTER_ATTRIBUTE_LOCATION,                        _calendar_instance_allday_calendar_book.location},
+    {CALENDAR_FILTER_ATTRIBUTE_LATITUDE,                        _calendar_instance_allday_calendar_book.latitude},
+    {CALENDAR_FILTER_ATTRIBUTE_LONGITUDE,                       _calendar_instance_allday_calendar_book.longitude},
+    //{CALENDAR_FILTER_ATTRIBUTE_ORGANIZER,                       _calendar_instance_allday_calendar_book.organizer_name},
+    {CALENDAR_FILTER_ATTRIBUTE_VISIBILITY,                      _calendar_instance_allday_calendar_book.sensitivity},
+    {CALENDAR_FILTER_ATTRIBUTE_STATUS,                          _calendar_instance_allday_calendar_book.event_status},
+    {CALENDAR_FILTER_ATTRIBUTE_ALARMS,                          _calendar_instance_allday_calendar_book.has_alarm},
+    //{CALENDAR_FILTER_ATTRIBUTE_CATEGORIES,                      _calendar_instance_allday_calendar_book.categories},
+    {CALENDAR_FILTER_ATTRIBUTE_PRIORITY,                        _calendar_instance_allday_calendar_book.priority},
+    {CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED,                     _calendar_instance_allday_calendar_book.original_event_id},
+    /*{CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY,                      _calendar_instance_allday_calendar_book.is_allday}, no meaning for instance. */
+    //{CALENDAR_FILTER_ATTRIBUTE_ATTENDEES,                       _calendar_instance_allday_calendar_book.has_attendee},
+    {CALENDAR_FILTER_ATTRIBUTE_END_DATE,                        _calendar_instance_allday_calendar_book.end_time},
+    {CALENDAR_FILTER_ATTRIBUTE_AVAILABILITY,                    _calendar_instance_allday_calendar_book.busy_status},
+    {CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE,                 _calendar_instance_allday_calendar_book.has_rrule}
+};
+
 std::map<std::string, unsigned int> CalendarFilter::m_taskAttributeMap = {
     {CALENDAR_FILTER_ATTRIBUTE_ID,                              _calendar_todo.id},
     {CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE,              _calendar_todo.last_modified_time},
@@ -82,22 +128,38 @@ CalendarFilter::CalendarFilter()
     m_filter = NULL;
     m_recordList = NULL;
     m_recordCount = 0;
+       m_normalInstanceQuery = NULL;
+       m_normalInstanceFilter = NULL;
     m_normalInstanceRecordList = NULL;
     m_normalInstanceRecordCount = 0;
+       m_alldayInstanceQuery = NULL;
+       m_alldayInstanceFilter = NULL;
     m_alldayInstanceRecordList = NULL;
     m_alldayInstanceRecordCount = 0;
-       m_calendarId = UNDEFINED_CALENDAR_ID;
+       m_enableInstanceSearch = false;
 }
 
 CalendarFilter::~CalendarFilter()
 {
-    LogDebug("Clear internal structs for filter.");
+    LogDebug("Clear internal structs for filters.");
     if(m_query) {
         calendar_query_destroy(m_query);
     }
     if(m_filter) {
         calendar_filter_destroy(m_filter);
     }
+    if(m_normalInstanceQuery) {
+        calendar_query_destroy(m_normalInstanceQuery);
+    }
+    if(m_normalInstanceFilter) {
+        calendar_filter_destroy(m_normalInstanceFilter);
+    }
+    if(m_alldayInstanceQuery) {
+        calendar_query_destroy(m_alldayInstanceQuery);
+    }
+    if(m_alldayInstanceFilter) {
+        calendar_filter_destroy(m_alldayInstanceFilter);
+    }
 
     // Child record will be freed in the caller function.
     if(m_recordList) {
@@ -121,8 +183,12 @@ void CalendarFilter::visitInComposite(DeviceAPI::Tizen::FilterType& type, int de
        LogDebug("Composite type: "<<type);
        if(type == DeviceAPI::Tizen::UNION_FILTER) {
                calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
+               calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+               calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
        } else if(type == DeviceAPI::Tizen::INTERSECTION_FILTER) {
                calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+               calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+               calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
        }
 }
 
@@ -178,6 +244,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], intMatchFlag, value);
         } else {
             calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], intMatchFlag, value);
+            calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, value);
+            calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, value);
         }
         LogDebug("Added int filter with value: "<<value);
     } else if(CALENDAR_FILTER_ATTRIBUTE_ID_UID==attrName ||
@@ -190,10 +258,16 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], intMatchFlag, id);
         } else {
             calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], intMatchFlag, id);
+            calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, id);
+            calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, id);
 
             // Include the detached events.
             calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
             calendar_filter_add_int(m_filter, _calendar_event.original_event_id, CALENDAR_MATCH_EQUAL, id);
+            calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+            calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.original_event_id, CALENDAR_MATCH_EQUAL, id);
+            calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_OR);
+            calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.original_event_id, CALENDAR_MATCH_EQUAL, id);
         }
         LogDebug("Added int filter with id: "<<id);
     } else if(CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE==attrName ||
@@ -203,6 +277,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_lli(m_filter, m_taskAttributeMap[attrName], intMatchFlag, time);
         } else {
             calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], intMatchFlag, time);
+            calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, time);
+            calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, time);
         }
         LogDebug("Added lli filter with value: "<<time);
     } else if(CALENDAR_FILTER_ATTRIBUTE_DESCRIPTION==attrName ||
@@ -213,6 +289,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_str(m_filter, m_taskAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
         } else {
             calendar_filter_add_str(m_filter, m_eventAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
+            calendar_filter_add_str(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
+               calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str());
         }
         LogDebug("Added str filter with value: "<<matchValue->getString());
     } else if(CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY==attrName) {
@@ -220,6 +298,13 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, matchValue->getBool() ? 1 : 0);
         } else {
             calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, matchValue->getBool() ? 1 : 0);
+                       if(matchValue->getBool()) {
+                               // Exclude the normal instance table.
+                   calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[CALENDAR_FILTER_ATTRIBUTE_ID_UID], CALENDAR_MATCH_EQUAL, -999);
+                       } else {
+                               // Exclude the allday instance table.
+                   calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[CALENDAR_FILTER_ATTRIBUTE_ID_UID], CALENDAR_MATCH_EQUAL, -999);
+                       }
         }
         LogDebug("Added int filter with value: "<<matchValue->getBool());
     } else if(CALENDAR_FILTER_ATTRIBUTE_START_DATE==attrName ||
@@ -232,6 +317,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_caltime(m_filter, m_taskAttributeMap[attrName], intMatchFlag, calTime);
         } else {
             calendar_filter_add_caltime(m_filter, m_eventAttributeMap[attrName], intMatchFlag, calTime);
+            calendar_filter_add_caltime(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, calTime);
+            calendar_filter_add_caltime(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, calTime);
         }
         LogDebug("Added caltime filter with value: "<<time);
     } else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
@@ -240,6 +327,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_double(m_filter, m_taskAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
         } else {
             calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
+            calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
+            calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, matchValue->getDouble());
         }
         LogDebug("Added double filter with value: "<<matchValue->getDouble());
     } else if(CALENDAR_FILTER_ATTRIBUTE_ALARMS==attrName ||
@@ -249,7 +338,7 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
                                if( matchValue->isNullOrUndefined() ) {
                            calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
                                } else {
-            calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+                           calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
                                }
                        } else {
                    calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
@@ -258,11 +347,18 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
                        if( DeviceAPI::Tizen::MATCH_EXACTLY==matchFlag ) {
                                if( matchValue->isNullOrUndefined() ) {
                            calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
-        } else {
-            calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
-        }
+                           calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+                           calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+                       } else {
+                           calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+                           calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+                           calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+
+                       }
                        } else {
                    calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+                   calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
+                   calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1);
                        }
         }
         LogDebug("Added int filter.");
@@ -271,6 +367,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             calendar_filter_add_str(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
         } else {
             calendar_filter_add_str(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
+            calendar_filter_add_str(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
+            calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str());
         }
         LogDebug("Added str filter for categories with value: "<<matchValue->getString());
     } else if(CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED==attrName) {
@@ -278,6 +376,8 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
             LogWarning("isDetached not supported for a task.");
         } else {
             calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+            calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+            calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
         }
         LogDebug("Added int filter for isDetached with value 0.");
     } else if(CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE==attrName) {
@@ -287,12 +387,18 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat
                        if( DeviceAPI::Tizen::MATCH_EXACTLY==matchFlag ) {
                                if( matchValue->isNullOrUndefined() ) {
                            calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+                           calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
+                           calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 0);
                                } else {
                        calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+                       calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+                       calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
                        }
                        LogDebug("Added int filter for rrule EXACTLY flag.");
                        } else {
                    calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+                       calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
+                       calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0);
                        LogDebug("Added int filter for rrule.");
                        }
         }
@@ -330,145 +436,100 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen
         if(CalendarEvent::TASK_TYPE==m_type) {
                        calendar_filter_h subFilter = NULL;
                calendar_filter_create(_calendar_todo._uri, &subFilter);
-            if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
-            }
-            if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
-                calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_AND);
-            }
-            if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
-            }
-                       calendar_filter_add_filter(m_filter, subFilter);
 
                        calendar_filter_h subFilter2 = NULL;
                calendar_filter_create(_calendar_todo._uri, &subFilter2);
             if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+                calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
                 calendar_filter_add_operator(subFilter2, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+                calendar_filter_add_caltime(subFilter2, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
             }
-                       calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
-                       calendar_filter_add_filter(m_filter, subFilter2);
-        } else {
-                       calendar_filter_h subFilter = NULL;
-                       calendar_filter_create(_calendar_event._uri, &subFilter);
+                       calendar_filter_add_filter(subFilter, subFilter2);
+
+                       calendar_filter_h subFilter3 = NULL;
+               calendar_filter_create(_calendar_todo._uri, &subFilter3);
             if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+                calendar_filter_add_caltime(subFilter3, m_taskAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
-                calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(subFilter3, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
+                calendar_filter_add_caltime(subFilter3, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
             }
+                       calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_OR);
+                       calendar_filter_add_filter(subFilter, subFilter3);
+
                        calendar_filter_add_filter(m_filter, subFilter);
+        } else {
+                       calendar_filter_h subFilter = NULL;
+                       calendar_filter_create(_calendar_event._uri, &subFilter);
 
                        calendar_filter_h subFilter2 = NULL;
-               calendar_filter_create(_calendar_event._uri, &subFilter2);
+                       calendar_filter_create(_calendar_event._uri, &subFilter2);
             if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+                calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
                 calendar_filter_add_operator(subFilter2, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+                calendar_filter_add_caltime(subFilter2, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
             }
-                       calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
-                       calendar_filter_add_filter(m_filter, subFilter2);
+                       calendar_filter_add_filter(subFilter, subFilter2);
 
-                       // Corner case handling routine for a recurring event range filter.
-                       calendar_query_h normalQuery = NULL, alldayQuery = NULL;
-                       calendar_filter_h normalFilter = NULL, alldayFilter = NULL;
-               calendar_query_create(_calendar_instance_normal_calendar_book._uri, &normalQuery);
-               calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &normalFilter);
-               calendar_query_create(_calendar_instance_allday_calendar_book._uri, &alldayQuery);
-               calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &alldayFilter);
-
-                       LogDebug("Add a filter for normal instances.");
+                       calendar_filter_h subFilter3 = NULL;
+               calendar_filter_create(_calendar_event._uri, &subFilter3);
             if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+                calendar_filter_add_caltime(subFilter3, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
-                calendar_filter_add_operator(normalFilter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(subFilter3, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.end_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
+                calendar_filter_add_caltime(subFilter3, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
             }
-                       LogDebug("Add a filter for allday instances.");
+                       calendar_filter_add_operator(subFilter, CALENDAR_FILTER_OPERATOR_OR);
+                       calendar_filter_add_filter(subFilter, subFilter3);
+
+                       calendar_filter_add_filter(m_filter, subFilter);
+
+                       LogDebug("Query for normal instances.");
+                       calendar_filter_h subFilterNormal = NULL;
+                       calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &subFilterNormal);
+
             if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+                calendar_filter_add_caltime(subFilterNormal, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
-                calendar_filter_add_operator(alldayFilter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(subFilterNormal, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.end_time, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+                calendar_filter_add_caltime(subFilterNormal, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTime);
             }
-
-                       int ret;
-                       LogDebug("Query for normal instances.");
-                       if(UNDEFINED_CALENDAR_ID!=m_calendarId) {
-                               LogDebug("Set the calendar id for normal instances: "<<m_calendarId);
-                       calendar_filter_add_operator(normalFilter, CALENDAR_FILTER_OPERATOR_AND);
-                       calendar_filter_add_int(normalFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, m_calendarId);
-                       }
-                       ret = calendar_query_set_filter(normalQuery, normalFilter);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Setting a normal filter failed: "<<ret);
-                       }
-                       ret = calendar_db_get_records_with_query(normalQuery, 0, 0, &m_normalInstanceRecordList);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Getting a normal record list failed: "<<ret);
-                       }
-                       ret = calendar_list_get_count(m_normalInstanceRecordList, &m_normalInstanceRecordCount);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Can't get the normal item count: "<<ret);
-                       } else {
-                               LogDebug("Normal instance item count: "<<m_normalInstanceRecordCount);
-                       }
+                       calendar_filter_add_filter(m_normalInstanceFilter, subFilterNormal);
 
                        LogDebug("Query for allday instances.");
-                       if(UNDEFINED_CALENDAR_ID!=m_calendarId) {
-                               LogDebug("Set the calendar id for allday instances: "<<m_calendarId);
-                       calendar_filter_add_operator(alldayFilter, CALENDAR_FILTER_OPERATOR_AND);
-                       calendar_filter_add_int(alldayFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, m_calendarId);
-                       }
-                       ret = calendar_query_set_filter(alldayQuery, alldayFilter);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Setting an allday filter failed: "<<ret);
-                       }
-                       ret = calendar_db_get_records_with_query(alldayQuery, 0, 0, &m_alldayInstanceRecordList);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Getting an allday record list failed: "<<ret);
-                       }
-                       ret = calendar_list_get_count(m_alldayInstanceRecordList, &m_alldayInstanceRecordCount);
-                       if( CALENDAR_ERROR_NONE!=ret ) {
-                               ThrowMsg(PlatformException, "Can't get the allday item count: "<<ret);
-                       } else {
-                               LogDebug("Allday instance item count: "<<m_alldayInstanceRecordCount);
-                       }
-
+                       calendar_filter_h subFilterAllday = NULL;
+                       calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &subFilterAllday);
 
+            if (!initialValue->isNullOrUndefined()) {
+                calendar_filter_add_caltime(subFilterAllday, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+            }
+            if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+                calendar_filter_add_operator(subFilterAllday, CALENDAR_FILTER_OPERATOR_AND);
+            }
+            if (!endValue->isNullOrUndefined()) {
+                calendar_filter_add_caltime(subFilterAllday, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endTimeAllday);
+            }
+                       calendar_filter_add_filter(m_alldayInstanceFilter, subFilterAllday);
 
-                       LogDebug("Free queries and filters.");
-                       if(normalQuery) {
-                               calendar_query_destroy(normalQuery);
-                       }
-                       if(normalFilter) {
-                               calendar_filter_destroy(normalFilter);
-                       }
-                       if(alldayQuery) {
-                               calendar_query_destroy(alldayQuery);
-                       }
-                       if(alldayFilter) {
-                               calendar_filter_destroy(alldayFilter);
-                       }
+                       LogDebug("Enable the instance table search.");
+                       m_enableInstanceSearch = true;
         }
         LogDebug("Added caltime range filter with initial value: "<<startTime.time.utime<<", end value: "<<endTime.time.utime);
     } else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
@@ -486,12 +547,18 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen
         } else {
             if (!initialValue->isNullOrUndefined()) {
                 calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
+                calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
+                calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getDouble());
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
                 calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
                 calendar_filter_add_double(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
+                calendar_filter_add_double(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
+                calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getDouble());
             }
         }
         LogDebug("Added double range filter with initial value: "<<initialValue->getDouble()<<", end value: "<<endValue->getDouble());
@@ -510,12 +577,18 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen
         } else {
             if (!initialValue->isNullOrUndefined()) {
                 calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
+                calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
+                calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, getTimeTFromTZDateAny(initialValue));
             }
             if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
                 calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+                calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
             }
             if (!endValue->isNullOrUndefined()) {
                 calendar_filter_add_lli(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
+                calendar_filter_add_lli(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
+                calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue));
             }
         }
         LogDebug("Added lli range filter with initial value: "<<getTimeTFromTZDateAny(initialValue)<<", end value: "<<getTimeTFromTZDateAny(endValue));
@@ -531,15 +604,7 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen
                 calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getLong());
             }
         } else {
-            if (!initialValue->isNullOrUndefined()) {
-                calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, initialValue->getLong());
-            }
-            if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
-                calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
-            }
-            if (!endValue->isNullOrUndefined()) {
-                calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getLong());
-            }
+                       LogWarning("progress not supported for an event");
         }
         LogDebug("Added double range filter with initial value: "<<initialValue->getLong()<<", end value: "<<endValue->getLong());
     } else {
@@ -559,13 +624,38 @@ void CalendarFilter::setType(CalendarEvent::CalendarType type)
         m_type = CalendarEvent::EVENT_TYPE;
         calendar_query_create(_calendar_event._uri, &m_query);
         calendar_filter_create(_calendar_event._uri, &m_filter);
+
+        calendar_query_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceQuery);
+        calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceFilter);
+        calendar_query_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceQuery);
+        calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceFilter);
     }
 }
 
 void CalendarFilter::setCalendarId(int calendarId, bool isFilterSet)
 {
     if( isFilterSet ) {
-        calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+               calendar_filter_h m_superFilter = NULL;
+               calendar_filter_h m_normalInstanceSuperFilter = NULL;
+               calendar_filter_h m_alldayInstanceSuperFilter = NULL;
+           if(CalendarEvent::TASK_TYPE==m_type) {
+                       calendar_filter_create(_calendar_todo._uri, &m_superFilter);
+                       calendar_filter_add_filter(m_superFilter, m_filter);
+               } else {
+                       calendar_filter_create(_calendar_event._uri, &m_superFilter);
+                       calendar_filter_add_filter(m_superFilter, m_filter);
+               }
+               calendar_filter_create(_calendar_instance_normal_calendar_book._uri, &m_normalInstanceSuperFilter);
+               calendar_filter_add_filter(m_normalInstanceSuperFilter, m_normalInstanceFilter);
+               calendar_filter_create(_calendar_instance_allday_calendar_book._uri, &m_alldayInstanceSuperFilter);
+               calendar_filter_add_filter(m_alldayInstanceSuperFilter, m_alldayInstanceFilter);
+
+               m_filter = m_superFilter;
+               m_normalInstanceFilter= m_normalInstanceSuperFilter;
+               m_alldayInstanceFilter = m_alldayInstanceSuperFilter;
+               calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
+               calendar_filter_add_operator(m_normalInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
+               calendar_filter_add_operator(m_alldayInstanceFilter, CALENDAR_FILTER_OPERATOR_AND);
     }
 
     if(CalendarEvent::TASK_TYPE==m_type) {
@@ -580,19 +670,20 @@ void CalendarFilter::setCalendarId(int calendarId, bool isFilterSet)
     } else {
                if(CALENDAR_BOOK_FILTER_ALL==calendarId) {
                        calendar_filter_add_int(m_filter, _calendar_event.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
+                       calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
+                       calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_GREATER_THAN, calendarId);
                } else {
                calendar_filter_add_int(m_filter, _calendar_event.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
+               calendar_filter_add_int(m_normalInstanceFilter, _calendar_instance_normal_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
+               calendar_filter_add_int(m_alldayInstanceFilter, _calendar_instance_allday_calendar_book.calendar_book_id, CALENDAR_MATCH_EQUAL, calendarId);
                }
+
+               /* No matching is_deleted field for instance tables. */
         calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_AND);
         calendar_filter_add_int(m_filter, _calendar_event.is_deleted, CALENDAR_MATCH_EQUAL, 0);
     }
 }
 
-void CalendarFilter::setCalendarIdForEvent(int calendarId)
-{
-       m_calendarId = calendarId;
-}
-
 void CalendarFilter::setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr)
 {
        std::string attrName;
@@ -607,12 +698,16 @@ void CalendarFilter::setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr)
                        calendar_query_set_sort(m_query, m_taskAttributeMap[attrName], true);
             } else {
                        calendar_query_set_sort(m_query, m_eventAttributeMap[attrName], true);
+                       calendar_query_set_sort(m_normalInstanceQuery, m_normalInstanceAttributeMap[attrName], true);
+                       calendar_query_set_sort(m_alldayInstanceQuery, m_alldayInstanceAttributeMap[attrName], true);
             }
                } else {
             if(CalendarEvent::TASK_TYPE==m_type) {
                        calendar_query_set_sort(m_query, m_taskAttributeMap[attrName], false);
             } else {
                        calendar_query_set_sort(m_query, m_eventAttributeMap[attrName], false);
+                       calendar_query_set_sort(m_normalInstanceQuery, m_normalInstanceAttributeMap[attrName], false);
+                       calendar_query_set_sort(m_alldayInstanceQuery, m_alldayInstanceAttributeMap[attrName], false);
             }
                }
        } else {
@@ -639,6 +734,41 @@ void CalendarFilter::executeQuery()
     } else {
         LogDebug("Item count: "<<m_recordCount);
     }
+
+       if(m_enableInstanceSearch) {
+               LogDebug("Perform query for instances.");
+           ret = calendar_query_set_filter(m_normalInstanceQuery, m_normalInstanceFilter);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Setting a normal instance filter failed: "<<ret);
+           }
+               ret = calendar_db_get_records_with_query(m_normalInstanceQuery, 0, 0, &m_normalInstanceRecordList);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Getting a normal instance record list failed: "<<ret);
+           }
+           ret = calendar_list_get_count(m_normalInstanceRecordList, &m_normalInstanceRecordCount);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Can't get a normal instance item count: "<<ret);
+           } else {
+               LogDebug("Normal instance item count: "<<m_normalInstanceRecordCount);
+           }
+
+           ret = calendar_query_set_filter(m_alldayInstanceQuery, m_alldayInstanceFilter);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Setting an allday instance filter failed: "<<ret);
+           }
+               ret = calendar_db_get_records_with_query(m_alldayInstanceQuery, 0, 0, &m_alldayInstanceRecordList);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Getting an allday instance record list failed: "<<ret);
+           }
+           ret = calendar_list_get_count(m_alldayInstanceRecordList, &m_alldayInstanceRecordCount);
+           if( CALENDAR_ERROR_NONE!=ret ) {
+               ThrowMsg(PlatformException, "Can't get an allday instance item count: "<<ret);
+           } else {
+               LogDebug("Allday instance item count: "<<m_alldayInstanceRecordCount);
+           }
+       } else {
+               LogDebug("No need to perform query for instances.");
+       }
 }
 
 int CalendarFilter::getResultRecordCount() const
index 21106f9..a092450 100755 (executable)
@@ -63,14 +63,22 @@ private:
        calendar_filter_h m_filter;
     calendar_list_h m_recordList;
     int m_recordCount;
-       // Corner case handling for recurring event range filter.
+
+       // Additional filters for recurring event range filter.
+       calendar_query_h m_normalInstanceQuery;
+       calendar_filter_h m_normalInstanceFilter;
     calendar_list_h m_normalInstanceRecordList;
     int m_normalInstanceRecordCount;
+       calendar_query_h m_alldayInstanceQuery;
+       calendar_filter_h m_alldayInstanceFilter;
     calendar_list_h m_alldayInstanceRecordList;
     int m_alldayInstanceRecordCount;
-       int m_calendarId;
+
+       bool m_enableInstanceSearch;
 
        static std::map<std::string, unsigned int> m_eventAttributeMap;
+       static std::map<std::string, unsigned int> m_normalInstanceAttributeMap;
+       static std::map<std::string, unsigned int> m_alldayInstanceAttributeMap;
        static std::map<std::string, unsigned int> m_taskAttributeMap;
 
 public:
@@ -96,7 +104,6 @@ public:
     void setType(CalendarEvent::CalendarType type);
 
     void setCalendarId(int calendarId, bool isFilterSet);
-    void setCalendarIdForEvent(int calendarId);
 
        void setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr);
 
index a28ab1d..ff00318 100755 (executable)
@@ -76,7 +76,7 @@ public:
                if(!initialValue->isNullOrUndefined() && initialValue->getPriv() == NULL)
                        return false;
 
-               if(!endValue->isNullOrUndefined() && initialValue->getPriv() == NULL)
+               if(!endValue->isNullOrUndefined() && endValue->getPriv() == NULL)
                        return false;
 
                return true;
index 0defb46..e99a712 100755 (executable)
@@ -214,6 +214,7 @@ JSValueRef JSCalendarManager::getDefaultCalendar(JSContextRef context,
 
         if (dplEvent->getResult()) {
             if( dplEvent->getCalendar() ) {
+                               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                 return converter.toJSValueRefCalendar(dplEvent->getCalendar());
             } else {
                 LogError("Default calendar not found.");
index 015e057..a9a89d1 100755 (executable)
@@ -34,6 +34,7 @@
 #include <JSWebAPIError.h>
 #include <ArgumentValidator.h>
 #include <TimeTracer.h>
+#include <Logger.h>
 
 #include "JSCallHistoryEntry.h"
 #include "JSCallHistory.h"
@@ -151,26 +152,6 @@ JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjec
        bool bSuccess = false;
        bool bError = false;
 
-
-    try{
-        ArgumentValidator validator(context, argumentCount, arguments);
-
-               JSObjectRef successCB = validator.toFunction(0);
-               if(successCB)
-                       bSuccess = true;
-
-               JSObjectRef errCB = validator.toFunction(1, true);
-               if(errCB)
-                       bError = true;
-
-               unsigned long limit = validator.toULong(4, true);
-               unsigned long offset = validator.toULong(5, true);
-
-    }catch(const BasePlatformException& err){
-        return JSWebAPIError::throwException(context, exception, err);
-    }
-
-
        if (argumentCount < 1) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
        }
@@ -187,7 +168,21 @@ JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjec
 
        JSCallbackManagerPtr cbm(JSCallbackManager::createObject(gContext));
 
-       try {
+
+    try{
+        ArgumentValidator validator(context, argumentCount, arguments);
+
+               JSObjectRef successCB = validator.toFunction(0);
+               if(successCB)
+                       bSuccess = true;
+
+               JSObjectRef errCB = validator.toFunction(1, true);
+               if(errCB)
+                       bError = true;
+
+               unsigned long limit = validator.toULong(4, true);
+               unsigned long offset = validator.toULong(5, true);
+
                if (argumentCount >= 1) {
                        if (JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
                                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error : success callback ");
@@ -226,7 +221,7 @@ JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjec
                event->setForAsynchronousCall(&ResponseDispatcher::getInstance());
 
                if (argumentCount >= 3) {
-                       if (!check.isNullOrUndefined(arguments[2])) {
+                       if(!JSValueIsNull(context, arguments[2])){
                                FilterPtr filter = filterConverter->toFilter(arguments[2]);
 
                                if(filter == NULL){
@@ -234,12 +229,22 @@ JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjec
                                }else{
                                        event ->setFilter(filter);
                                }
+                       }else if(JSValueIsUndefined(context, arguments[2])) {
+                                       throw DeviceAPI::Common::TypeMismatchException("Filter is undefined");
                        }
                }
 
                if (argumentCount >= 4) {
-                       if (!check.isNullOrUndefined(arguments[3])) {
-                               event->setSortMode(filterConverter->toSortMode(arguments[3]));
+                       if (!JSValueIsNull(context, arguments[3])) {
+                               DeviceAPI::Tizen::SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
+
+                               if(sortMode == NULL){
+                                       throw DeviceAPI::Common::TypeMismatchException("Invalid Sortmode");
+                               }else{
+                                       event->setSortMode(filterConverter->toSortMode(arguments[3]));
+                               }
+                       }else if(JSValueIsUndefined(context, arguments[3])) {
+                                       throw DeviceAPI::Common::TypeMismatchException("Sortmode is undefined");
                        }
                }
 
@@ -256,7 +261,9 @@ JSValueRef JSCallHistory::find(JSContextRef context, JSObjectRef object, JSObjec
                }
                callHistory->find(event);
                CallHistoryAsyncCallbackManagerSingleton::Instance().registerCallbackManager(cbm, gContext);
-       } catch(const BasePlatformException& err) {
+       } catch(const BasePlatformException& err){
+        return JSWebAPIError::throwException(context, exception, err);
+    } catch(const BasePlatformException& err) {
                return JSWebAPIError::throwException(context, exception, err);
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
index e137f85..6e4899d 100755 (executable)
@@ -27,6 +27,9 @@
 
 #define CALLHISTORY "callhistory"
 
+namespace DeviceAPI {
+namespace CallHistory {
+
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
 
@@ -77,3 +80,5 @@ PLUGIN_CLASS_MAP_BEGIN
         NULL)
 PLUGIN_CLASS_MAP_END
 
+} // CallHistory
+} // DeviceAPI
index 9f7c67c..fa5b548 100755 (executable)
@@ -14,6 +14,7 @@ SET(SRCS
   JSWebAPIError2.cpp
   WebAPIError.cpp
   PropertyBag.cpp
+  JSArray.cpp
 )
 
 ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
diff --git a/src/Common/JSArray.cpp b/src/Common/JSArray.cpp
new file mode 100755 (executable)
index 0000000..3e60e9b
--- /dev/null
@@ -0,0 +1,48 @@
+#include "JSArray.h"
+#include "PlatformException.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+JSArrayBase::JSArrayBase( JSContextRef context, JSObjectRef array ):mContext(context), mArray(array){
+    if(!JSIsArrayValue(context, array)){
+        throw TypeMismatchException("The type is not array");
+    }
+    JSValueProtect(context, array);
+}
+
+JSArrayBase::JSArrayBase( JSContextRef context):mContext(context){
+    JSValueRef exception = NULL;
+    mArray = JSObjectMakeArray( context, 0, NULL, &exception);
+    if(exception != NULL){
+        throw UnknownException(context, exception);
+    }
+}
+
+JSArrayBase::~JSArrayBase(){
+    JSValueUnprotect(mContext, mArray);
+}
+
+size_t JSArrayBase::size() const {
+    return JSGetArrayLength(mContext, mArray);
+}
+
+void JSArrayBase::resize(size_t size){
+    JSUtil::setProperty(mContext, mArray, "length", JSUtil::toJSValueRef(mContext, static_cast<double>(size)), NULL, NULL);
+}
+
+JSValueRef JSArrayBase::get(int index) const{
+    return JSGetArrayElement(mContext, mArray, index);
+}
+
+bool JSArrayBase::set( int index, JSValueRef value){
+    bool t = JSSetArrayElement(mContext, mArray, index, value);
+    return t;
+}
+
+bool JSArrayBase::append( JSValueRef value ){
+    return set( size(), value);
+}
+
+}//Common
+}//DeviceAPI
diff --git a/src/Common/JSArray.h b/src/Common/JSArray.h
new file mode 100755 (executable)
index 0000000..c27ca21
--- /dev/null
@@ -0,0 +1,171 @@
+//
+// 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.
+//
+
+#ifndef __TIZEN_COMMON_JSARRAY_H__
+#define __TIZEN_COMMON_JSARRAY_H__
+#include <JavaScriptCore/JavaScript.h>
+#include <vector>
+#include "JSUtil.h"
+
+namespace DeviceAPI {
+namespace Common {
+
+class JSArrayBase{
+public:
+    JSArrayBase( JSContextRef context, JSObjectRef array );
+    JSArrayBase( JSContextRef context );
+
+    virtual ~JSArrayBase();
+    size_t size() const;
+    void resize(size_t size);
+    JSValueRef get(int index) const;
+    bool set(int index, JSValueRef value);
+    bool append(JSValueRef value);
+    
+protected:
+    JSContextRef mContext;
+    JSObjectRef mArray;
+};
+
+
+template <typename T>
+class JSArray : protected JSArrayBase{
+    friend class ItemProxy;
+public:
+    typedef JSValueRef (*ToJSFunction)(JSContextRef, T);
+    typedef T (*ToNativeFunction)(JSContextRef, JSValueRef );
+
+
+    JSArray( JSContextRef context, JSObjectRef array, ToNativeFunction nativefun, ToJSFunction jsfun)
+       :JSArrayBase(context,array),mToNative(nativefun), mToJs(jsfun) {
+    }
+    JSArray( JSContextRef context, ToNativeFunction nativefun, ToJSFunction jsfun)
+       :JSArrayBase(context),mToNative(nativefun), mToJs(jsfun) {
+    }
+
+    ~JSArray(){
+    }
+
+    class ItemProxy {
+        JSArray<T> *mArray;
+        int mIndex;
+        public:
+            ItemProxy(JSArray<T>* array, int index):mArray(array), mIndex(index){
+            }
+            operator T(){
+                return mArray->mToNative(mArray->mContext, mArray->get(mIndex));
+            }
+            ItemProxy& operator=( const T native){
+                JSValueRef v = mArray->mToJs(mArray->mContext, native);
+                mArray->set(mIndex, v);
+                return *this;
+            }
+            ItemProxy& operator=( const ItemProxy& other){
+                JSValueRef v = other.mArray->get(other.mIndex);
+                mArray->set(mIndex, v);
+                return *this;
+            }
+
+    };
+    size_t size() const{
+        return JSArrayBase::size();
+    }
+
+    void resize(size_t size){
+        JSArrayBase::resize(size);
+    }
+
+    bool append( T v){
+        return JSArrayBase::set( size(), mToJs(mContext, v));
+    }
+
+    ItemProxy operator[]( int index ){
+        return ItemProxy(this, index);
+    }
+
+    operator JSObjectRef(){
+        return mArray;
+    }
+    
+    operator std::vector<T>(){
+        std::vector<T> v;
+        size_t length = size();
+        for( unsigned int i = 0 ; i < length ; i++){          
+            JSValueRef t = get(i);
+            T tmp = mToNative(mContext, t);
+            v.push_back(tmp);
+        }
+        return v;
+    }
+
+    void operator=( const std::vector<T>& list ){
+        overwrite(list);
+    }
+
+    void operator=( const JSArray<T>& rhs){
+        resize(rhs.size());
+        for(unsigned int i = 0 ; i < rhs.size(); i++){
+            set(i, rhs.get(i));
+        }
+    }
+
+protected:
+    void overwrite( const std::vector<T>& list ){
+        unsigned int i;
+        unsigned int listSize = list.size();
+        resize(listSize);
+        for( i = 0 ; i < listSize ; i++){
+            JSValueRef v = mToJs(mContext, list[i]);
+            set(i, v);
+        }
+    }
+        
+
+
+
+private:
+    ToNativeFunction mToNative;
+    ToJSFunction mToJs;
+};
+
+
+class JSStringArray : public JSArray<std::string>{
+    static JSValueRef makeJSValue(JSContextRef ctx, std::string v){
+        return JSUtil::toJSValueRef(ctx, v);
+    }
+    public:
+        JSStringArray(JSContextRef ctx, JSObjectRef array): JSArray<std::string>(ctx, array, JSUtil::JSValueToString, makeJSValue){}
+        JSStringArray(JSContextRef ctx): JSArray<std::string>(ctx, JSUtil::JSValueToString, makeJSValue){}      
+        void operator=( const std::vector<std::string>& list ){overwrite(list);}
+};
+
+
+class JSLongArray : public JSArray<long>{
+    static JSValueRef makeJSValue(JSContextRef ctx, long v){
+        return JSUtil::toJSValueRef(ctx, v);
+    }
+    public:
+        JSLongArray(JSContextRef ctx, JSObjectRef array): JSArray<long>(ctx, array, JSUtil::JSValueToLong, makeJSValue){}
+        JSLongArray(JSContextRef ctx): JSArray<long>(ctx, JSUtil::JSValueToLong, makeJSValue){}
+        void operator=( const std::vector<long>& list ){overwrite(list);}
+
+};
+
+
+
+
+}
+}
+#endif //__TIZEN_COMMON_JSARRAY_H__
+
index d384d65..39c04fe 100755 (executable)
@@ -24,6 +24,8 @@
 #include <GlobalContextManager.h>
 #include <string>
 #include <vector>
+#include <iostream>
+#include <termios.h>
 
 #undef LOG_TAG
 #define LOG_TAG "TIZEN_DEVICEAPI"
@@ -31,7 +33,6 @@
 using namespace std;
 using namespace DeviceAPI::Common;
 
-
 namespace DeviceAPI {
 namespace Test {
 
@@ -374,24 +375,147 @@ void StandaloneConsole::appendModule(const char * name, JSObjectRef module){
     setProperty(mGlobalContext, mGlobalObject, name, module, kJSPropertyAttributeReadOnly);
 }
 
+
+int getch(void)
+{
+    int ch;
+    struct termios buf;
+    struct termios save;
+
+    tcgetattr(0, &save);
+    buf = save;
+    buf.c_lflag &= ~(ICANON|ECHO);
+    buf.c_cc[VMIN] = 1;
+    buf.c_cc[VTIME] = 0;
+    tcsetattr(0, TCSAFLUSH, &buf);
+    ch = getchar();
+    tcsetattr(0, TCSAFLUSH, &save);
+    return ch;
+}
+
+struct termios gSave;
+
+void onExit(void)
+{
+    tcsetattr(0, TCSAFLUSH, &gSave);
+}
+
+class LineBuffer{
+    vector<string> mHistory;
+    string mLine;
+    int mHistoryIndex;
+    char mCurrentPos;
+public:
+    LineBuffer():mHistoryIndex(0), mCurrentPos(0){
+        tcgetattr(0, &gSave);
+        atexit(onExit);
+    }
+    ~LineBuffer(){
+        tcsetattr(0, TCSAFLUSH, &gSave);
+    }
+
+    void backSpace( int length ){
+        for( int i =0 ; i < length ; i++){
+            putchar('\b');
+            putchar(' ');
+            putchar('\b');
+        }
+    }
+    void applyHistory( unsigned int index ){
+        if( mHistory.size() > index ){
+            mLine = mHistory[index];
+            mCurrentPos = mLine.size();
+        }
+    }
+    bool checkSpecialKeys(int a){
+        if( a == 8 ){
+            if( mLine.size() != 0){
+                mCurrentPos--;
+                mLine.erase(mCurrentPos);
+            }
+            return true;
+        }
+        if( a == 27 ){
+            a = getch(); // 91
+            a = getch();
+            switch( a ){
+                case 65:
+                    //UP
+                    if( mHistoryIndex > 0 ){
+                        applyHistory(--mHistoryIndex);
+                    }
+                    break;
+                case 66:
+                    //DOWN
+                    if( (unsigned)mHistoryIndex < mHistory.size() ){
+                        applyHistory(++mHistoryIndex);
+                    }
+                    break;
+                case 67:
+                    //RIGHT
+                    break;
+                case 68:
+                    //LEFT
+                    break;
+                case 51:
+                    getch();
+                    backSpace(1);
+                    break;
+                default:
+                    getch();
+            }
+
+            return true;
+        }
+        return false;
+    }
+
+    string Prompt(const char * prompt){
+        printf("%s", prompt);
+        mCurrentPos = 0;
+        mLine.clear();
+        while(1){
+            int a = getch();
+            backSpace(mLine.size());
+            if( a == 10 )
+                break;
+
+            if(!checkSpecialKeys(a)){
+                mLine.insert(mCurrentPos,1, a);
+                mCurrentPos++;
+            }
+            cout << mLine;
+        }
+        cout << mLine;
+        if( mLine.size() > 0 ){
+            mHistory.push_back(mLine);
+            mHistoryIndex = mHistory.size();
+        }
+        return mLine;
+    }
+
+};
+
+
+
 void StandaloneConsole::commandline(StandaloneConsole* console){
     pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
     pthread_mutex_lock(&lock);
     printf("command line mode ( \"quit\" for exit  )\n");
+    LineBuffer linebuff;
     while(1){
-        char line[1024];
-        printf(">");
-        if( gets(line) == NULL )
-            break;
-        if( strcmp(line, "quit") == 0 )
+        string line = linebuff.Prompt(">");
+        printf("\n");
+
+        if( line == "quit" )
             break;
-        if( strcmp(line, "gc") == 0 ){
+        if( line == "gc" ){
             console->GarbageCollect();
             continue;
         }
-        if( strcmp(line, "") == 0 )
+        if( line.size() == 0 )
             continue;
-        _Command *cmd = new _Command(line, console, &lock);
+        _Command *cmd = new _Command(line.c_str(), console, &lock);
         // for thread safety
         ecore_idler_add(commandDispath, cmd);
         pthread_mutex_lock(&lock);
index 9348157..5d1d0d7 100644 (file)
@@ -184,23 +184,15 @@ int time_tracer_item_begin(const char* name, int show, const char* filename, int
                item = g_items[index];
        }
 
-       // 2. Verify pairs of begin, end
-       if (item->on_tracing)
-       {
-               LOGE("[%s] (Name : %s) is not 'end'ed!",__FUNCTION__, item->name);
-               item->mismatch_count ++;
-               return -1;
-       }
 
-       // 3. Gets the timestamp
+       // 2. Gets the timestamp
        gettimeofday( &t, NULL );
        item->timestamp = t.tv_sec*1000000L + t.tv_usec;
 #ifdef TIME_TRACER_UNIT_MSEC
        item->timestamp = ( item->timestamp >= 1000) ? item->timestamp/1000 : 0;
 #endif
 
-       //set tracing on
-       item->on_tracing = 1;
+
        if (item->first_timestamp == 0) // in case of first
        {
                //set first timestamp
@@ -208,6 +200,18 @@ int time_tracer_item_begin(const char* name, int show, const char* filename, int
                if (g_first_time > item->first_timestamp)
                        g_first_time = item->first_timestamp;
        }
+
+       // 3. Verify pairs of begin, end
+       if (item->on_tracing)
+       {
+               LOGE("[%s] (Name : %s) is not 'end'ed!",__FUNCTION__, item->name);
+               item->mismatch_count ++;
+               return -1;
+       }
+
+       //set tracing on
+       item->on_tracing = 1;
+
        if (show)
        {
                LOGE("[%s][BEGIN] %s (at %s:%d)", __FUNCTION__,name, filename, line );
index 4e4f9d0..63ee1f5 100755 (executable)
@@ -7,7 +7,7 @@ PKG_CHECK_MODULES(platform_pkgs_contact REQUIRED contacts-service2 libpcrecpp)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Tizen
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${platform_pkgs_contact_INCLUDE_DIRS}
 )
 
index f42cf0e..7f6587e 100755 (executable)
@@ -52,6 +52,7 @@
 #include <ArgumentValidator.h>
 #include <JSWebAPIError.h>
 #include <JSUtil.h>
+#include <TimeTracer.h>
 
 using namespace std;
 
@@ -272,6 +273,7 @@ JSValueRef JSAddressBook::get(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -350,6 +352,7 @@ JSValueRef JSAddressBook::get(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -361,6 +364,7 @@ JSValueRef JSAddressBook::add(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -433,6 +437,7 @@ JSValueRef JSAddressBook::add(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -444,6 +449,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -523,6 +529,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -535,6 +542,7 @@ JSValueRef JSAddressBook::update(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -611,6 +619,7 @@ JSValueRef JSAddressBook::update(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -622,6 +631,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -702,6 +712,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -714,6 +725,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
 
@@ -776,7 +788,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -788,6 +800,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -867,6 +880,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -879,6 +893,7 @@ JSValueRef JSAddressBook::find(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -972,6 +987,7 @@ JSValueRef JSAddressBook::find(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -984,6 +1000,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -1112,7 +1129,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context,
                LogError("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -1124,6 +1141,7 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        JSContextRef gContext;
        AddressBookController *controller;
@@ -1187,7 +1205,7 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -1199,6 +1217,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -1280,7 +1299,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception,
                                JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -1292,6 +1311,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -1367,7 +1387,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -1379,6 +1399,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -1458,7 +1479,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -1470,6 +1491,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
 
@@ -1538,7 +1560,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -1550,6 +1572,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        AddressBookPtr addressBook;
        AddressBookController *controller;
        JSContextRef gContext;
@@ -1619,7 +1642,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception,
                                JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
index 5afa7b2..2219cd7 100755 (executable)
@@ -35,6 +35,7 @@
 #include "Contact.h"
 #include <ArgumentValidator.h>
 #include <JSWebAPIError.h>
+#include <TimeTracer.h>
 
 #define FILTER_CLASS_NAME "Contact"
 
@@ -1139,6 +1140,7 @@ JSValueRef JSContact::convertToString(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactPtr contact(NULL);
 
        Try     {
@@ -1191,7 +1193,7 @@ JSValueRef JSContact::convertToString(JSContextRef context,
                LogError("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -1203,6 +1205,7 @@ JSValueRef JSContact::clone(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactPtr contact(NULL);
 
        Try     {
@@ -1239,7 +1242,7 @@ JSValueRef JSContact::clone(JSContextRef context,
                LogError("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
index 61ad0db..bea6ce9 100755 (executable)
@@ -47,6 +47,7 @@
 #include "ContactFilterConverter.h"
 #include <ArgumentValidator.h>
 #include <JSWebAPIError.h>
+#include <TimeTracer.h>
 
 namespace DeviceAPI {
 namespace Contact {
@@ -138,6 +139,7 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("Entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr contactManager;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -202,6 +204,7 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -214,6 +217,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("Entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerController *priv =
                static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
        if (!priv) {
@@ -277,6 +281,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return resultValue;
 }
 
@@ -288,6 +293,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("Entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerController *priv =
                static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
        if (!priv) {
@@ -351,6 +357,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return resultValue;
 }
 
@@ -362,6 +369,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("Entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerController *priv =
                static_cast<ContactManagerController*>(JSObjectGetPrivate(thisObject));
        if (!priv) {
@@ -440,6 +448,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return resultValue;
 }
 
@@ -451,6 +460,7 @@ JSValueRef JSContactManager::get(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        ContactManagerController *controller;
 
@@ -532,6 +542,7 @@ JSValueRef JSContactManager::get(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -543,6 +554,7 @@ JSValueRef JSContactManager::update(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        ContactManagerController *controller;
 
@@ -616,6 +628,7 @@ JSValueRef JSContactManager::update(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -627,6 +640,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -708,6 +722,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context,
                                JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -720,6 +735,7 @@ JSValueRef JSContactManager::remove(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        ContactManagerController *controller;
 
@@ -789,6 +805,7 @@ JSValueRef JSContactManager::remove(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -800,6 +817,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -878,6 +896,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -890,6 +909,7 @@ JSValueRef JSContactManager::find(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -983,6 +1003,7 @@ JSValueRef JSContactManager::find(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
 //     return JSObjectMake(gContext, JSPendingOperation::getClassRef(), gcPendingOperation);
        return JSValueMakeUndefined(context);
 }
@@ -995,6 +1016,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -1124,7 +1146,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context,
                LogError("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -1136,6 +1158,7 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        ContactManagerPtr addressBook;
        JSContextRef gContext;
        ContactManagerController *controller;
@@ -1200,7 +1223,7 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
index e759ed4..4903f87 100755 (executable)
@@ -34,6 +34,7 @@
 #include "JSPerson.h"
 #include <ArgumentValidator.h>
 #include <JSWebAPIError.h>
+#include <TimeTracer.h>
 
 #define FILTER_CLASS_NAME               "Person"
 
@@ -484,6 +485,7 @@ JSValueRef JSPerson::link(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PersonPtr person(NULL);
 
        Try
@@ -563,7 +565,7 @@ JSValueRef JSPerson::link(JSContextRef context,
                        break;
                }
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -575,6 +577,7 @@ JSValueRef JSPerson::unlink(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PersonPtr person(NULL);
 
        Try
@@ -674,7 +677,7 @@ JSValueRef JSPerson::unlink(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception,
                                JSTizenException::UNKNOWN_ERROR, "Internal error");
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
index 9f5a83e..7fd0147 100755 (executable)
@@ -26,6 +26,7 @@
 
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
 #include "JSContactManager.h"
 #include "JSContact.h"
 #include "JSContactGroup.h"
 #include "ContactAsyncCallbackManager.h"
 #include "ContactListenerManager.h"
 
+namespace DeviceAPI {
+namespace Contact {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")");
+       TIME_TRACER_INIT();
     Try
     {
         WrtAccessSingleton::Instance().initialize(widgetId);
@@ -59,6 +64,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")");
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Contact");
+       TIME_TRACER_RELEASE();
     Try
     {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
@@ -133,3 +140,7 @@ PLUGIN_CLASS_MAP_BEGIN
                                (js_class_template_getter)DeviceAPI::Contact::JSContactEmailAddress::getClassRef,
                                NULL)
 PLUGIN_CLASS_MAP_END
+
+} // Contact
+} // DeviceAPI
+
index db0caf1..0e0d849 100755 (executable)
@@ -26,6 +26,8 @@
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
+namespace DeviceAPI {
+namespace DataControl {
 
 void on_widget_start_callback(int widgetId)
 {
@@ -81,3 +83,5 @@ PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, DATACONTROL,
       (js_class_template_getter)DeviceAPI::DataControl::JSDataControlManager::getClassRef,NULL)
 PLUGIN_CLASS_MAP_END
 
+} // DataControl
+} // DeviceAPI
index 040f466..65157d8 100755 (executable)
@@ -6,7 +6,7 @@ SET(TARGET_CONFIG_NAME ${filesystem_config})
 PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${platform_pkgs_filesystem_INCLUDE_DIRS}
 )
 
index 122e3f6..7ec39e7 100755 (executable)
@@ -39,6 +39,7 @@
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h> 
 #include <SecurityExceptions.h>
+#include <TimeTracer.h>
 #include "FilesystemUtils.h"
 #include "Converter.h"
 #include "plugin_config.h"
@@ -346,6 +347,7 @@ JSValueRef JSFile::toUri(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                LogError("Private object is not set.");
@@ -360,6 +362,7 @@ JSValueRef JSFile::toUri(JSContextRef context,
 
        try {
                int widgetId = WrtAccessSingleton::Instance().getWidgetId();
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return converter.toJSValueRef(privateObject->getObject()->getNode()->toUri(widgetId));
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
@@ -379,6 +382,7 @@ JSValueRef JSFile::listFiles(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -447,7 +451,7 @@ JSValueRef JSFile::listFiles(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -458,6 +462,7 @@ JSValueRef JSFile::openStream(JSContextRef context,
                const JSValueRef arguments[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -533,7 +538,7 @@ JSValueRef JSFile::openStream(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -544,6 +549,7 @@ JSValueRef JSFile::readAsText(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -610,7 +616,7 @@ JSValueRef JSFile::readAsText(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -621,6 +627,7 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -661,7 +668,7 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                IPathPtr src = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[0]));
                IPathPtr dest = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[1]));
                bool overwrite = converter.toBool(reserveArguments[2]);;
-                                       
+               
                if (NT_DIRECTORY != privateObject->getObject()->getNode()->getType()) {
                        cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, "IO error"));
                        return JSValueMakeUndefined(context);
@@ -701,6 +708,7 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -711,6 +719,7 @@ JSValueRef JSFile::moveTo(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -789,6 +798,7 @@ JSValueRef JSFile::moveTo(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -799,6 +809,7 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -822,6 +833,7 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
                PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
                privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
        } catch (const WrtDeviceApis::Commons::PlatformException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
@@ -843,6 +855,7 @@ JSValueRef JSFile::createFile(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -864,7 +877,7 @@ JSValueRef JSFile::createFile(JSContextRef context,
 
                PrivateObjectDefPtr privData(new PrivateObjectDef(node, privateObject->getObject()->getParentPermissions()));
                privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
                /*
                IPathPtr path = converter.toPath(argv[0]);
@@ -891,6 +904,7 @@ JSValueRef JSFile::resolve(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -924,6 +938,7 @@ JSValueRef JSFile::resolve(JSContextRef context,
                node->setPermissions(privateObject->getObject()->getNode()->getPermissions());
                PrivateObjectDefPtr privData(new PrivateObjectDef(node,         privateObject->getObject()->getParentPermissions()));
                privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
                /*
                IPathPtr path = converter.toPath(argv[0]);
@@ -953,6 +968,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -1055,7 +1071,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -1067,6 +1083,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("<<<");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
 
@@ -1160,6 +1177,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
        }
 
        LogDebug(">>>");
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 }
index 49ab2ad..7fd1982 100755 (executable)
@@ -26,6 +26,7 @@
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
+#include <TimeTracer.h>
 
 #include "Converter.h"
 #include "Encodings.h"
@@ -187,6 +188,7 @@ JSValueRef JSFilestream::close(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject =  static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -203,6 +205,7 @@ JSValueRef JSFilestream::close(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error");
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -213,6 +216,8 @@ JSValueRef JSFilestream::read(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+       TIME_TRACER_ITEM_BEGIN("read(UTF8)", 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -243,11 +248,13 @@ JSValueRef JSFilestream::read(JSContextRef context,
                // utf8, iso8859-1, skip
                if (!strcmp(currentCharSet.c_str(), Encodings::UTF8) || !strcmp(currentCharSet.c_str(), Encodings::ISO88591))
                {
+                       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                        return converter.toJSValueRef(std::string(text.Get()));         
                }
                else 
                {
                        Utils::toUTF8String(currentCharSet, text.Get(), count, outStr);
+                       TIME_TRACER_ITEM_END("read(UTF8)", 0);
                        return converter.toJSValueRef(outStr);
                }
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
@@ -269,6 +276,7 @@ JSValueRef JSFilestream::readBytes(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -292,8 +300,8 @@ JSValueRef JSFilestream::readBytes(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "Invalid argument");
                }               
 
-
                DPL::ScopedArray<unsigned char> data(privateObject->getObject()->getBytes(count));
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return converter.toJSValueRef(data.Get(), privateObject->getObject()->getCount());
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
@@ -314,6 +322,7 @@ JSValueRef JSFilestream::readBase64(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -338,6 +347,7 @@ JSValueRef JSFilestream::readBase64(JSContextRef context,
 
                DPL::ScopedArray<unsigned char> data(privateObject->getObject()->getBytes(count));
                std::string base64 = WrtDeviceApis::Commons::Base64::encode(data.Get(), privateObject->getObject()->getCount());
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return converter.toJSValueRef(base64);
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
@@ -358,6 +368,7 @@ JSValueRef JSFilestream::write(JSContextRef context,
        const JSValueRef argv[],
        JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -387,6 +398,7 @@ JSValueRef JSFilestream::write(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -397,6 +409,7 @@ JSValueRef JSFilestream::writeBytes(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -427,6 +440,7 @@ JSValueRef JSFilestream::writeBytes(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -437,6 +451,7 @@ JSValueRef JSFilestream::writeBase64(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error");
@@ -467,6 +482,7 @@ JSValueRef JSFilestream::writeBase64(JSContextRef context,
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::IO_ERROR, ex.GetMessage());
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 } // Tizen1_0
index 045e8c3..0b4dca5 100755 (executable)
@@ -37,6 +37,7 @@
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <WidgetDB/WidgetDBMgr.h>
 #include <WidgetDB/IWidgetDB.h>
+#include <TimeTracer.h>
 
 #include "JSFile.h"
 #include "FilesystemUtils.h"
@@ -55,7 +56,7 @@ using namespace WrtDeviceApis;
 
 
 namespace {
-const char* PLUGIN_NAME = "filesystem";
+const char* PLUGIN_NAME = "FileSystemManager";
 const char* PROPERTY_MAXPATHLENGTH = "maxPathLength";
 
 JSValueRef getFunctionOrNull(JSContextRef ctx, JSValueRef arg)
@@ -186,6 +187,7 @@ JSValueRef JSFilesystemManager::getStorage(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSValueMakeUndefined(context);
@@ -231,7 +233,7 @@ JSValueRef JSFilesystemManager::getStorage(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -242,6 +244,7 @@ JSValueRef JSFilesystemManager::getStorageList(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSValueMakeUndefined(context);
@@ -289,7 +292,7 @@ JSValueRef JSFilesystemManager::getStorageList(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -300,6 +303,7 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSValueMakeUndefined(context);
@@ -347,7 +351,7 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -358,6 +362,7 @@ JSValueRef JSFilesystemManager::removeStorageStateListener(JSContextRef context,
                const JSValueRef argv[],
                JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
                return JSValueMakeUndefined(context);
@@ -399,6 +404,7 @@ JSValueRef JSFilesystemManager::removeStorageStateListener(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, ex.GetMessage());
        }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -411,6 +417,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
 {
 
        LogDebug("<<<");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        PrivateObject* privateObject = static_cast<PrivateObject*>(JSObjectGetPrivate(thisObject));
        if (!privateObject) {
@@ -501,6 +508,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 }
index 4ab7b88..d2176fa 100755 (executable)
@@ -87,7 +87,7 @@ bool Manager::getSupportedDeviceCB(int storage, storage_type_e type, storage_sta
                snprintf(buf, size, "removable%d", storage);
                lable.append(buf);
        }
-       LogDebug(lable);
+       LogDebug(lable << "state" << state);
 
        storageItem->setId(storage);
        storageItem->setLabel(lable);
@@ -514,6 +514,11 @@ void Manager::OnRequestReceived(const EventCopyPtr& event)
         Try {
             parent = Node::resolve(IPath::create(dest->getPath()));
         }
+        Catch(Commons::NotFoundException) 
+        {
+            event->setExceptionCode(_rethrown_exception.getCode());
+            ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
+        }
         Catch (Commons::Exception) 
         {
             event->setExceptionCode(_rethrown_exception.getCode());
@@ -620,6 +625,12 @@ void Manager::OnRequestReceived(const EventMovePtr& event)
         Try {
             parent = Node::resolve(IPath::create(dest->getPath()));
         }
+               
+        Catch(Commons::NotFoundException) 
+        {
+            event->setExceptionCode(_rethrown_exception.getCode());
+            ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
+        }
         Catch(Commons::Exception) 
         {
             LogError("Exception: " << _rethrown_exception.GetMessage());
index 1d0d38e..0104255 100755 (executable)
@@ -95,7 +95,8 @@ Path::Path()
 void Path::reset(const std::string& str)
 {
     if (!isValid(str)) {
-        ThrowMsg(Commons::InvalidArgumentException,
+        LogDebug(str << "empty string");
+        ThrowMsg(Commons::NotFoundException,
                  "Not a valid path: " + str + ".");
     }
 
index dbbc5a4..6febfa2 100755 (executable)
@@ -19,6 +19,7 @@
 #include <dpl/log/log.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <Commons/plugin_initializer_def.h>
+#include <TimeTracer.h>
 #include "JSFilesystemManager.h"
 #include "JSFile.h"
 #include "JSFilestream.h"
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
+namespace DeviceAPI {
+namespace Filesystem {
+
 void on_widget_start_callback(int widgetId)
 {
+       TIME_TRACER_INIT();
        Try {
         WrtAccessSingleton::Instance().initialize(widgetId);
        } Catch (Commons::Exception) {
@@ -39,6 +44,8 @@ void on_widget_start_callback(int widgetId)
 
 void on_widget_stop_callback(int widgetId)
 {
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"FileSystem");
+       TIME_TRACER_RELEASE();
        Try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
        } Catch (Commons::Exception) {
@@ -74,3 +81,5 @@ PLUGIN_CLASS_MAP_END
 
 #undef FILESYSTEM
 
+} // Filesystem
+} // DeviceAPI
index 56bc60b..69bb0fd 100755 (executable)
@@ -54,8 +54,8 @@
 #define TIZEN_WANING(FM,ARG...)  {LOGW("%s[%s]%s" FM, YELLOW_COLOR, __FUNCTION__, NORMAL_COLOR, ##ARG);}
 #define TIZEN_ERROR(FM,ARG...)   {LOGE("%s[%s]%s" FM, RED_COLOR,    __FUNCTION__, NORMAL_COLOR, ##ARG);}
 
-namespace TizenApis {
-namespace Tizen1_0 {
+namespace DeviceAPI {
+namespace Log {
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis;
@@ -160,5 +160,5 @@ JSValueRef JSTizenLog::logError(JSContextRef context, JSObjectRef object,
        return JSValueMakeUndefined(context);
 }
 
-} // Tizen1_0
-} // TizenApis
+} // Log
+} // DeviceAPI
index aa18dd4..0eba518 100644 (file)
@@ -27,8 +27,8 @@
 
 #include <JavaScriptCore/JavaScript.h>
 
-namespace TizenApis {
-namespace Tizen1_0 {
+namespace DeviceAPI {
+namespace Log {
 
 class DeviceController;
 
index f990acd..78bc807 100644 (file)
@@ -20,6 +20,9 @@
 
 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
 
+namespace DeviceAPI {
+namespace Log {
+
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[TizenLog] on_widget_start_callback ("<<widgetId<<")");
@@ -35,5 +38,8 @@ PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback)
 
 PLUGIN_CLASS_MAP_BEGIN
     PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "log",
-      (js_class_template_getter)TizenApis::Tizen1_0::JSTizenLog::getClassRef, NULL)
+      (js_class_template_getter)DeviceAPI::Log::JSTizenLog::getClassRef, NULL)
 PLUGIN_CLASS_MAP_END
+
+} // Log
+} // DeviceAPI
index be505fa..c1f9431 100644 (file)
@@ -5,7 +5,7 @@ SET(TARGET_IMPL_NAME ${messageport_impl})
 PKG_CHECK_MODULES(platform_pkgs_messageport REQUIRED message-port)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${platform_pkgs_messageport_INCLUDE_DIRS}
 )
 
index af4c3c7..6bb3c50 100644 (file)
@@ -31,6 +31,7 @@
 #include <CommonsJavaScript/JSUtils.h>
 #include <JSWebAPIException.h>
 #include <ArgumentValidator.h>
+#include <TimeTracer.h>
 #include "EventLocalMessagePortAddMessagePortListener.h"
 #include "EventLocalMessagePortRemoveMessagePortListener.h"
 #include "MessagePortListenerManager.h"
@@ -189,6 +190,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        LocalMessagePortPtr localMessagePort;
        JSContextRef gContext;
        LocalMessagePortController *controller;
@@ -283,6 +285,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context,
                                UnknownException("Internal error"));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -294,6 +297,7 @@ JSValueRef JSLocalMessagePort::removeMessagePortListener(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        LocalMessagePortPtr localMessagePort;
        JSContextRef gContext;
        LocalMessagePortController *controller;
@@ -372,6 +376,7 @@ JSValueRef JSLocalMessagePort::removeMessagePortListener(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
index 6de4b56..e07ed42 100644 (file)
@@ -29,6 +29,7 @@
 #include <CommonsJavaScript/Validator.h>
 #include <JSWebAPIException.h>
 #include <ArgumentValidator.h>
+#include <TimeTracer.h>
 #include "IMessagePortManager.h"
 #include "MessagePortFactory.h"
 #include "JSLocalMessagePort.h"
@@ -126,6 +127,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        MessagePortManagerPtr messagePortManager;
        JSContextRef gContext;
        JSMessagePortManagerPriv *priv;
@@ -216,6 +218,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context,
                                UnknownException("Internal error"));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -227,6 +230,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        MessagePortManagerPtr messagePortManager;
        JSContextRef gContext;
        JSMessagePortManagerPriv *priv;
@@ -317,6 +321,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con
                                UnknownException("Internal error"));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -328,6 +333,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        MessagePortManagerPtr messagePortManager;
        JSContextRef gContext;
        JSMessagePortManagerPriv *priv;
@@ -433,6 +439,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context,
                                UnknownException("Internal error"));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
@@ -444,6 +451,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        MessagePortManagerPtr messagePortManager;
        JSContextRef gContext;
        JSMessagePortManagerPriv *priv;
@@ -549,6 +557,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co
                                UnknownException("Internal error"));
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return result;
 }
 
index a6653a8..aac88fb 100644 (file)
@@ -31,6 +31,7 @@
 #include <CommonsJavaScript/JSUtils.h>
 #include <CommonsJavaScript/JSPendingOperation.h>
 #include <JSWebAPIException.h>
+#include <TimeTracer.h>
 #include "EventRemoteMessagePortSendMessage.h"
 #include "JSLocalMessagePort.h"
 #include "MessagePortJSUtil.h"
@@ -206,6 +207,7 @@ JSValueRef JSRemoteMessagePort::sendMessage(JSContextRef context,
                JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
        RemoteMessagePortPtr remoteMessagePort(NULL);
 
        try
@@ -300,6 +302,7 @@ JSValueRef JSRemoteMessagePort::sendMessage(JSContextRef context,
                }
        }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return JSValueMakeUndefined(context);
 }
 
index 683deed..badf170 100644 (file)
 
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
 #include "JSMessagePortManager.h"
 
+namespace DeviceAPI {
+namespace MessagePort {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\MessagePort] on_widget_start_callback (" << widgetId << ")");
+       TIME_TRACER_INIT();
     Try
     {
         WrtAccessSingleton::Instance().initialize(widgetId);
@@ -47,6 +52,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\MessagePort] on_widget_stop_callback (" << widgetId << ")");
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"MessagePort");
+       TIME_TRACER_RELEASE();
     Try
     {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
@@ -65,9 +72,6 @@ void on_frame_load_callback(const void * context)
 void on_frame_unload_callback(const void * context)
 {
     LogDebug("[Tizen\\MessagePort] on_frame_unload_callback (" << context << ")");
-
-//    TizenApis::Tizen1_0::MessagePort::MessagePortAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
-//    TizenApis::Tizen1_0::MessagePort::MessagePortListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
@@ -81,3 +85,6 @@ PLUGIN_CLASS_MAP_BEGIN
                                (js_class_template_getter)DeviceAPI::MessagePort::JSMessagePortManager::getClassRef,
                                NULL)
 PLUGIN_CLASS_MAP_END
+
+} // MessagePort
+} // DeviceAPI
index 5bf5509..1231492 100644 (file)
@@ -378,7 +378,7 @@ OnMessagesChanged ConverterMessage::toMessageMultifunctions(JSValueRef argument)
     (!validator.isNullOrUndefined(result.messagesRemoved) && !validator.isCallback(result.messagesRemoved)))
     {
         LogError("java script call back set error");
-        Throw(WrtDeviceApis::Commons::InvalidArgumentException);
+        Throw(WrtDeviceApis::Commons::ConversionException);
     }
 
     return result;
index d54c14d..91fe7ae 100644 (file)
@@ -93,7 +93,7 @@ JSClassDefinition JSMessage::m_classInfo = {
     NULL, //deleteProperty,
     JSMessage::getPropertyNames, //getPropertyNames,
     NULL, //callAsFunction,
-    constructor, //callAsConstructor,
+    NULL, //callAsConstructor,
     NULL, //hasInstance,
     NULL, //convertToType,
 };
index 202c320..0887bc0 100755 (executable)
@@ -58,6 +58,12 @@ class JSMessage
         return m_jsClassRef;
     }
 
+    static JSObjectRef constructor(JSContextRef ctx,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
     static JSValueRef createJSObject(JSContextRef context,
             EmailAccountInfo& account,
             MessageType msgType,
@@ -151,11 +157,6 @@ class JSMessage
             JSValueRef possibleInstance,
             JSValueRef* exception);
 
-    static JSObjectRef constructor(JSContextRef ctx,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
 
     /**
      * The callback invoked when converting an object to a particular JavaScript type.
index 1196d60..e1a9328 100644 (file)
@@ -69,7 +69,7 @@ JSClassDefinition JSMessageAttachment::m_classInfo = {
     NULL, //deleteProperty,
     getPropertyNames,
     NULL, //callAsFunction,
-    constructor, //callAsConstructor,
+    NULL, //callAsConstructor,
     NULL, //hasInstance,
     NULL, //convertToType,
 };
@@ -490,8 +490,6 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context,
 {
        LogDebug("entered");
 
-       JSMessageAttachmentPrivate* priv = static_cast<JSMessageAttachmentPrivate*>(JSObjectGetPrivate(constructor));
-       JSContextRef globalContext = priv ? priv->getContext() : context;
 
        try
        {
@@ -504,7 +502,7 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context,
 
                if(path.size() != 0)
                {
-                       DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(globalContext, path);
+                       DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, path);
                        if (src)
                        {
                                LogDebug("path size() : " << path.size());
@@ -530,10 +528,10 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context,
                {
                        JSClassRef jsClassRef = JSClassCreate(getClassInfo());
                        LogDebug("jsClassRef success");
-                       JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(globalContext, attachment);
+                       JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment);
                        LogDebug("priv success");
 
-                       JSObjectRef jsObjRef = JSObjectMake(globalContext, jsClassRef, static_cast<void*>(priv));
+                       JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
                        LogDebug("JSObjectMake success");
                        JSClassRelease(jsClassRef);
                        if (NULL == jsObjRef) {
index 4626fad..8c3dc3c 100755 (executable)
@@ -36,6 +36,11 @@ public:
        static const JSClassDefinition* getClassInfo();
        static JSClassRef getClassRef();
        static JSObjectRef createJS( JSContextRef context, const IAttachmentPtr &msg);
+       static JSObjectRef constructor(JSContextRef ctx,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
 
 private:
 
@@ -54,11 +59,6 @@ private:
             JSObjectRef object,
             JSStringRef propertyName);
 
-    static JSObjectRef constructor(JSContextRef ctx,
-                       JSObjectRef constructor,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
 
        static JSValueRef getProperty(JSContextRef context,
                        JSObjectRef object,
index bdb128b..07278f6 100644 (file)
@@ -757,8 +757,6 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function,
         DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
         return JSWebAPIError::throwException(context, exception, err);
     }
-
-    return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef function, JSObjectRef thisObject,
@@ -849,8 +847,6 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func
         DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
         return JSWebAPIError::throwException(context, exception, err);
     }
-
-    return JSValueMakeUndefined(context);
 }
 #if 0
 JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef function, JSObjectRef thisObject,
index 32e34ac..f335739 100644 (file)
@@ -1051,8 +1051,6 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J
         DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
         return JSWebAPIError::throwException(context, exception, err);
     }
-
-    return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount,
@@ -1176,8 +1174,6 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte
         DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
         return JSWebAPIError::throwException(context, exception, err);
     }
-
-    return JSValueMakeUndefined(context);
 }
 
 
@@ -1300,8 +1296,6 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS
         DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str());
         return JSWebAPIError::throwException(context, exception, err);
     }
-
-    return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount,
index 8b4714a..213b932 100755 (executable)
 
 #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen"
 
+namespace DeviceAPI {
+namespace Messaging {
+
+namespace Options{
+
+class_definition_options_t TizenOptions =
+{
+    JS_CLASS,
+    CREATE_INSTANCE,
+    NONE_NOTICE,
+    USE_OVERLAYED, //ignored
+    NULL,
+    NULL
+};
+
+class_definition_options_t MessagingInterfaceOptions = {
+    JS_INTERFACE,
+    CREATE_INSTANCE,
+    NONE_NOTICE,
+    USE_OVERLAYED, //ignored
+    NULL, // JSWidget::acquireGlobalContext,
+    NULL,
+    NULL
+};
+
+}
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -78,16 +105,20 @@ PLUGIN_CLASS_MAP_BEGIN
                "messaging",
                (js_class_template_getter)DeviceAPI::Messaging::JSMessagingServiceManager::getClassRef,
                NULL)
-       PLUGIN_CLASS_MAP_ADD_CLASS(
-               WRT_JS_EXTENSION_OBJECT_TIZEN,
-               "Message",
-               (js_class_template_getter)DeviceAPI::Messaging::JSMessage::getClassRef,
-               NULL)
 
-       PLUGIN_CLASS_MAP_ADD_CLASS(
-               WRT_JS_EXTENSION_OBJECT_TIZEN,
-               "MessageAttachment",
-               (js_class_template_getter)DeviceAPI::Messaging::JSMessageAttachment::getClassRef,
-               NULL)
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               "Message",
+                               (js_class_template_getter)DeviceAPI::Messaging::JSMessage::getClassRef,
+                               (js_class_constructor_cb_t)DeviceAPI::Messaging::JSMessage::constructor,
+                               &Options::MessagingInterfaceOptions)
+
+    PLUGIN_CLASS_MAP_ADD_INTERFACE(WRT_JS_EXTENSION_OBJECT_TIZEN,
+                               "MessageAttachment",
+                               (js_class_template_getter)DeviceAPI::Messaging::JSMessageAttachment::getClassRef,
+                               (js_class_constructor_cb_t)DeviceAPI::Messaging::JSMessageAttachment::constructor,
+                               &Options::MessagingInterfaceOptions)
 
 PLUGIN_CLASS_MAP_END
+
+} // Messaging
+} // DeviceAPI
index 8abcc04..35de650 100755 (executable)
@@ -108,7 +108,7 @@ void NFCDefaultAdapter::setExclusiveMode(bool mode) {
        bool bEnabled = !mode;
        LogDebug("system handeler enable?" << bEnabled);
        // If exclusive mode is true, system handler has to be disabled.
-       if (nfc_manager_set_system_handler_enable(!bEnabled) != NFC_ERROR_NONE)
+       if (nfc_manager_set_system_handler_enable(bEnabled) != NFC_ERROR_NONE)
                ThrowMsg(UnknownException, "Failed to set exclusive mode.");
        LogDebug("End");
 }
index f242441..01c523e 100755 (executable)
@@ -6,7 +6,7 @@ SET(TARGET_IMPL_NAME ${notification_impl})
 PKG_CHECK_MODULES(platform_pkgs_notification REQUIRED notification capi-appfw-application)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${TOP}/Application
        ${TOP}/Filesystem
        ${platform_pkgs_notification_INCLUDE_DIRS}
index bfc1b73..7d57658 100755 (executable)
@@ -151,8 +151,17 @@ void JSNotificationDetailInfo::setPrivateObject(JSContextRef context, JSObjectRe
             JSUtil::toJSValueRef(context, priv->getMainText()), kJSPropertyAttributeNone);
 
     // subText
-    JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
-            JSUtil::toJSValueRef(context, priv->getSubText()), kJSPropertyAttributeNone);
+    std::string subText = priv->getSubText();
+
+    if ( subText.empty())
+    {
+        JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,  JSValueMakeNull(context), kJSPropertyAttributeNone);
+    }
+    else
+    {
+        JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_SUB_TEXT,
+                JSUtil::toJSValueRef(context, priv->getSubText()), kJSPropertyAttributeNone);
+    }
 }
 
 
index b590833..7f91db5 100755 (executable)
@@ -23,6 +23,7 @@
 #include <GlobalContextManager.h>
 #include <MultiCallbackUserData.h>
 #include <PlatformException.h>
+#include <TimeTracer.h>
 
 #include "plugin_config.h"
 #include "JSStatusNotification.h"
@@ -106,6 +107,7 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -116,15 +118,15 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
             throw TypeMismatchException("Private object is NULL.");
         }
 
-        LogDebug("priv=" << priv);
+        LogInfo("priv=" << priv);
         ArgumentValidator validator(context, argumentCount, arguments);
 
         // notification
         JSObjectRef notificationObj = validator.toObject(0, JSStatusNotification::getClassRef());
-       LogDebug("Notification Obj: " << notificationObj);      
+       LogInfo("Notification Obj: " << notificationObj);       
         StatusNotification *notification = JSStatusNotification::getPrivateObject(context, notificationObj);
 
-       LogDebug("Notification : " << notification);
+       LogInfo("Notification : " << notification);
        
         if (!notification) {
             throw TypeMismatchException("Notification's private object is NULL.");
@@ -141,21 +143,32 @@ JSValueRef JSNotificationManager::post(JSContextRef context,
            if(stream.fail())
               throw TypeMismatchException("Notification's ID conversion is failed.");
 
+           LogInfo ("posted notification id : " << stream.str());      
+
+            //delete notificaiton ID
+        JSStringRef propertyIDName = JSStringCreateWithUTF8CString(NOTIFICATION_ID);
+           JSObjectDeleteProperty(context, notificationObj, propertyIDName, 0);
+           JSStringRelease(propertyIDName);
+               
+           //sencond
            JSUtil::setProperty(context, notificationObj, NOTIFICATION_ID,
-               JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeNone);
+               JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeReadOnly);
         }
         else
                {
                    throw DeviceAPI::Common::UnknownException("Notification ID value is invalied.");
                }
 
+               //delete posted time
+               JSStringRef propertyPostedTimeName = JSStringCreateWithUTF8CString(NOTIFICATION_POSTED_TIME);
+               JSObjectDeleteProperty(context, notificationObj, propertyPostedTimeName, 0);
+               JSStringRelease(propertyPostedTimeName);
+
         //posted time
         JSUtil::setProperty(context, notificationObj, NOTIFICATION_POSTED_TIME,
-                JSUtil::makeDateObject(context,notification->getPostedTime()), kJSPropertyAttributeNone);
-                
-//set notification ID.
-//set notification postedTime.
+                JSUtil::makeDateObject(context,notification->getPostedTime()), kJSPropertyAttributeReadOnly);
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIError::throwException(context, exception, err);
@@ -172,6 +185,7 @@ JSValueRef JSNotificationManager::update(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -193,7 +207,7 @@ JSValueRef JSNotificationManager::update(JSContextRef context,
 
         // perform
         priv->update(notification);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIError::throwException(context, exception, err);
@@ -210,6 +224,7 @@ JSValueRef JSNotificationManager::remove(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -227,7 +242,7 @@ JSValueRef JSNotificationManager::remove(JSContextRef context,
 
         // perform
         priv->remove(id);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIError::throwException(context, exception, err);
@@ -244,9 +259,11 @@ JSValueRef JSNotificationManager::removeAll(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
+    LogInfo("remove All");
     try {
         // Private Object
         NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
@@ -256,7 +273,7 @@ JSValueRef JSNotificationManager::removeAll(JSContextRef context,
 
         // perform
         priv->removeAll();
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         return JSWebAPIError::throwException(context, exception, err);
@@ -273,6 +290,7 @@ JSValueRef JSNotificationManager::get(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     try {
         // Private Object
         NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
@@ -284,11 +302,11 @@ JSValueRef JSNotificationManager::get(JSContextRef context,
 
         // id
         std::string id = validator.toString(0);
-
+        LogDebug("get notification id :" << id);
         JSObjectRef obj = JSObjectMake(context, JSStatusNotification::getClassRef(), NULL);    //make object
        StatusNotification* noti = priv->get(id);                                                                       // perform
        JSStatusNotification::setPrivateObject(context, obj, noti);
-
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
        return obj;
        
     } catch (const BasePlatformException &err) {
@@ -306,6 +324,7 @@ JSValueRef JSNotificationManager::getAll(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     try {
         // Private Object
         NotificationManager *priv = static_cast<NotificationManager*>(JSObjectGetPrivate(thisObject));
@@ -326,7 +345,7 @@ JSValueRef JSNotificationManager::getAll(JSContextRef context,
         if (exception != NULL) {
             throw DeviceAPI::Common::UnknownException(context, exception);
         }
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return jsResult;
                
     } catch (const BasePlatformException &err) {
index e3bdbfa..edea7c8 100755 (executable)
@@ -43,7 +43,7 @@ JSClassDefinition JSStatusNotification::m_classInfo = {
     kJSClassAttributeNone,
     "StatusNotification",
     NULL, //ParentClass
-    NULL, //StaticValues
+    m_property, //StaticValues
     NULL, //StaticFunctions
     initialize, //Initialize
     finalize, //Finalize
@@ -58,6 +58,164 @@ JSClassDefinition JSStatusNotification::m_classInfo = {
     NULL //ConvertToType
 };
 
+JSStaticValue JSStatusNotification::m_property[] = 
+{
+       {STATUS_NOTIFICATION_PROGRESS_TYPE,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,      kJSPropertyAttributeNone },
+       {STATUS_NOTIFICATION_PROGRESS_VALUE,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,     kJSPropertyAttributeNone },
+       {0, 0, 0, 0}
+};
+
+bool JSStatusNotification::setProperty(JSContextRef context,
+        JSObjectRef object,
+        JSStringRef propertyName,
+        JSValueRef value,
+        JSValueRef* exception)
+{
+
+    StatusNotification *priv = static_cast<StatusNotification*>(JSObjectGetPrivate(object));
+    LogDebug("statusNotification :" << priv);
+    if (!priv) {
+        throw TypeMismatchException("StatusNotification's private object is NULL.");
+    }
+
+       try {
+                   std::string property;
+                   size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+                   if (jsSize > 0) {
+                       jsSize = jsSize + 1;
+                       char* buffer = new char[jsSize];        
+                       size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+                       if (written > jsSize) {
+                           throw InvalidValuesException("Conversion could not be fully performed.");
+                       }
+                       property = buffer;
+                       delete[] buffer;
+                   }
+
+                  LogInfo("property =" << property);
+
+                  if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE)
+                  {
+                       std::string strProgressType = JSUtil::JSValueToString(context, value);
+                       LogInfo("Progress Type : " << strProgressType);
+
+                       NotificationProgressType progType = NOTI_PROGRESS_TYPE_NONE;
+                       if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0)
+                           progType = NOTI_PROGRESS_TYPE_PERCENTAGE;
+                       else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
+                           progType = NOTI_PROGRESS_TYPE_SIZE;
+                       else
+                           throw InvalidValuesException("Invalid Progress Type.");
+                       
+                       priv->setProgressType(progType);        //set progress Type
+
+                       return true;
+
+                  }
+                  else if ( property == STATUS_NOTIFICATION_PROGRESS_VALUE)
+                  {
+                           // progressValue
+                           unsigned long progressVal = JSUtil::JSValueToULong(context, value);
+                           LogInfo("Progress Value : " << progressVal);
+                               
+                           if ( priv->getProgressType() == NOTI_PROGRESS_TYPE_PERCENTAGE)
+                           {
+                               if ( 100 < progressVal )
+                                               throw InvalidValuesException("The percentage progress value must be between 0 and 100");
+                               priv->setProgressValue((double)progressVal/(double)100);
+                           }
+                           else 
+                           {
+                               priv->setProgressValue((double)progressVal);
+                           }
+
+                           return true;
+                  }
+
+    }
+    catch ( const BasePlatformException& err) 
+    {
+        LogWarning(" notification convertion is failed. "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
+    }
+       
+
+    return false;
+}
+
+JSValueRef JSStatusNotification::getProperty(JSContextRef context,
+                                                                               JSObjectRef object,
+                                                                               JSStringRef propertyName,
+                                                                               JSValueRef* exception)
+{
+
+       StatusNotification *priv = static_cast<StatusNotification*>(JSObjectGetPrivate(object));
+       LogDebug("statusNotification :" << priv);
+       if (!priv) {
+               throw TypeMismatchException("StatusNotification's private object is NULL.");
+       }
+
+       try {
+
+                   std::string property;
+                   size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+                   if (jsSize > 0) {
+                       jsSize = jsSize + 1;
+                       char* buffer = new char[jsSize];        
+                       size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+                       if (written > jsSize) {
+                           throw InvalidValuesException("Conversion could not be fully performed.");
+                       }
+                       property = buffer;
+                       delete[] buffer;
+                   }
+
+                  LogInfo("property =" << property);
+                  if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE)
+                  {
+                       std::string type;
+                       if ( NOTI_PROGRESS_TYPE_PERCENTAGE ==  priv->getProgressType())
+                       {
+                               type = TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
+                       }
+                       else if ( NOTI_PROGRESS_TYPE_SIZE==   priv->getProgressType())
+                       {
+                               type = TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE;
+                       }
+                  
+                       return JSUtil::toJSValueRef(context, type);
+                  
+                  }
+                  else if ( property == STATUS_NOTIFICATION_PROGRESS_VALUE)
+                  {
+                               // progressValue
+
+                               LogInfo("Progress Type=" << priv->getProgressType());
+                               
+                                  // progressValue
+                               unsigned long progressVal = 0;  
+                               if ( NOTI_PROGRESS_TYPE_PERCENTAGE ==  priv->getProgressType())
+                               {
+                                       progressVal = (unsigned long)( (priv->getProgressValue()*100) );
+                               }
+                               else if ( NOTI_PROGRESS_TYPE_SIZE==   priv->getProgressType())
+                               {
+                                       progressVal = (unsigned long)priv->getProgressValue();
+                               }
+                               
+                               LogInfo("Progress Value=" << progressVal);      
+                  
+                               return  JSUtil::toJSValueRef(context, progressVal);
+                  }
+
+    }
+    catch ( const BasePlatformException& err) 
+    {
+        LogWarning(" notification convertion is failed. "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
+       return NULL;
+    }
+                
+}
+
 
 JSClassRef JSStatusNotification::m_jsClassRef = JSClassCreate(JSStatusNotification::getClassInfo());
 
@@ -124,8 +282,8 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
         
         priv->setTitle(validator.toString(1, false, ""));    //title
         
-        JSObjectRef notiInitDict = validator.toObject(2, true);
-
+            JSObjectRef notiInitDict = validator.toObject(2, true);
+       
             if (notiInitDict)
             {
                 //content
@@ -339,7 +497,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context,
                 {
                     LogWarning("notification's icon path convertion is failed."  << err.getMessage().c_str());
                 }
-                
+                        
             }
                
         setPrivateObject(context, obj, priv);
@@ -481,6 +639,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
     JSValueRef appId = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_APP_ID);
     priv->setApplicationId(JSUtil::JSValueToString(context, appId));
 
+#if 0
     // progressType
     JSValueRef progressType = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_TYPE);
     std::string strProgressType = JSUtil::JSValueToString(context, progressType);
@@ -508,7 +667,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context,
     {
        priv->setProgressValue((double)JSUtil::JSValueToULong(context, progressValue));
     }
-    
+ #endif   
     return priv;
 }
 
@@ -521,7 +680,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
     //type
     std::string typeVal(NOTIFICATION_TYPE_VALUE);
     JSUtil::setProperty(context, object, NOTIFICATION_TYPE,
-            JSUtil::toJSValueRef(context, typeVal), kJSPropertyAttributeNone);
+            JSUtil::toJSValueRef(context, typeVal), kJSPropertyAttributeReadOnly);
        
     std::string type;
     
@@ -538,7 +697,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
        throw TypeMismatchException("status type mismatch.");
        
     JSUtil::setProperty(context, object, STATUS_NOTIFICATION_STATUS_TYPE,
-            JSUtil::toJSValueRef(context, type), kJSPropertyAttributeNone);
+            JSUtil::toJSValueRef(context, type), kJSPropertyAttributeReadOnly);
 
     //id
     if (priv->getID() >= 0)
@@ -550,24 +709,24 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
               throw TypeMismatchException("Notification's ID conversion is failed.");
 
            JSUtil::setProperty(context, object, NOTIFICATION_ID,
-               JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeNone);    
+               JSUtil::toJSValueRef(context, stream.str()), kJSPropertyAttributeReadOnly);        
     }
     else
     {
            JSUtil::setProperty(context, object, NOTIFICATION_ID,
-                   JSValueMakeNull(context), kJSPropertyAttributeNone);
+                   JSValueMakeNull(context), kJSPropertyAttributeReadOnly);
     }
 
     //postedTime
     if (priv->getPostedTime() > 0)
     {
            JSUtil::setProperty(context, object, NOTIFICATION_POSTED_TIME,
-                JSUtil::makeDateObject(context,priv->getPostedTime()), kJSPropertyAttributeNone);  
+                JSUtil::makeDateObject(context,priv->getPostedTime()), kJSPropertyAttributeReadOnly);  
     }
     else
     {
            JSUtil::setProperty(context, object, NOTIFICATION_POSTED_TIME,
-                   JSValueMakeNull(context), kJSPropertyAttributeNone);
+                   JSValueMakeNull(context), kJSPropertyAttributeReadOnly);
     }    
 
     //title
@@ -603,7 +762,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
            if (!thumbnails[i].empty())
            {
                LogInfo("Thumbnail :" << thumbnails[i]);
-                tumbnailvalueArray[i] =  JSUtil::toJSValueRef(context, thumbnails[i]);
+                tumbnailvalueArray[i] =  JSUtil::toJSValueRef(context, DeviceAPI::Filesystem::Utils::toVirtualPath(context, thumbnails[i]));
            }
     }
 
@@ -628,6 +787,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
     JSUtil::setProperty(context, object, STATUS_NOTIFICATION_APP_ID,
             JSUtil::toJSValueRef(context, priv->getApplicationId()), kJSPropertyAttributeNone);            
 
+#if 0
     // progressType   & Value
     LogInfo("Progress Type=" << priv->getProgressType());
 
@@ -651,7 +811,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob
     LogInfo("Progress Value =" << progressVal);        
     JSUtil::setProperty(context, object, STATUS_NOTIFICATION_PROGRESS_VALUE,               
             JSUtil::toJSValueRef(context, progressVal), kJSPropertyAttributeNone);
-
+#endif
     // detailInfo
     std::vector<NotificationDetailInfo*> detailInfo = priv->getDetailInfos();
     LogInfo("detail Info Size : " << detailInfo.size());
index a5b1b84..a2c2a49 100755 (executable)
@@ -38,6 +38,8 @@ public:
 
     static StatusNotification* getPrivateObject(JSContextRef context, JSObjectRef object);
     static void setPrivateObject(JSContextRef context, JSObjectRef object, StatusNotification *priv);
+    static bool setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+    static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);          
 private:
 
     /**
index 229789a..74606fc 100755 (executable)
@@ -112,10 +112,10 @@ int NotificationManager::post(StatusNotification *notification)
 
        if ( notification )
        {
-               LogDebug(" notification id = " << notification->getID());
+               LogInfo(" notification id = " << notification->getID());
                notification_h handle = (notification_h)notification->getNotificationHandle();
 
-               LogDebug("notification hanel :" << handle);
+               LogInfo("notification hanel :" << handle);
 
                if ( handle )
                {
@@ -133,12 +133,22 @@ int NotificationManager::post(StatusNotification *notification)
                                }
                                else
                                {
-                                       notification_set_property(handle, 0);
-                                       notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+                                       if (notification->getLaunchFlag())
+                                       {
+                                               LogInfo("Notification Launch Flag True");
+                                               notification_set_property(handle, 0);
+                                               notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+                                       }
+                                       else
+                                       {
+                                               LogInfo("Notification Launch Flag False");
+                                               notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+                                       }
+                                       
                                        //bundle_free(service_data);
                                }
                        }
-
+               
                        //check layout.
                        int type = (int)notification->getNotiType();
                        notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
@@ -307,7 +317,35 @@ void NotificationManager::update(StatusNotification *notification)
                                int ret = notification_set_layout(handle, noti_layout);
                                LogDebug("set Layout result= " << ret);
 
+                               
+                               bundle *service_data = NULL;
+                               service_h service = notification->getService();
                        
+                               if (service)
+                               {
+                                       if (service_to_bundle(service, &service_data)!= SERVICE_ERROR_NONE)
+                                       {
+                                               throw UnknownException("Can't create bundle");  
+                                       }
+                                       else
+                                       {
+                                               if (notification->getLaunchFlag())
+                                               {
+                                                       LogInfo("Notification Launch Flag True");
+                                                       notification_set_property(handle, 0);
+                                                       notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
+                                               }
+                                               else
+                                               {
+                                                       LogInfo("Notification Launch Flag False");
+                                                       notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH);
+                                               }
+                                               
+                                       }
+                               }
+
+                               notification->setLaunchFlag(false);
+                                                       
                                LogDebug(" get Title = " << notification->getTitle());
                                ret = notification_update(handle);
                                LogDebug(" notification_update = " << ret);
index ad8e5d5..870633d 100755 (executable)
@@ -98,7 +98,8 @@ StatusNotification::StatusNotification(NotificationType statusType) :
        m_service(NULL),
        m_notiHandle(NULL),
        m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
-       m_notiUpdated(false)
+       m_notiUpdated(false),
+       m_launchFlag(false)
 {
        LogInfo("statusType =" << statusType);
 
@@ -150,7 +151,8 @@ StatusNotification::StatusNotification(void* noti) :
        m_service(NULL),
        m_notiHandle(NULL),
        m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
-       m_notiUpdated(false)
+       m_notiUpdated(false),
+       m_launchFlag(false)
 {
        LogInfo("noti : " << noti);
        
@@ -241,7 +243,8 @@ StatusNotification::StatusNotification(int privID) :
        m_service(NULL),
        m_notiHandle(NULL),
        m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
-       m_notiUpdated(false)
+       m_notiUpdated(false),
+       m_launchFlag(false)
 {
        LogInfo("priv ID : " << privID);
 
@@ -826,6 +829,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati
                LogInfo("getOperation : " << control->getOperation().c_str());
                if (control->getOperation().size() != 0)
                {
+                       m_launchFlag = true;            //default attribute
                        if (service_set_operation(m_service, control->getOperation().c_str()) != SERVICE_ERROR_NONE)
                        {
                                throw UnknownException("service set operation error");
@@ -936,9 +940,13 @@ void StatusNotification::setApplicationId(const std::string& appId)
 
        if (m_service)
        {
-               if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
+               if (!appId.empty())
                {
-                       throw DeviceAPI::Common::UnknownException ("service set appId error");  
+                       m_launchFlag = true;
+                       if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
+                       {
+                               throw DeviceAPI::Common::UnknownException ("service set appId error");  
+                       }
                }
        }
 
index cd246bb..17c5096 100755 (executable)
@@ -65,6 +65,16 @@ public:
              return m_notiUpdated;
         }
 
+       bool getLaunchFlag()
+       {
+           return m_launchFlag;
+       }
+
+       void setLaunchFlag(bool value)
+       {
+           m_launchFlag = value;
+       }
+
        NotificationType getNotiType()
        {
                return m_notiType;
@@ -162,6 +172,7 @@ protected:
        notification_h m_notiHandle;
        NotificationProgressType m_progressType;
        bool m_notiUpdated;
+       bool m_launchFlag;
        
        std::vector<std::string> m_thumbs;                              //thumbnail images path
        std::vector<NotificationDetailInfo*> m_detailInfos;   // detail Info
index 9a92317..779de61 100755 (executable)
@@ -21,6 +21,7 @@
 
 #include <Logger.h>
 #include <GlobalContextManager.h>
+#include <TimeTracer.h>
 
 #include "JSNotificationManager.h"
 #include "JSStatusNotification.h"
@@ -47,6 +48,7 @@ class_definition_options_t ConstructorClassOptions =
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\Notification] on_widget_start_callback (%d)" << widgetId);
+       TIME_TRACER_INIT();
     try {
         WrtAccessSingleton::Instance().initialize(widgetId);
     } catch (...) {
@@ -57,6 +59,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\Notification] on_widget_stop_callback (%d)" << widgetId);
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Notification");
+       TIME_TRACER_RELEASE();
     try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
     } catch (...) {
index e7e94a2..ede4af6 100644 (file)
@@ -10,7 +10,7 @@ PKG_CHECK_MODULES(platform_pkgs_package REQUIRED
 )
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${TOP}/Package
        ${platform_pkgs_package_INCLUDE_DIRS}
 )
index e6758e1..347e347 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <JSUtil.h>
 #include <GlobalContextManager.h>
+#include <TimeTracer.h>
 #include <dlog.h>
 
 #include "JSPackageManager.h"
@@ -114,6 +115,7 @@ JSValueRef JSPackageManager::install(JSContextRef context,
        JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -150,7 +152,7 @@ JSValueRef JSPackageManager::install(JSContextRef context,
                PackageInstallEventCallback *pkgInstallEventCB = new PackageInstallEventCallback(GlobalContextManager::getInstance()->getGlobalContext(context), onprogressCb, oncompleteCb, onerrorCb);
                
                PackageManager::getInstance()->install(path, pkgInstallEventCB);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
                
        } catch (const BasePlatformException &err) {
@@ -170,6 +172,7 @@ JSValueRef JSPackageManager::uninstall(JSContextRef context,
        JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -206,7 +209,7 @@ JSValueRef JSPackageManager::uninstall(JSContextRef context,
                PackageInstallEventCallback *pkgInstallEventCB = new PackageInstallEventCallback(GlobalContextManager::getInstance()->getGlobalContext(context), onprogressCb, oncompleteCb, onerrorCb);
 
                PackageManager::getInstance()->uninstall(id, pkgInstallEventCB);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
                
        } catch (const BasePlatformException &err) {
@@ -226,6 +229,7 @@ JSValueRef JSPackageManager::getPackagesInfo(JSContextRef context,
        JSValueRef* exception) 
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGES_INFO);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -242,7 +246,7 @@ JSValueRef JSPackageManager::getPackagesInfo(JSContextRef context,
                }
 
                PackageManager::getInstance()->getPackagesInfo(callback);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
                
        } catch (const BasePlatformException &err) {
@@ -261,6 +265,7 @@ JSValueRef JSPackageManager::getPackageInfo(JSContextRef context,
        JSValueRef* exception) 
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGE_INFO);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -271,7 +276,7 @@ JSValueRef JSPackageManager::getPackageInfo(JSContextRef context,
                //LogDebug("id = " << id);
                
                PackageInformation* pkgInfo = PackageManager::getInstance()->getPackageInfo(id);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSPackageInformation::createJSObject(context, pkgInfo);
 
        } catch (const BasePlatformException &err) {
@@ -291,6 +296,7 @@ JSValueRef JSPackageManager::setPackageInfoEventListener(JSContextRef context,
        JSValueRef* exception) 
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_SET_PACKAGE_INFO_EVENT_LISTENER);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
@@ -325,7 +331,7 @@ JSValueRef JSPackageManager::setPackageInfoEventListener(JSContextRef context,
                PackageInfoEventCallback *pkginfoEventCB = new PackageInfoEventCallback(oninstalledCb, onupdatedCb, onuninstalledCb);
 
                PackageManager::getInstance()->setPackageInfoEventListener(pkginfoEventCB);
-
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
                
        } catch (const BasePlatformException &err) {
@@ -344,12 +350,14 @@ JSValueRef JSPackageManager::unsetPackageInfoEventListener(JSContextRef context,
         JSValueRef* exception)
 {
        LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
        AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_UNSET_PACKAGE_INFO_EVENT_LISTENER);
        TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
        try {
                PackageManager::getInstance()->unsetPackageInfoEventListener();
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return JSValueMakeUndefined(context);
 
        } catch(const BasePlatformException& err) {
index 5d468e2..b3acbde 100644 (file)
@@ -248,6 +248,7 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
        ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &id);
        if ((ret != PMINFO_R_OK) || (id == NULL)) {
                LogDebug("Fail to get id. return NULL.");
+               delete pkgInfo;
                return NULL;
        } else {
                pkgInfo->m_id = id;
@@ -321,6 +322,7 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
        ret = package_manager_get_package_info(id, &package_info);
        if (ret != PACKAGE_MANAGER_ERROR_NONE) {
                LogDebug("Cannot create package info by : " << id);
+               delete pkgInfo;
                return NULL;
        }
 
@@ -408,77 +410,102 @@ static void getThreadCB(void *data, Ecore_Thread *thread)
        g_idle_add(getCompleteCB, data);
 }
 
-static void package_event_cb(const char *type, const char *package,
-                       package_manager_event_type_e event_type,
-                       package_manager_event_state_e event_state,
-                       int progress,
-                       package_manager_error_e error,
-                       void *user_data)
-{
-       LogDebug("event callback is called!!! : event_state " << event_state << " : package " << package << " : event_type " << event_type );
-       if (event_state == PACAKGE_MANAGER_EVENT_STATE_COMPLETED) {
-               PackageInfoEventCallback *eventCB = (PackageInfoEventCallback *)user_data;
-
-               switch(event_type) {
-               case PACAKGE_MANAGER_EVENT_TYPE_INSTALL: {
-                       pkgmgrinfo_pkginfo_h handle;
-                       int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
-                       if (ret != PMINFO_R_OK) {
-                               LogDebug("fail to find pkg info with given pkg : " << package);
-                               // Do not throw exception. No one can handle exception because this code is called from async callback.
-                               //throw NotFoundException("Can't find given package");
-                               break;
-                       }
-
-                       PackageInformation* pkgInfo = create_pkg_info(handle);
-                       pkgmgrinfo_appinfo_destroy_appinfo(handle);
 
-                       if (pkgInfo == NULL) {
-                               LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
-                       } else {
-                               CallbackUserData *callback = eventCB->getOnInstalled();
-                               if (callback) {
-                                       callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
-                               }
-                       }
+static void package_event_cb(app_manger_event_type_e event_type, const char *package, void *user_data)
+{
+       PackageInfoEventCallback *eventCB = (PackageInfoEventCallback *)user_data;
+       
+       switch(event_type) {
+       case APP_MANAGER_EVENT_INSTALLED: {
+               pkgmgrinfo_pkginfo_h handle;
+               int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+               if (ret != PMINFO_R_OK) {
+                       LogDebug("fail to find pkg info with given pkg : " << package);
+                       // Do not throw exception. No one can handle exception because this code is called from async callback.
+                       //throw NotFoundException("Can't find given package");
                        break;
                }
-               case PACAKGE_MANAGER_EVENT_TYPE_UNINSTALL: {
-                       LogDebug("uninstall : " << package);
-                       CallbackUserData *callback = eventCB->getOnUninstalled();
+       
+               PackageInformation* pkgInfo = create_pkg_info(handle);
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       
+               if (pkgInfo == NULL) {
+                       LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
+               } else {
+                       CallbackUserData *callback = eventCB->getOnInstalled();
                        if (callback) {
-                               Converter converter(callback->getContext());
-                               callback->callSuccessCallback(converter.toJSValueRef(package));
+                               callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
                        }
+               }
+               break;
+       }
+       case APP_MANAGER_EVENT_UNINSTALLED: {
+               LogDebug("uninstall : " << package);
+               CallbackUserData *callback = eventCB->getOnUninstalled();
+               if (callback) {
+                       Converter converter(callback->getContext());
+                       callback->callSuccessCallback(converter.toJSValueRef(package));
+               }
+               break;
+       }
+       case APP_MANAGER_EVENT_UPDATED: {
+               pkgmgrinfo_pkginfo_h handle;
+               int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+               if (ret != PMINFO_R_OK) {
+                       // Do not throw exception. No one can handle exception because this code is called from async callback.
+                       //throw NotFoundException("Can't find given package");
                        break;
                }
-               case PACAKGE_MANAGER_EVENT_TYPE_UPDATE: {
-                       pkgmgrinfo_pkginfo_h handle;
-                       int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
-                       if (ret != PMINFO_R_OK) {
-                               // Do not throw exception. No one can handle exception because this code is called from async callback.
-                               //throw NotFoundException("Can't find given package");
-                               break;
+       
+               PackageInformation* pkgInfo = create_pkg_info(handle);
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       
+               if (pkgInfo == NULL) {
+                       LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
+               } else {
+                       CallbackUserData *callback = eventCB->getOnUpdated();
+                       if (callback) {
+                               callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
                        }
+               }
+               break;
+       }
+       default:
+               LogDebug("Fail!! Unknown event type is entered : " << event_type);
+               break;
+       }
 
-                       PackageInformation* pkgInfo = create_pkg_info(handle);
-                       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       
+}
 
-                       if (pkgInfo == NULL) {
-                               LogDebug("Fail to get pkg info. skip callback call for pkgid " << package);
-                       } else {
-                               CallbackUserData *callback = eventCB->getOnUpdated();
-                               if (callback) {
-                                       callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
-                               }
-                       }
-                       break;
+static int app_list_changed_cb_broker(int id, const char *type, const char *package, const char *key, const char *val, const void *msg, void *data)
+{
+       static app_manger_event_type_e event_type;
+
+       if (!strcasecmp(key, "start"))
+       {
+               if (!strcasecmp(val, "install"))
+               {
+                       event_type = APP_MANAGER_EVENT_INSTALLED;
                }
-               default:
-                       LogDebug("Fail!! Unknown event type is entered : " << event_type);
-                       break;
+               else if (!strcasecmp(val, "uninstall"))
+               {
+                       event_type = APP_MANAGER_EVENT_UNINSTALLED;
+               }
+               else if (!strcasecmp(val, "update"))
+               {
+                       event_type = APP_MANAGER_EVENT_UPDATED;
+               }
+       }
+       else if (!strcasecmp(key, "end") && !strcasecmp(val, "ok"))
+       {
+               if (event_type >= 0)
+               {
+                       package_event_cb(event_type, package, data);
                }
        }
+
+       return APP_MANAGER_ERROR_NONE;
 }
 
 
@@ -699,42 +726,28 @@ void PackageManager::getPackagesInfo(PackageInfoCallbackData *user_data)
 void PackageManager::setPackageInfoEventListener(PackageInfoEventCallback * eventCB)
 {
        LogDebug("enter");
-       int ret = 0;
 
        if (m_manager_handle == NULL) {
-               ret = package_manager_create(&m_manager_handle);
-               if (ret != PACKAGE_MANAGER_ERROR_NONE) {
+               m_manager_handle = pkgmgr_client_new(PC_LISTENING);
+               if (m_manager_handle == NULL) {
                        throw UnknownException("Fail to create package manager handle");
                }
        }
-       
-       ret = package_manager_set_event_cb(m_manager_handle, package_event_cb, eventCB);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               throw UnknownException("Fail to set event cb");
-       }
+
+       pkgmgr_client_listen_status(m_manager_handle, app_list_changed_cb_broker, eventCB);
 }
 
 void PackageManager::unsetPackageInfoEventListener()
 {
        LogDebug("enter");
-       int ret = 0;
 
        if (m_manager_handle == NULL) {
                LogDebug("no package manager handle registered");
                return;
        }
-       
-       ret = package_manager_unset_event_cb(m_manager_handle);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               throw UnknownException("Fail to unset event cb");
-       }
 
-       ret = package_manager_destroy(m_manager_handle);
-       if (ret != PACKAGE_MANAGER_ERROR_NONE) {
-               throw UnknownException("Fail to destroy package manager handle");
-       } else {
-               m_manager_handle = NULL;
-       }
+       pkgmgr_client_free(m_manager_handle);
+       m_manager_handle = NULL;
 }
 
 PackageManager* PackageManager::getInstance(){
@@ -751,9 +764,12 @@ PackageManager::PackageManager()
 PackageManager::~PackageManager()
 {
        LogDebug("Destroy PackageManager");
+
        if (m_manager_handle != NULL) {
-               package_manager_destroy(m_manager_handle);
-       }       
+               pkgmgr_client_free(m_manager_handle);
+               m_manager_handle = NULL;
+       }
+
 }
 
 
old mode 100755 (executable)
new mode 100644 (file)
index 5d79112..c037876
@@ -26,6 +26,7 @@
 #include <Commons/Exception.h>
 
 #include <package_manager.h>
+#include <package-manager.h>
 
 #include "PackageInformation.h"
 
@@ -115,7 +116,7 @@ public:
 private:
        PackageManager();
        ~PackageManager();
-       package_manager_h m_manager_handle;     
+       pkgmgr_client *m_manager_handle;
 
 };
 
index a451274..9345146 100644 (file)
@@ -19,6 +19,7 @@
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <GlobalContextManager.h>
+#include <TimeTracer.h>
 #include "JSPackageManager.h"
 
 using namespace WrtDeviceApis;
@@ -30,6 +31,7 @@ namespace Package {
 
 void on_widget_start_callback(int widgetId) {
        LogDebug("[Tizen2_1\\Package] on_widget_start_callback ("<<widgetId<<")");
+       TIME_TRACER_INIT();
     Try {
         WrtAccessSingleton::Instance().initialize(widgetId);
     } Catch(WrtDeviceApis::Commons::Exception) {
@@ -39,6 +41,8 @@ void on_widget_start_callback(int widgetId) {
 
 void on_widget_stop_callback(int widgetId) {
        LogDebug("[Tizen2_1\\Package] on_widget_stop_callback ("<<widgetId<<")");
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Package");
+       TIME_TRACER_RELEASE();
     Try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
     } Catch(WrtDeviceApis::Commons::Exception) {
index 427d1cd..234836b 100755 (executable)
@@ -5,7 +5,7 @@ SET(TARGET_IMPL_NAME ${power_impl})
 PKG_CHECK_MODULES(platform_pkgs_power REQUIRED capi-system-power pmapi capi-system-device)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${platform_pkgs_power_INCLUDE_DIRS}
 )
 
index b1a7fd4..82c55de 100755 (executable)
@@ -22,6 +22,7 @@
 #include <JSUtil.h>
 #include <JSWebAPIException.h>
 #include <ArgumentValidator.h>
+#include <TimeTracer.h>
 
 #include "JSPowerManager.h"
 #include "plugin_config.h"
@@ -107,11 +108,11 @@ JSValueRef JSPowerManager::request(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_REQUEST);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-    
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
         string resource_str = validator.toString(0);
@@ -119,11 +120,11 @@ JSValueRef JSPowerManager::request(JSContextRef context,
         PowerResource resource(resource_str.c_str());
         PowerState state(state_str.c_str());
         PowerManager::getInstance()->request( resource , state );
-
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
@@ -135,6 +136,7 @@ JSValueRef JSPowerManager::release(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
@@ -146,6 +148,7 @@ JSValueRef JSPowerManager::release(JSContextRef context,
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
@@ -157,6 +160,7 @@ JSValueRef JSPowerManager::setScreenStateChangeListener(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     try{
         ArgumentValidator validator(context, argumentCount, arguments);
@@ -175,6 +179,7 @@ JSValueRef JSPowerManager::setScreenStateChangeListener(JSContextRef context,
         return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Out of memory");
     }
 
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
@@ -186,6 +191,7 @@ JSValueRef JSPowerManager::unsetScreenStateChangeListener(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     CallbackUserData *callback = static_cast<CallbackUserData*>(JSObjectGetPrivate(thisObject));
     if( callback != NULL ){
@@ -193,6 +199,7 @@ JSValueRef JSPowerManager::unsetScreenStateChangeListener(JSContextRef context,
         JSObjectSetPrivate(thisObject, NULL);
         delete callback;
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
@@ -204,9 +211,11 @@ JSValueRef JSPowerManager::getScreenBrightness(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     try{
         double brightness = PowerManager::getInstance()->getScreenBrightness();
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSUtil::toJSValueRef(context, brightness);
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
@@ -221,6 +230,7 @@ JSValueRef JSPowerManager::setScreenBrightness(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
     try{
@@ -232,6 +242,7 @@ JSValueRef JSPowerManager::setScreenBrightness(JSContextRef context,
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 
 }
@@ -244,9 +255,11 @@ JSValueRef JSPowerManager::isScreenOn(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     try{
         bool state = PowerManager::getInstance()->isScreenOn();
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSUtil::toJSValueRef(context,state);
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
@@ -261,12 +274,14 @@ JSValueRef JSPowerManager::restoreScreenBrightness(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
 
     try{
         PowerManager::getInstance()->restoreScreenBrightness();
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);}
 
 JSValueRef JSPowerManager::turnScreenOn(JSContextRef context,
@@ -277,6 +292,7 @@ JSValueRef JSPowerManager::turnScreenOn(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -285,6 +301,7 @@ JSValueRef JSPowerManager::turnScreenOn(JSContextRef context,
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
@@ -296,6 +313,7 @@ JSValueRef JSPowerManager::turnScreenOff(JSContextRef context,
         JSValueRef* exception)
 {
     LogDebug("entered");
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -304,6 +322,7 @@ JSValueRef JSPowerManager::turnScreenOff(JSContextRef context,
     }catch(const BasePlatformException& err){
         return JSWebAPIException::throwException(context, exception, err);
     }
+       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
     return JSValueMakeUndefined(context);
 }
 
index 45547e7..0173fa8 100755 (executable)
@@ -100,17 +100,26 @@ void PowerManager::request(PowerResource resource, PowerState state){
         throw InvalidValuesException("invalid PowerState");
 
     int ret=0;
-    int native_state = POWER_STATE_SCREEN_OFF;
     switch( state ){
         case PowerState::SCREENDIM :
-            native_state = POWER_STATE_SCREEN_DIM;
         case PowerState::SCREENNORMAL :
-            native_state = POWER_STATE_NORMAL;
         case PowerState::CPUAWAKE :
-            ret = power_lock_state( state.mState == PowerState::SCREENDIM ? POWER_STATE_SCREEN_DIM : POWER_STATE_NORMAL, 0);
-            if( POWER_ERROR_NONE!=ret )
+        {
+            int native_state = POWER_STATE_SCREEN_OFF;
+            if( state == PowerState::SCREENDIM )
+                native_state = POWER_STATE_SCREEN_DIM;
+            else if( state == PowerState::SCREENNORMAL )
+                native_state = POWER_STATE_NORMAL;
+            else
+                native_state = POWER_STATE_SCREEN_OFF;
+
+            ret = power_lock_state( (power_state_e)native_state , 0);
+            if( POWER_ERROR_NONE!=ret ){
+                LOGE("power_lock_state(%d) error %d",native_state, ret);
                 throw UnknownException("power_lock_state error");
+            }
             break;
+        }
         case PowerState::SCREENBRIGHT :
         {
             int maxBrightness;
@@ -121,13 +130,17 @@ void PowerManager::request(PowerResource resource, PowerState state){
             }
 
             ret = device_set_brightness(0, maxBrightness);
-            if( DEVICE_ERROR_NONE!=ret)
-                throw UnknownException("Platform error while setting max brightness:");
+            if( DEVICE_ERROR_NONE!=ret){
+                LOGE("Platform error while setting %d brightness: %d", maxBrightness, ret);
+                throw UnknownException("Platform error while setting max brightness");
+            }
 
             LOGI("Succeeded setting the brightness to a max level: %d", maxBrightness);
             ret = power_lock_state(POWER_STATE_NORMAL, 0);
-            if( POWER_ERROR_NONE!=ret )
+            if( POWER_ERROR_NONE!=ret ){
+                LOGE("Platform error while locking state %d", ret);
                 throw UnknownException("Platform error while locking state");
+            }
 
             mBrightStateEnable = true;
             power_state_e platform_state = power_get_state();
@@ -135,6 +148,10 @@ void PowerManager::request(PowerResource resource, PowerState state){
                 broadcastScreenState(PowerState::SCREENBRIGHT);
             break;
         }
+        case PowerState::SCREENOFF:
+            LOGE("SCREEN_OFF state cannot be requested");
+            throw InvalidValuesException("SCREEN_OFF state cannot be requested");
+
         default :
             throw UnknownException("Platform error while locking state");
     }
@@ -152,8 +169,10 @@ void PowerManager::release(PowerResource resource){
             LOGI("Platform return value from dim unlock: %d", ret);
 
         ret = device_set_brightness_from_settings(0);
-        if( DEVICE_ERROR_NONE!=ret)
+        if( DEVICE_ERROR_NONE!=ret){
+            LOGE("Platform error while setting restore brightness %d", ret);
             throw UnknownException("Platform error while setting restore brightness");
+        }
 
         mBrightStateEnable = false;
         power_state_e platform_state = power_get_state();
@@ -170,8 +189,10 @@ void PowerManager::release(PowerResource resource){
 double PowerManager::getScreenBrightness(){
     int ret, brightness;
     ret = device_get_brightness(0, &brightness);
-    if( DEVICE_ERROR_NONE!=ret )
+    if( DEVICE_ERROR_NONE!=ret ){
+        LOGE("Platform error while get brightness %d", ret);
         throw UnknownException("Platform error while get brightness");
+    }
     LOGI("Brightness value: %d", brightness);
     return brightness/100.0;
 }
@@ -186,11 +207,13 @@ void PowerManager::setScreenBrightness(double brightness){
         LOGE("Platform error while setting restore brightness: %d", ret);
         throw UnknownException("Platform error while getting max brightness");
     }
-
-    ret = device_set_brightness(0, (int)(brightness*maxBrightness));
-    if( DEVICE_ERROR_NONE!=ret )
+    int nativeBrightness = (int)(brightness*maxBrightness);
+    ret = device_set_brightness(0, nativeBrightness);
+    if( DEVICE_ERROR_NONE!=ret ){
+        LOGE("Platform error while setting %d brightness : %d",nativeBrightness, ret);
         throw UnknownException("Platform error while setting brightness.");
-    LOGI("Set the brightness value: %d", (int)(brightness*maxBrightness));
+    }
+    LOGI("Set the brightness value: %d", nativeBrightness);
 }
 
 bool PowerManager::isScreenOn(){
@@ -208,15 +231,19 @@ void PowerManager::setScreenState(bool onoff){
     else
         ret = pm_change_state(LCD_OFF);
 
-    if( ret<0 )
+    if( ret<0 ){
+        LOGE("Platform error while changing screen state %d", ret);
         throw UnknownException("Platform error while changing screen state");
+    }
 }
 
 void PowerManager::restoreScreenBrightness(){
     int ret;
     ret = device_set_brightness_from_settings(0);
-    if( DEVICE_ERROR_NONE!=ret)
+    if( DEVICE_ERROR_NONE!=ret){
+        LOGE("Platform error while restoring brightness %d", ret);
         throw UnknownException("Platform error while restoring brightness");
+    }
 }
 
 PowerManager* PowerManager::getInstance(){
index 6279ff3..aef48eb 100755 (executable)
@@ -22,6 +22,7 @@
 #include <Commons/Exception.h>
 #include "JSPowerManager.h"
 #include <GlobalContextManager.h>
+#include <TimeTracer.h>
 
 namespace DeviceAPI {
 namespace Power {
@@ -33,6 +34,7 @@ using namespace DeviceAPI::Common;
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\Power] on_widget_start_callback (" << widgetId << ")");
+       TIME_TRACER_INIT();
 
        Try {
         WrtAccessSingleton::Instance().initialize(widgetId);
@@ -44,6 +46,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\Power] on_widget_stop_callback (" << widgetId << ")");
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Power");
+       TIME_TRACER_RELEASE();
 
        Try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
index 0684729..8321951 100644 (file)
@@ -6,8 +6,7 @@ SET(TARGET_IMPL_NAME ${push_impl})
 PKG_CHECK_MODULES(platform_pkgs_push REQUIRED push capi-appfw-application)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
-       ${TOP}/Common/TimeTracer
+       ${INCLUDE_COMMON}
        ${TOP}/Application
        ${platform_pkgs_push_INCLUDE_DIRS}
 )
index 9a690d9..3abc0e7 100644 (file)
@@ -25,6 +25,7 @@
 #include <PlatformException.h>
 
 #include <JSApplicationControl.h>
+#include <TimeTracer.h>
 
 #include "plugin_config.h"
 
@@ -99,6 +100,7 @@ JSValueRef JSPushManager::registerService(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_REGISTER_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -139,6 +141,7 @@ JSValueRef JSPushManager::registerService(JSContextRef context,
         // perform
         priv->registerService(appControl, callback);
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         LogError(err.getName() << ": " << err.getMessage());
@@ -157,6 +160,7 @@ JSValueRef JSPushManager::unregisterService(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_UNREGISTER_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -186,6 +190,7 @@ JSValueRef JSPushManager::unregisterService(JSContextRef context,
         // perform
         priv->unregisterService(callback);
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         LogError(err.getName() << ": " << err.getMessage());
@@ -204,6 +209,7 @@ JSValueRef JSPushManager::connectService(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_CONNECT_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -227,6 +233,7 @@ JSValueRef JSPushManager::connectService(JSContextRef context,
         // perform
         priv->connectService(callback);
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         LogError(err.getName() << ": " << err.getMessage());
@@ -245,6 +252,7 @@ JSValueRef JSPushManager::disconnectService(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_DISCONNECT_SERVICE);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -258,6 +266,7 @@ JSValueRef JSPushManager::disconnectService(JSContextRef context,
         // perform
         priv->disconnectService();
 
+               TIME_TRACER_ITEM_END(__FUNCTION__, 0);
         return JSValueMakeUndefined(context);
     } catch (const BasePlatformException &err) {
         LogError(err.getName() << ": " << err.getMessage());
@@ -276,6 +285,7 @@ JSValueRef JSPushManager::getRegistrationId(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
+       TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
     AceSecurityStatus status = PUSH_CHECK_ACCESS(PUSH_MANAGER_API_GET_REGISTRATION_ID);
     TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
@@ -289,9 +299,11 @@ JSValueRef JSPushManager::getRegistrationId(JSContextRef context,
         // perform
         std::string ret = priv->getRegistrationId();
         if (ret.empty()) {
+                       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
             return JSValueMakeNull(context);
         } else {
-            return JSUtil::toJSValueRef(context, ret);
+                       TIME_TRACER_ITEM_END(__FUNCTION__, 0);
+                       return JSUtil::toJSValueRef(context, ret);
         }
     } catch (const BasePlatformException &err) {
         LogError(err.getName() << ": " << err.getMessage());
index 551dc9e..d5e506f 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "JSPushManager.h"
 
+#include <TimeTracer.h>
 #include <Logger.h>
 
 using namespace WrtDeviceApis;
@@ -35,6 +36,7 @@ namespace Push {
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\Push] on_widget_start_callback (%d)", widgetId);
+       TIME_TRACER_INIT();
     try {
         WrtAccessSingleton::Instance().initialize(widgetId);
     } catch (...) {
@@ -45,6 +47,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\Push] on_widget_stop_callback (%d)", widgetId);
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Push");
+       TIME_TRACER_RELEASE();
     try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
     } catch (...) {
index 91e5b4e..a91a602 100755 (executable)
@@ -20,6 +20,9 @@
 #include <Commons/WrtAccess/WrtAccess.h>
 #include "JSSEService.h"
 
+namespace DeviceAPI {
+namespace SecureElement {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -56,3 +59,5 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "seService", (js_class_template_getter)DeviceAPI::SecureElement::JSSEService::getClassRef, NULL)
 PLUGIN_CLASS_MAP_END
 
+} // SecureElement
+} // DeviceAPI
index d89902c..cc8ed19 100644 (file)
@@ -4,7 +4,7 @@ SET(DESTINATION_NAME ${systemsetting_dest})
 PKG_CHECK_MODULES(platform_pkgs_systemsetting REQUIRED capi-system-system-settings)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Common
+       ${INCLUDE_COMMON}
        ${TOP}/Filesystem
        ${platform_pkgs_systemsetting_INCLUDE_DIRS}
 )
index 0913758..a11b7ea 100755 (executable)
@@ -32,6 +32,7 @@
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
+#include <TimeTracer.h>
 #include "JSSystemSetting.h"
 #include "SystemSettingResponseDispatcher.h"
 
@@ -181,11 +182,13 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object
        JSCallbackManagerPtr callbackManager(JSCallbackManager::createObject(priv->getContext(), onSuccessForCbm, onErrorForCbm, true, true));
        callbackManager->setObject(thisObject);
 
+       std::string strSettingType;
        Try {
+               strSettingType = converter->toString(arguments[0]);
+               TIME_TRACER_ITEM_BEGIN(strSettingType.c_str(), 0);
 
                settingType = converter->toSettingType(arguments[0]);
                settingValue = converter->toString(arguments[1]);
-
                Try{
                        DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(priv->getContext(), settingValue);
                        if (src)
@@ -233,6 +236,7 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object
        }
 
        LogDebug("end");
+       TIME_TRACER_ITEM_END(strSettingType.c_str(), 0);
        return JSValueMakeUndefined(context);
 }
 
@@ -277,8 +281,10 @@ JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object
        JSCallbackManagerPtr callbackManager(JSCallbackManager::createObject(priv->getContext(), onSuccessForCbm, onErrorForCbm, true, true));
        callbackManager->setObject(thisObject);
 
+       std::string strGettingType;
        Try {
-
+               strGettingType = converter->toString(arguments[0]);
+               TIME_TRACER_ITEM_BEGIN(strGettingType.c_str(), 0);
                SettingType settingType = converter->toSettingType(arguments[0]);
 
                ISystemSettingPtr SystemSettings(priv->getObject());
@@ -313,6 +319,7 @@ JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object
        }
 
        LogDebug("end");
+       TIME_TRACER_ITEM_BEGIN(strGettingType.c_str(), 0);
        return JSValueMakeUndefined(context);
 }
 
index 57e5b64..450076c 100755 (executable)
 #include <dpl/log/log.h>
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
+#include <TimeTracer.h>
 #include "JSSystemSetting.h"
 #include "SystemSettingAsyncCallbackManager.h"
 //#include "MessageListenerManager.h"
 
+namespace DeviceAPI {
+namespace SystemSetting {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -30,6 +34,7 @@ using namespace WrtDeviceApis::Commons;
 void on_widget_start_callback(int widgetId)
 {
     LogDebug("[Tizen\\SystemSetting ] on_widget_start_callback (" << widgetId << ")");
+       TIME_TRACER_INIT();
     Try
     {
         WrtAccessSingleton::Instance().initialize(widgetId);
@@ -43,6 +48,8 @@ void on_widget_start_callback(int widgetId)
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[Tizen\\SystemSetting ] on_widget_stop_callback (" << widgetId << ")");
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"SystemSetting");
+       TIME_TRACER_RELEASE();
     Try
     {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
@@ -77,3 +84,5 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "systemsetting", (js_class_template_getter)DeviceAPI::SystemSetting::JSSystemSetting::getClassRef, NULL)
 PLUGIN_CLASS_MAP_END
 
+} // SystemSetting
+} // DeviceAPI
index 63b4c0d..fdf043e 100755 (executable)
@@ -8,7 +8,6 @@ PKG_CHECK_MODULES(platform_pkgs_systeminfo REQUIRED
        capi-system-info
        capi-system-runtime-info
        capi-system-sensor
-       capi-telephony-network-info
        sensor
 )
 
index 0bed328..3be346c 100755 (executable)
 // limitations under the License.
 //
 
+#include <fstream>
+#include <pcrecpp.h>
 #include <memory>
 #include <dpl/log/log.h>
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
+#include <sensor.h>
+#include <sensors.h>
+#include <system_info.h>
 #include "JSDeviceCapabilitiesInfo.h"
 #include "plugin_config.h"
 
@@ -245,96 +250,330 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
         Converter convert(context);
 
         if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BLUETOOTH)) {
+            bool bluetooth = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("bluetooth : " << bluetooth);
+                deviceCapabilitiesInfo->bluetooth = bluetooth;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->bluetooth);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC)) {
+            bool nfc = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("nfc : " << nfc);
+                deviceCapabilitiesInfo->nfc = nfc;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->nfc);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC_RESERVED_PUSH)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->nfcReservedPush);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MULTITOUCHCOUNT)) {
+            int multiTouchCount = 0;
+            if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("multiTouchCount : " << multiTouchCount);
+                deviceCapabilitiesInfo->multiTouchCount = multiTouchCount;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->multiTouchCount);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD)) {
+            char* inputKeyboard = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
+                if (inputKeyboard != NULL) {
+                    LogDebug("inputKeyboard : " << inputKeyboard);
+                    deviceCapabilitiesInfo->inputKeyboard = inputKeyboard;
+                    free(inputKeyboard);
+                }
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboard);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_INPUTKEYBOARD_LAYOUT)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->inputKeyboardLayout);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFI)) {
+            bool wifi = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("wifi : " << wifi);
+                deviceCapabilitiesInfo->wifi = wifi;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->wifi);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFIDIRECT)) {
+            bool wifiDirect = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("wifiDirect : " << wifiDirect);
+                deviceCapabilitiesInfo->wifiDirect = wifiDirect;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->wifiDirect);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->opengles);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLES_TEXTURE_FORMAT)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->openglestextureFormat);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION1_1)) {
+            char* openglesVersion = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
+                if (openglesVersion!= NULL) {
+                    LogDebug("openglesVersion : " << openglesVersion);
+                    if (strcmp(openglesVersion, "1.0") == 0) {
+                        deviceCapabilitiesInfo->openglesVersion1_1 = true;
+                    } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
+                        deviceCapabilitiesInfo->openglesVersion1_1 = true;
+                    }
+                    free(openglesVersion);
+                }
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion1_1);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_OPENGLESVERSION2_0)) {
+            char* openglesVersion = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
+                if (openglesVersion!= NULL) {
+                    LogDebug("openglesVersion : " << openglesVersion);
+                    if (strcmp(openglesVersion, "2.0") == 0) {
+                        deviceCapabilitiesInfo->openglesVersion2_0 = true;
+                    } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
+                        deviceCapabilitiesInfo->openglesVersion2_0 = true;
+                    }
+                    free(openglesVersion);
+                }
+            }        
             return convert.toJSValueRef(deviceCapabilitiesInfo->openglesVersion2_0);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_FMRADIO)) {
+            bool fmRadio = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("fmRadio : " << fmRadio);
+                deviceCapabilitiesInfo->fmRadio = fmRadio;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->fmRadio);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMVERSION)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
             TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* platformVersion = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
+                if (platformVersion) {
+                    LogDebug("platformVersion : " << platformVersion);
+                    deviceCapabilitiesInfo->platformVersion = platformVersion;
+                    free(platformVersion);
+                }
+            }            
             return convert.toJSValueRef(deviceCapabilitiesInfo->platformVersion);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMNAME)) {
+            char* platformName = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) {
+                if (platformName) {
+                    LogDebug("platformName : " << platformName);
+                    deviceCapabilitiesInfo->platformName = platformName;
+                    free(platformName);
+                }
+            }        
             return convert.toJSValueRef(deviceCapabilitiesInfo->platformName);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WEBAPIVERSION)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
             TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+            std::ifstream file("/usr/etc/system-info.ini");
+            std::string line;
+            std::string webApiVersionMajor = "";
+            std::string webApiVersionMinor = "";
+
+            if(!file) {
+                LogDebug("api/native version info file not found");
+            } else {
+                while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
+                    if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) {
+                        deviceCapabilitiesInfo->webApiVersion = webApiVersionMajor;
+                        deviceCapabilitiesInfo->webApiVersion += ".";
+                        deviceCapabilitiesInfo->webApiVersion += webApiVersionMinor;
+                        LogDebug("web api version : " << deviceCapabilitiesInfo->webApiVersion);
+                        break;
+                    }
+                }
+                file.close();    
+            }  
+
             return convert.toJSValueRef(deviceCapabilitiesInfo->webApiVersion);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NATIVEAPIVERSION)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_CAPABILITIES);
             TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
+            std::ifstream file("/usr/etc/system-info.ini");
+            std::string line;
+            std::string nativeApiVersionMajor = "";
+            std::string nativeApiVersionMinor = "";
+
+            if(!file) {
+                LogDebug("api/native version info file not found");
+            } else {
+                while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
+                    if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) {
+                        deviceCapabilitiesInfo->nativeApiVersion = nativeApiVersionMajor;
+                        deviceCapabilitiesInfo->nativeApiVersion += ".";
+                        deviceCapabilitiesInfo->nativeApiVersion += nativeApiVersionMinor;
+                        LogDebug("native api version : " << deviceCapabilitiesInfo->nativeApiVersion);
+                        break;
+                    }
+                }
+                file.close();    
+            }  
+
             return convert.toJSValueRef(deviceCapabilitiesInfo->nativeApiVersion);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONT)) {
+            bool cameraFront = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("cameraFront : " << cameraFront);
+                deviceCapabilitiesInfo->cameraFront = cameraFront;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFront);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERA)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->camera);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONTFLASH)) {
+            bool cameraFrontFlash = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("cameraFrontFlash : " << cameraFrontFlash);
+                deviceCapabilitiesInfo->cameraFrontFlash = cameraFrontFlash;
+            }        
             return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFrontFlash);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACK)) {
+            bool cameraBack = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("cameraBack : " << cameraBack);
+                deviceCapabilitiesInfo->cameraBack = cameraBack;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBack);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACKFLASH)) {
+            bool cameraBackFlash = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("cameraBackFlash : " << cameraBackFlash);
+                deviceCapabilitiesInfo->cameraBackFlash = cameraBackFlash;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBackFlash);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATION)) {
+            bool location = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_CPS_SUPPORTED, &location) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("location : " << location);
+                deviceCapabilitiesInfo->location = location;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->location);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONGPS)) {
+            bool locationGps = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("locationGps : " << locationGps);
+                deviceCapabilitiesInfo->locationGps = locationGps;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->locationGps);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONWPS)) {
+            bool locationWps = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("locationWps : " << locationWps);
+                deviceCapabilitiesInfo->locationWps = locationWps;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->locationWps);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MICROPHONE)) {
+            bool microphone = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, &microphone) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("microphone : " << microphone);
+                deviceCapabilitiesInfo->microphone = microphone;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->microphone);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBHOST)) {
+            bool usbHost = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("usbHost : " << usbHost);
+                deviceCapabilitiesInfo->usbHost = usbHost;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->usbHost);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBACCESSORY)) {
+            bool usbAccessory = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("usbAccessory : " << usbAccessory);
+                deviceCapabilitiesInfo->usbAccessory = usbAccessory;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->usbAccessory);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTRCA)) {
+            bool screenOutputRca = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("screenOutputRca : " << screenOutputRca);
+                deviceCapabilitiesInfo->screenOutputRca = screenOutputRca;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputRca);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTHDMI)) {
+            bool screenOutputHdmi = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("screenOutputHdmi : " << screenOutputHdmi);
+                deviceCapabilitiesInfo->screenOutputHdmi = screenOutputHdmi;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputHdmi);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCORECPUARCH)) {
+            char* platformCoreCpuArch = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) {
+                if (platformCoreCpuArch) {
+                    LogDebug("platformCoreCpuArch : " << platformCoreCpuArch);
+                    deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreCpuArch;
+                    free(platformCoreCpuArch);
+                }
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreCpuArch);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PLATFORMCOREFPUARCH)) {
+            char* platformCoreFpuArch = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) {
+                if (platformCoreFpuArch) {
+                    LogDebug("platformCoreFpuArch : " << platformCoreFpuArch);
+                    deviceCapabilitiesInfo->platformCoreFpuArch = platformCoreFpuArch;
+                    free(platformCoreFpuArch);
+                }
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->platformCoreFpuArch);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SIPVOIP)) {
+            bool sipVoip = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("sipVoip : " << sipVoip);
+                deviceCapabilitiesInfo->sipVoip = sipVoip;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_DUID)) {
+            char* duid = NULL;
+            if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) {
+                if (duid) {
+                    LogDebug("duid : " << duid);
+                    deviceCapabilitiesInfo->duid = duid;
+                    free(duid);
+                }
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->duid);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) {
+            bool speechRecognition = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("speechRecognition : " << speechRecognition);
+                deviceCapabilitiesInfo->speechRecognition = speechRecognition;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->speechRecognition);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_SYNTHESIS)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->speechSynthesis);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER)) {
+            bool isAccelerometer = false;
+            if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) {
+                LogDebug("accelerometer : " << isAccelerometer);
+                deviceCapabilitiesInfo->accelerometer = isAccelerometer;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometer);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometerWakeup);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER)) {
+            bool isBarometer = false;
+            if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) {
+                LogDebug("barometer : " << isBarometer);
+                deviceCapabilitiesInfo->barometer = isBarometer;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->barometer);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->barometerWakeup);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE)) {
+            bool isGyroscope = false;
+            if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) {
+                LogDebug("gyroscope : " << isGyroscope);
+                deviceCapabilitiesInfo->gyroscope = isGyroscope;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscope);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscopeWakeup);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER)) {
+            bool isMagnetometer = false;
+            if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) {
+                LogDebug("magnetometer : " << isMagnetometer);
+                deviceCapabilitiesInfo->magnetometer = isMagnetometer;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometer);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometerWakeup);
@@ -343,6 +582,11 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PHOTOMETER_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->photometerWakeup);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY)) {
+            bool isProximity = false;
+            if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) {
+                LogDebug("proximity : " << isProximity);
+                deviceCapabilitiesInfo->proximity = isProximity;
+            }
             return convert.toJSValueRef(deviceCapabilitiesInfo->proximity);
         } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY_WAKEUP)) {
             return convert.toJSValueRef(deviceCapabilitiesInfo->proximityWakeup);
index 152e1b1..7092ab9 100755 (executable)
@@ -20,6 +20,7 @@
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
+#include <sim.h>
 #include "JSSIMInfo.h"
 #include "plugin_config.h"
 
@@ -114,6 +115,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt
 {
     LogDebug("Enter");
     JSSIMPriv *priv = static_cast<JSSIMPriv*>(JSObjectGetPrivate(object));
+    int ret = SIM_ERROR_NONE;
     if (NULL == priv) {
         LogError("Private object not set.");
         return JSValueMakeUndefined(context);
@@ -127,31 +129,99 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt
         if (JSStringIsEqualToUTF8CString(propertyName, SIM_OPERATORNAME_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
             TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* fullName = NULL;
+            char* shortName = NULL;
+            ret = sim_get_cphs_operator_name(&fullName, &shortName);
+            if (ret == SIM_ERROR_NONE) {
+                if (fullName) {
+                    SIMInfo->operatorName = fullName;
+                    LogDebug("operatorName : " << SIMInfo->operatorName);
+                    free(fullName);
+                } else if (shortName) {
+                    SIMInfo->operatorName = shortName;
+                    LogDebug("operatorName : " << SIMInfo->operatorName);
+                    free(shortName);
+                }
+            }
             return convert.toJSValueRef(SIMInfo->operatorName);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MSISDN_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_PARTNER_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* msisdn = NULL;
+            ret = sim_get_subscriber_number(&msisdn);
+            if (ret == SIM_ERROR_NONE) {
+                if (msisdn) {
+                    SIMInfo->msisdn = msisdn;
+                    LogDebug("msisdn : " << SIMInfo->msisdn);
+                    free(msisdn);
+                }
+            }
             return convert.toJSValueRef(SIMInfo->msisdn);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_ICCID_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* iccId = NULL;
+            ret = sim_get_icc_id(&iccId);
+            if (ret == SIM_ERROR_NONE) {
+                if (iccId) {
+                    SIMInfo->iccid = iccId;
+                    LogDebug("iccid : " << SIMInfo->iccid);
+                    free(iccId);
+                }
+            }
             return convert.toJSValueRef(SIMInfo->iccid);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MCC_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* mcc = NULL;
+            ret = sim_get_mcc(&mcc);
+            if (ret == SIM_ERROR_NONE) {
+                if (mcc) {
+                    SIMInfo->mcc = atoi(mcc);
+                    LogDebug("mcc : " << SIMInfo->mcc);
+                    free(mcc);
+                }
+            }
             return convert.toJSValueRef(SIMInfo->mcc);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MNC_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
-            return convert.toJSValueRef(SIMInfo->mnc);            
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* mnc = NULL;
+            ret = sim_get_mnc(&mnc);
+            if (ret == SIM_ERROR_NONE) {
+                if (mnc) {
+                    SIMInfo->mnc = atoi(mnc);
+                    LogDebug("mnc : " << SIMInfo->mnc);
+                    free(mnc);
+                }
+            }
+            return convert.toJSValueRef(SIMInfo->mnc);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_MSIN_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_PARTNER_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
-            return convert.toJSValueRef(SIMInfo->msin);            
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* msin = NULL;
+            ret = sim_get_msin(&msin);
+            if (ret == SIM_ERROR_NONE) {
+                if (msin) {
+                    SIMInfo->msin = msin;
+                    LogDebug("msin : " << SIMInfo->msin);
+                    free(msin);
+                }
+            }
+            return convert.toJSValueRef(SIMInfo->msin);
         } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_SPN_PROPERTY)) {
             AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE);
-            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);        
-            return convert.toJSValueRef(SIMInfo->spn);            
+            TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+            char* spn = NULL;
+            ret = sim_get_spn(&spn);
+            if (ret == SIM_ERROR_NONE) {
+                if (spn) {
+                    SIMInfo->spn = spn;
+                    LogDebug("spn : " << SIMInfo->spn);
+                    free(spn);
+                }
+            }
+            return convert.toJSValueRef(SIMInfo->spn);
         }            
     }
     Catch(Exception)
old mode 100755 (executable)
new mode 100644 (file)
index f740c9a..12bf614 100755 (executable)
 // limitations under the License.
 //
 
-#include <fstream>
 #include <stddef.h>
 #include <cassert>
-#include <pcrecpp.h>
 #include <dpl/log/log.h>
 #include <math.h>
 #include <Commons/Exception.h>
@@ -50,6 +48,13 @@ void PeripheralValueCallback(keynode_t *node, void *event_ptr)
     }
 }
 
+void CellularNetworkValueCallback(keynode_t *node, void *event_ptr)
+{
+    if(event_ptr) {
+        ((Systeminfo*)event_ptr)->getWatchValue(WATCH_TYPE_CELLULARNETWORK);
+    }
+}
+
 void DisplayValueCallback(keynode_t *node, void* event_ptr)
 {
     if(event_ptr) {
@@ -202,240 +207,6 @@ DeviceCapabilitiesPropertiesPtr Systeminfo::getCapabilities()
 {
     LogDebug("enter");
     DeviceCapabilitiesPropertiesPtr deviceCapabilities(new DeviceCapabilitiesProperties());
-    bool bluetooth = false, nfc = false, wifi = false, wifiDirect = false, fmRadio = false, cameraFront = false,
-        cameraFrontFlash = false, cameraBack = false, cameraBackFlash = false, isAccelerometer = false, isGyroscope = false,
-        isMagnetometer = false, isProximity = false, location = false, locationGps = false, locationWps = false, 
-        microphone = false, usbHost = false, usbAccessory = false, screenOutputRca = false, screenOutputHdmi = false,
-        sipVoip = false, speechRecognition = false, isBarometer = false;
-    int multiTouchCount = 0;
-    char* inputKeyboard = NULL;
-    char* platformVersion = NULL;
-    char* platformName = NULL;
-    char* platformCoreCpuArch = NULL;
-    char* platformCoreFpuArch = NULL;
-    char* duid = NULL;
-    char* openglesVersion = NULL;
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("bluetooth : " << bluetooth);
-        deviceCapabilities->bluetooth = bluetooth;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("nfc : " << nfc);
-        deviceCapabilities->nfc = nfc;
-    }
-    if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("multiTouchCount : " << multiTouchCount);
-        deviceCapabilities->multiTouchCount = multiTouchCount;
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) {
-        if (inputKeyboard != NULL) {
-            LogDebug("inputKeyboard : " << inputKeyboard);
-            deviceCapabilities->inputKeyboard = inputKeyboard;
-            free(inputKeyboard);
-        }
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("wifi : " << wifi);
-        deviceCapabilities->wifi = wifi;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("wifiDirect : " << wifiDirect);
-        deviceCapabilities->wifiDirect = wifiDirect;
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) {
-        if (openglesVersion!= NULL) {
-            LogDebug("openglesVersion : " << openglesVersion);
-            if (strcmp(openglesVersion, "1.0") == 0) {
-                deviceCapabilities->openglesVersion1_1 = true;
-                deviceCapabilities->openglesVersion2_0 = false;
-            } else if (strcmp(openglesVersion, "2.0") == 0) {
-                deviceCapabilities->openglesVersion1_1 = false;
-                deviceCapabilities->openglesVersion2_0 = true;
-            } else if (strcmp(openglesVersion, "1.0/2.0") == 0) {
-                deviceCapabilities->openglesVersion1_1 = true;
-                deviceCapabilities->openglesVersion2_0 = true;
-            }
-            free(openglesVersion);
-        }
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("fmRadio : " << fmRadio);
-        deviceCapabilities->fmRadio = fmRadio;
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) {
-        if (platformVersion) {
-            LogDebug("platformVersion : " << platformVersion);
-            deviceCapabilities->platformVersion = platformVersion;
-            free(platformVersion);
-        }
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) {
-        if (platformName) {
-            LogDebug("platformName : " << platformName);
-            deviceCapabilities->platformName = platformName;
-            free(platformName);
-        }
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("cameraFront : " << cameraFront);
-        deviceCapabilities->cameraFront = cameraFront;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("cameraFrontFlash : " << cameraFrontFlash);
-        deviceCapabilities->cameraFrontFlash = cameraFrontFlash;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("cameraBack : " << cameraBack);
-        deviceCapabilities->cameraBack = cameraBack;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("cameraBackFlash : " << cameraBackFlash);
-        deviceCapabilities->cameraBackFlash = cameraBackFlash;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_CPS_SUPPORTED, &location) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("location : " << location);
-        deviceCapabilities->location = location;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("locationGps : " << locationGps);
-        deviceCapabilities->locationGps = locationGps;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("locationWps : " << locationWps);
-        deviceCapabilities->locationWps = locationWps;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, &microphone) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("microphone : " << microphone);
-        deviceCapabilities->microphone = microphone;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("usbHost : " << usbHost);
-        deviceCapabilities->usbHost = usbHost;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("usbAccessory : " << usbAccessory);
-        deviceCapabilities->usbAccessory = usbAccessory;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("screenOutputRca : " << screenOutputRca);
-        deviceCapabilities->screenOutputRca = screenOutputRca;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("screenOutputHdmi : " << screenOutputHdmi);
-        deviceCapabilities->screenOutputHdmi = screenOutputHdmi;
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) {
-        if (platformCoreCpuArch) {
-            LogDebug("platformCoreCpuArch : " << platformCoreCpuArch);
-            deviceCapabilities->platformCoreCpuArch = platformCoreCpuArch;
-            free(platformCoreCpuArch);
-        }
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) {
-        if (platformCoreFpuArch) {
-            LogDebug("platformCoreFpuArch : " << platformCoreFpuArch);
-            deviceCapabilities->platformCoreFpuArch = platformCoreFpuArch;
-            free(platformCoreFpuArch);
-        }
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("sipVoip : " << sipVoip);
-        deviceCapabilities->sipVoip = sipVoip;
-    }
-
-    if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) {
-        if (duid) {
-            LogDebug("duid : " << duid);
-            deviceCapabilities->duid = duid;
-            free(duid);
-        }
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("speechRecognition : " << speechRecognition);
-        deviceCapabilities->speechRecognition = speechRecognition;
-    }
-
-    if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) {
-        LogDebug("barometer : " << isBarometer);
-        deviceCapabilities->barometer = isBarometer;
-    }
-
-    if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) {
-        LogDebug("accelerometer : " << isAccelerometer);
-        deviceCapabilities->accelerometer = isAccelerometer;
-    }
-
-    if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) {
-        LogDebug("magnetometer : " << isMagnetometer);
-        deviceCapabilities->magnetometer = isMagnetometer;
-    }
-
-    if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) {
-        LogDebug("gyroscope : " << isGyroscope);
-        deviceCapabilities->gyroscope = isGyroscope;
-    }
-
-    if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) {
-        LogDebug("proximity : " << isProximity);
-        deviceCapabilities->proximity = isProximity;
-    }
-
-    std::ifstream file("/usr/etc/system-info.ini");
-    std::string line;
-    std::string webApiVersionMajor = "";
-    std::string webApiVersionMinor = "";
-    std::string nativeApiVersionMajor = "";
-    std::string nativeApiVersionMinor = "";
-
-    if(!file) {
-        LogDebug("api/native version info file not found");
-    } else {
-        while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
-            if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) {
-                deviceCapabilities->nativeApiVersion = nativeApiVersionMajor;
-                deviceCapabilities->nativeApiVersion += ".";
-                deviceCapabilities->nativeApiVersion += nativeApiVersionMinor;
-                LogDebug("native api version : " << deviceCapabilities->nativeApiVersion);
-                break;
-            }
-        }
-        while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) {
-            if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) {
-                deviceCapabilities->webApiVersion = webApiVersionMajor;
-                deviceCapabilities->webApiVersion += ".";
-                deviceCapabilities->webApiVersion += webApiVersionMinor;
-                LogDebug("web api version : " << deviceCapabilities->webApiVersion);
-                break;
-            }
-        }
-        file.close();    
-    }  
-
     return deviceCapabilities;
 }
 
@@ -493,6 +264,7 @@ void Systeminfo::clearWatch(const long id)
                 break;
             case WATCH_TYPE_CELLULARNETWORK:
                 if ((m_EventMgrPtr->getEventCellularNetworkList()).size() == 1) {
+                    vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, CellularNetworkValueCallback);
                     if (m_networkRegist == REGIST_CELLULAR) {
                         connection_unset_ip_address_changed_cb(m_connectionHandle);
                         m_networkRegist = REGIST_NOT;
@@ -630,6 +402,13 @@ void Systeminfo::getWatchValue(const int watchType)
         for (EventPeripheralList::iterator it = eventList.begin(); it != eventList.end(); it++) {
             (*it)->getWatchValue();
         }
+    } else if (watchType == WATCH_TYPE_CELLULARNETWORK) {
+        EventWifiNetworkList eventListCellular = m_EventMgrPtr->getEventCellularNetworkList();
+        if (eventListCellular.size() > 0) {
+            for (EventCellularNetworkList::iterator it = eventListCellular.begin(); it != eventListCellular.end(); it++) {
+                (*it)->getWatchValue();
+            }
+        }
     }
 }
 
@@ -712,6 +491,7 @@ void Systeminfo::OnRequestReceived(const EventWatchSysteminfoPtr& event)
             break;
         case WATCH_TYPE_CELLULARNETWORK:
             if ((m_EventMgrPtr->getEventCellularNetworkList()).size() == 1) {
+                vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, CellularNetworkValueCallback, (void *)this);
                 if (m_networkRegist == REGIST_NOT) {
                     connection_set_ip_address_changed_cb(m_connectionHandle, NetworkValueCallback, (void *)this);
                     m_networkRegist = REGIST_CELLULAR;
@@ -1443,51 +1223,44 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
     connection_type_e connectionType;
     connection_profile_h profileHandle = NULL;
     connection_address_family_e addressFamily = CONNECTION_ADDRESS_FAMILY_IPV4;
-    network_info_service_state_e serviceState;
     char* ipAddr = NULL;
     char* apn = NULL;
     char* imei = NULL;
-    char* mcc = NULL;
-    char* mnc = NULL;
-    bool isRoaming = false;
-    int cellId = 0, lac = 0, isFlightMode = 0;
+    int plmn = 0, cellId = 0, lac = 0, isRoaming = 0, isFlightMode = 0;
 
-       TIME_TRACER_ITEM_BEGIN("(cellular)lac", 0);
-    if (network_info_get_lac(&lac) == NETWORK_INFO_ERROR_NONE) {
-        cellularNetwork->lac = lac;        
+    TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0);
+    if (vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn) == 0) {
+        cellularNetwork->mcc = plmn / 100;
+        cellularNetwork->mnc = plmn % 100;
     }
-       TIME_TRACER_ITEM_END("(cellular)lac", 0);
+    TIME_TRACER_ITEM_END("(cellular)mcc", 0);
 
-       TIME_TRACER_ITEM_BEGIN("(cellular)cellId", 0);
-       if (network_info_get_cell_id(&cellId) == NETWORK_INFO_ERROR_NONE) {
+    TIME_TRACER_ITEM_BEGIN("(cellular)cellId", 0);
+    if (vconf_get_int(VCONFKEY_TELEPHONY_CELLID, &cellId) == 0) {
         cellularNetwork->cellId = cellId;
     }
-       TIME_TRACER_ITEM_END("(cellular)cellId", 0);
+    TIME_TRACER_ITEM_END("(cellular)cellId", 0);
 
-       TIME_TRACER_ITEM_BEGIN("(cellular)isRoaming", 0);
-    if (network_info_is_roaming(&isRoaming) == NETWORK_INFO_ERROR_NONE) {
-        cellularNetwork->isRoaming = isRoaming;
+    TIME_TRACER_ITEM_BEGIN("(cellular)lac", 0);
+    if (vconf_get_int(VCONFKEY_TELEPHONY_LAC, &lac) == 0) {
+        cellularNetwork->lac = lac;
     }
-       TIME_TRACER_ITEM_END("(cellular)isRoaming", 0);
+    TIME_TRACER_ITEM_END("(cellular)lac", 0);
 
-       TIME_TRACER_ITEM_BEGIN("(cellular)mcc", 0);
-    if (network_info_get_mcc(&mcc) == NETWORK_INFO_ERROR_NONE) {
-        cellularNetwork->mcc = converter.toInt(mcc);
-        free(mcc);
-    }
-       TIME_TRACER_ITEM_END("(cellular)mcc", 0);
-
-       TIME_TRACER_ITEM_BEGIN("(cellular)mnc", 0);
-    if (network_info_get_mnc(&mnc) == NETWORK_INFO_ERROR_NONE) {
-        cellularNetwork->mnc = converter.toInt(mnc);
-        free(mnc);
+    TIME_TRACER_ITEM_BEGIN("(cellular)isRoaming", 0);
+    if (vconf_get_int(VCONFKEY_TELEPHONY_SVC_ROAM, &isRoaming) == 0) {
+        if (isRoaming) {
+            cellularNetwork->isRoaming = true;
+        } else {
+            cellularNetwork->isRoaming = false;
+        }
     }
-       TIME_TRACER_ITEM_END("(cellular)mnc", 0);
+    TIME_TRACER_ITEM_END("(cellular)isRoaming", 0);
 
        TIME_TRACER_ITEM_BEGIN("(cellular)isFlightMode", 0);
-    if (network_info_get_service_state(&serviceState) == NETWORK_INFO_ERROR_NONE) {
-        if (serviceState == NETWORK_INFO_SERVICE_STATE_RADIO_OFF) {
-           cellularNetwork->isFlightMode = true;
+    if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &isFlightMode) == 0) {
+        if (isFlightMode) {
+            cellularNetwork->isFlightMode = true;
         } else {
             cellularNetwork->isFlightMode = false;
         }
@@ -1545,98 +1318,6 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
 PROPERTY_GET_SYSTEMINFO_DEFINITION(SIM) {
     Converter converter(context);
     SIMPropertiesPtr SIM(new SIMProperties());
-
-    char* fullName = NULL;
-    char* shortName = NULL;
-    char* msisdn = NULL;
-    char* iccId = NULL;
-    char* mcc = NULL;
-    char* mnc = NULL;
-    char* msin = NULL;
-    char* spn = NULL;
-    int ret = SIM_ERROR_NONE;
-
-       TIME_TRACER_ITEM_BEGIN("(sim)operatorName", 0);
-    ret = sim_get_cphs_operator_name(&fullName, &shortName);
-       TIME_TRACER_ITEM_END("(sim)operatorName", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (fullName) {
-            SIM->operatorName = fullName;
-            LogDebug("operatorName : " << SIM->operatorName);
-            free(fullName);
-        } else if (shortName) {
-            SIM->operatorName = shortName;
-            LogDebug("operatorName : " << SIM->operatorName);
-            free(shortName);
-        }
-    }
-
-       TIME_TRACER_ITEM_BEGIN("(sim)msisdn", 0);
-    ret = sim_get_subscriber_number(&msisdn);
-       TIME_TRACER_ITEM_END("(sim)msisdn", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (msisdn) {
-            SIM->msisdn = msisdn;
-            LogDebug("msisdn : " << SIM->msisdn);
-            free(msisdn);
-        }
-    }
-
-       TIME_TRACER_ITEM_BEGIN("(sim)iccId", 0);
-    ret = sim_get_icc_id(&iccId);
-       TIME_TRACER_ITEM_END("(sim)iccId", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (iccId) {
-            SIM->iccid = iccId;
-            LogDebug("iccid : " << SIM->iccid);
-            free(iccId);
-        }
-    }
-
-       TIME_TRACER_ITEM_BEGIN("(sim)mcc", 0);
-    ret = sim_get_mcc(&mcc);
-       TIME_TRACER_ITEM_END("(sim)mcc", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (mcc) {
-            SIM->mcc = atoi(mcc);
-            LogDebug("mcc : " << SIM->mcc);
-            free(mcc);
-        }
-    }
-
-       TIME_TRACER_ITEM_BEGIN("(sim)mnc", 0);
-    ret = sim_get_mnc(&mnc);
-       TIME_TRACER_ITEM_END("(sim)mnc", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (mnc) {
-            SIM->mnc = atoi(mnc);
-            LogDebug("mnc : " << SIM->mnc);
-            free(mnc);
-        }
-    }
-
-       TIME_TRACER_ITEM_BEGIN("(sim)msin", 0);
-    ret = sim_get_msin(&msin);
-       TIME_TRACER_ITEM_END("(sim)msin", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (msin) {
-            SIM->msin = msin;
-            LogDebug("msin : " << SIM->msin);
-            free(msin);
-        }
-    }
-
-       TIME_TRACER_ITEM_END("(sim)spn", 0);
-    ret = sim_get_spn(&spn);
-       TIME_TRACER_ITEM_END("(sim)spn", 0);
-    if (ret == SIM_ERROR_NONE) {
-        if (spn) {
-            SIM->spn = spn;
-            LogDebug("spn : " << SIM->spn);
-            free(spn);
-        }
-    }
-
     return JSSIMInfo::createJSObject(context, SIM);
 }
 
index 18dc061..01d0b89 100755 (executable)
@@ -26,8 +26,6 @@
 #include <sensor.h>
 #include <sensors.h>
 #include <net_connection.h>
-#include <sim.h>
-#include <telephony_network.h>
 #include <system_info.h>
 #include <runtime_info.h>
 #include <JavaScriptCore/JavaScript.h>
index ab3e4ab..228ccca 100755 (executable)
@@ -24,6 +24,9 @@
 #include "SysteminfoListenerManager.h"
 #include "JSSysteminfo.h"
 
+namespace DeviceAPI {
+namespace Systeminfo {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -80,3 +83,6 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, "systeminfo", (js_class_template_getter)DeviceAPI::Systeminfo::JSSysteminfo::getClassRef, NULL)
 PLUGIN_CLASS_MAP_END
 
+} // Systeminfo
+} // DeviceAPI
+
index bc25bdc..459c2ec 100755 (executable)
@@ -23,6 +23,9 @@
 #include "JSTZDate.h"
 #include "JSTimeDuration.h"
 
+namespace DeviceAPI {
+namespace Time {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -70,3 +73,6 @@ PLUGIN_CLASS_MAP_BEGIN
                (js_class_template_getter)DeviceAPI::Time::JSTimeDuration::getClassRef,
                NULL)
 PLUGIN_CLASS_MAP_END
+
+} // Time
+} // DeviceAPI
index edb7a4b..959dbb0 100644 (file)
@@ -59,6 +59,9 @@ class_definition_options_t TizenInterfaceOptions = {
 
 }
 
+namespace DeviceAPI {
+namespace Tizen {
+
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
@@ -124,3 +127,6 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_END
 
 #undef OBJECT_TIZEN
+
+} // Tizen
+} // DeviceAPI