Update change log and spec for wrt-plugins-tizen_0.4.9
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 20 Mar 2013 11:18:42 +0000 (20:18 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 20 Mar 2013 11:36:26 +0000 (20:36 +0900)
[Issue#] N/A
[Problem] Platform api changed, thus build break happens.
[Cause] Platform sync-agent api changes.
[Solution] Adapt to the changes anf fix bugs.

[Issue#] N/A
[Problem] [Common] Refactoring CMakeLists.txt files
[Cause] N/A
[Solution]  * Did refactoring package dependancies between modules and impls
 * Removed dependancies to unused modules
 * Fixed bugs on cmake scripts
   * PKG_SEARCH_MODULE -> PKG_CHECK_MODULES
 * Realigned CMakeLists.txt

[Issue#] crashed application when content change listener is registered.
[Problem] memory overwrite
[Cause] unavailable variable used
[Solution] remove the unavailable varibable

[Issue#] N/A
[Problem] Several functions in Converter class don't work properly.
[Solution] Switched functions of Converter class to static functions of JSUtil.
[SCMRequest] N/A

[Issue#] N/A
[Problem] [Common] StandaloneConsole fix prevent issue
[Cause] N/A
[Solution] N/A

[Issue#] N/A
[Problem] [Contact] update precondition contact application due to changing platform policy
[Cause] N/A
[Solution] N/A

[Issue#] #DCM-951
[Problem] Information obtained is different on help information if API [tizen.time.getTimeFormat] is call called.
[Cause] If region is Japanese, apK:m:s is returned. 'K' is not defined in API reference.
[Solution] 'K' will be changed to 'h'

[Issue#] N/A
[Problem] Cannot find a parent calendar event of a recurring instances when using start/end date range filter.
[Cause] Platform filter does not support such an operation.
[Solution] Use multiple filters for a recurring event search and merge the results.

[Issue#] #DCM-976
[Problem] UTC time is unacquirable using Web Device API [tizen.time.toUTC]
[Cause] When calling toUTC() or toLocaltimezone() twice or more, timezone is changed but another value isn't changed. It is ICU issue.
[Solution] Changed the code to make new TZDate with getTime() value and timezone.

[Issue#] N/A
[Problem] Not enough TCs for smack rule extraction.
[Cause] Skipped some functions.
[Solution] Cover all functions for each privilege.

[Issue#] TDIS-4674
[Problem] logoURI is missing
[Cause] internal bug
[Solution] modify code

[Issue#] N/A
[Problem] Notification UnitTC Coverage is poor
[Cause] N/A
[Solution] enhance coverage & appended TC

[SCMRequest] N/A

Conflicts:

packaging/wrt-plugins-tizen.spec

99 files changed:
packaging/wrt-plugins-tizen.spec
packaging/wrt-plugins-tizen.spec.orig [new file with mode: 0755]
src/Alarm/CMakeLists.txt
src/Application/CMakeLists.txt
src/Bluetooth/BluetoothCBManager.cpp
src/Bluetooth/BluetoothConverter.cpp
src/Bluetooth/BluetoothServiceHandlerManager.cpp
src/Bluetooth/BluetoothServiceHandlerManager.h
src/Bluetooth/CMakeLists.txt
src/Bluetooth/IBluetoothServiceHandlerManager.h
src/Bluetooth/JSBluetoothClass.cpp
src/Bluetooth/JSBluetoothServiceHandler.cpp
src/Bluetooth/JSBluetoothServiceHandler.h
src/Bluetooth/JSBluetoothSocket.cpp
src/Bluetooth/JSBluetoothSocket.h
src/Bookmark/BookmarkManager.cpp
src/Bookmark/CMakeLists.txt
src/Bookmark/JSBookmarkManager.cpp
src/CMakeLists.txt
src/Calendar/CMakeLists.txt
src/Calendar/Calendar.cpp
src/Calendar/CalendarFilter.cpp
src/Calendar/CalendarFilter.h
src/Callhistory/CMakeLists.txt
src/Callhistory/CallHistory.cpp
src/Callhistory/CallHistory.h
src/Callhistory/ICallHistory.h
src/Callhistory/JSCallHistory.cpp
src/Common/CMakeLists.txt [changed mode: 0755->0644]
src/Common/StandaloneConsole/StandaloneConsole.cpp
src/Contact/CMakeLists.txt
src/Contact/Contact.cpp
src/Contact/Contact.h
src/Contact/ContactAddress.cpp
src/Contact/ContactAddress.h
src/Contact/ContactConverter.cpp
src/Contact/ContactEmailAddress.cpp
src/Contact/ContactEmailAddress.h
src/Contact/ContactName.cpp
src/Contact/ContactName.h
src/Contact/ContactObjectA2PConverter.cpp
src/Contact/ContactPhoneNumber.cpp
src/Contact/ContactPhoneNumber.h
src/Contact/JSAddressBook.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactAddress.cpp
src/Contact/JSContactEmailAddress.cpp
src/Contact/JSContactName.cpp
src/Contact/JSContactOrganization.cpp
src/Contact/JSContactPhoneNumber.cpp
src/Content/CMakeLists.txt
src/Content/ContentFilterValidator.cpp
src/Content/ContentListener.cpp
src/Content/ContentManager.cpp
src/Content/ContentMedia.h
src/Content/ContentSearchVisitor.cpp
src/Content/IContentManager.cpp
src/Content/JSContent.cpp
src/Content/JSContent.h
src/DataControl/CMakeLists.txt
src/DataSync/DataSyncConverter.cpp
src/DataSync/DataSyncConverter.h
src/DataSync/DataSyncManager.cpp
src/DataSync/JSDataSyncManager.cpp
src/Download/CMakeLists.txt
src/Filesystem/CMakeLists.txt
src/Log/CMakeLists.txt
src/MessagePort/CMakeLists.txt
src/MessagePort/config.xml
src/Messaging/CMakeLists.txt
src/NFC/CMakeLists.txt
src/NetworkBearerSelection/CMakeLists.txt
src/Notification/CMakeLists.txt
src/Notification/INotification.h
src/Notification/JSNotificationLineArray.cpp
src/Notification/JSNotificationManager.cpp
src/Notification/JSStatusNotification.cpp
src/Notification/JSStatusNotification.h
src/Notification/JSStringArray.cpp
src/Notification/NotificationConverter.cpp
src/Notification/NotificationConverter.h
src/Notification/NotificationManager.cpp
src/Notification/StatusNotification.cpp
src/Notification/plugin_initializer.cpp
src/Package/CMakeLists.txt
src/Power/CMakeLists.txt
src/Push/CMakeLists.txt
src/Push/PushManager.cpp
src/Push/PushManager.h
src/SecureElement/CMakeLists.txt
src/SystemSetting/CMakeLists.txt [changed mode: 0755->0644]
src/Systeminfo/CMakeLists.txt
src/TimeUtil/CMakeLists.txt
src/TimeUtil/JSTZDate.cpp
src/TimeUtil/TZDate.cpp
src/TimeUtil/TZDate.h
src/TimeUtil/TimeUtil.cpp
src/TimeUtil/TimeUtilConverter.cpp
src/Tizen/CMakeLists.txt

index e53aeff..b97810a 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.8
+Version:    0.4.9
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
diff --git a/packaging/wrt-plugins-tizen.spec.orig b/packaging/wrt-plugins-tizen.spec.orig
new file mode 100755 (executable)
index 0000000..1781190
--- /dev/null
@@ -0,0 +1,115 @@
+Name:       wrt-plugins-tizen
+Summary:    JavaScript plugins for WebRuntime
+<<<<<<< HEAD
+Version:    0.4.8
+=======
+Version:    0.4.9
+>>>>>>> f5f8121... Update change log and spec for wrt-plugins-tizen_0.4.9
+Release:    0
+Group:      Development/Libraries
+License:    Apache License, Version 2.0
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(capi-web-favorites)
+BuildRequires:  pkgconfig(mm-fileinfo)
+BuildRequires:  pkgconfig(libpcrecpp)
+BuildRequires:  pkgconfig(calendar-service2)
+BuildRequires:  pkgconfig(contacts-service2)
+BuildRequires:  pkgconfig(msg-service)
+BuildRequires:  pkgconfig(email-service)
+BuildRequires:  pkgconfig(accounts-svc)
+BuildRequires:  pkgconfig(tapi)
+BuildRequires:  pkgconfig(icu-i18n)
+BuildRequires:  pkgconfig(icu-io)
+BuildRequires:  pkgconfig(icu-le)
+BuildRequires:  pkgconfig(icu-lx)
+BuildRequires:  pkgconfig(icu-uc)
+BuildRequires:  pkgconfig(network)
+BuildRequires:  pkgconfig(appsvc)
+BuildRequires:  pkgconfig(devman)
+BuildRequires:  pkgconfig(ewebkit2)
+BuildRequires:  pkgconfig(dpl-efl)
+BuildRequires:  pkgconfig(dpl-event-efl)
+BuildRequires:  pkgconfig(wrt-plugins-types)
+BuildRequires:  pkgconfig(wrt-plugins-commons)
+BuildRequires:  pkgconfig(wrt-plugins-commons-javascript)
+BuildRequires:  pkgconfig(wrt-plugins-plugin-manager)
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-appfw-app-manager)
+BuildRequires:  pkgconfig(capi-network-nfc)
+BuildRequires:  pkgconfig(capi-location-geocoder)
+BuildRequires:  pkgconfig(capi-location-manager)
+BuildRequires:  pkgconfig(capi-location-poi)
+BuildRequires:  pkgconfig(capi-location-route)
+BuildRequires:  pkgconfig(capi-network-bluetooth)
+BuildRequires:  pkgconfig(capi-network-connection)
+BuildRequires:  pkgconfig(capi-telephony-call)
+BuildRequires:  pkgconfig(capi-telephony-sim)
+BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(capi-system-runtime-info)
+BuildRequires:  pkgconfig(sensor)
+BuildRequires:  pkgconfig(capi-system-sensor)
+BuildRequires:  pkgconfig(capi-system-power)
+BuildRequires:  pkgconfig(pmapi)
+BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(capi-system-device)
+BuildRequires:  pkgconfig(capi-content-media-content)
+BuildRequires:  pkgconfig(capi-media-metadata-extractor)
+BuildRequires:  pkgconfig(smartcard-service-common)
+BuildRequires:  pkgconfig(smartcard-service)
+BuildRequires:  pkgconfig(pkgmgr)
+BuildRequires:  pkgconfig(pkgmgr-info)
+BuildRequires:  pkgconfig(capi-appfw-package-manager)
+BuildRequires:  pkgconfig(capi-web-url-download)
+BuildRequires:  pkgconfig(push)
+BuildRequires:  pkgconfig(notification)
+BuildRequires:  pkgconfig(message-port)
+BuildRequires:  pkgconfig(sync-agent)
+BuildRequires:  expat-devel
+BuildRequires:  cmake
+BuildRequires:  gettext-devel
+BuildRequires:  boost-devel
+BuildRequires:  boost-thread
+BuildRequires:  boost-system
+BuildRequires:  boost-filesystem
+
+%description
+JavaScript plugins for WebRuntime
+
+%package devel
+Summary:    Wrt-plugin-tizen development headers
+Group:      Development/Libraries
+Requires:   %{name} = %{version}
+
+%description devel
+Wrt-plugin-tizen development headers
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/wrt-plugins"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DDPL_LOG="ON"
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post
+
+%postun
+
+
+%files
+%manifest wrt-plugins-tizen.manifest 
+%{_libdir}/wrt-plugins/*
+/usr/etc/tizen-apis/*
+
+%files devel
+%{_includedir}/*
+%{_libdir}/pkgconfig/*
index 3465d8f..0e933f6 100755 (executable)
@@ -2,10 +2,10 @@ SET(TARGET_NAME ${alarm_target})
 SET(DESTINATION_NAME ${alarm_dest})
 SET(TARGET_IMPL_NAME ${alarm_impl})
 
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_alarm REQUIRED capi-appfw-application)
 
 INCLUDE_DIRECTORIES(
-       ${application_INCLUDE_DIRS}
+       ${platform_pkgs_alarm_INCLUDE_DIRS}
        ${TOP}/Common
        ${TOP}/Application
        ${TOP}/TimeUtil
@@ -15,7 +15,6 @@ SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${tizen_dest}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${application_dest}
-       ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${timze_dest}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
 )
 
@@ -32,7 +31,9 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${application_LIBRARIES}
+       ${platform_pkgs_alarm_LIBRARIES}
+       ${application_impl}
+       ${tizen_impl}
 )
 
 SET(SRCS
@@ -44,15 +45,12 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${application_impl}
-       ${application_config}
-       ${tizen_impl}
-       ${timeutil_impl}
- )
+       "-Wl,--no-as-needed" ${application_config}
+)
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/alarm
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/alarm
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index d759551..2c463d8 100755 (executable)
@@ -3,20 +3,18 @@ SET(DESTINATION_NAME ${application_dest})
 SET(TARGET_IMPL_NAME ${application_impl})
 SET(TARGET_CONFIG_NAME ${application_config})
 
-PKG_SEARCH_MODULE(app-manager REQUIRED capi-appfw-app-manager)
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
-PKG_SEARCH_MODULE(package-manager REQUIRED capi-appfw-package-manager)
-PKG_SEARCH_MODULE(pkgmgr REQUIRED pkgmgr)
-PKG_SEARCH_MODULE(pkgmgr-info REQUIRED pkgmgr-info)
+PKG_CHECK_MODULES(platform_pkgs_application REQUIRED
+       capi-appfw-app-manager
+       capi-appfw-application
+       capi-appfw-package-manager
+       pkgmgr
+       pkgmgr-info
+)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/Application
-       ${app-manager_INCLUDE_DIRS}
-       ${application_INCLUDE_DIRS}
-       ${package-manager_INCLUDE_DIRS}
-       ${pkgmgr_INCLUDE_DIRS}
-       ${pkgmgr-info_INCLUDE_DIRS}
+       ${platform_pkgs_application_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -27,7 +25,7 @@ SET(CMAKE_INSTALL_RPATH
 
 SET(SRCS_IMPL
        ApplicationContext.cpp
-       ApplicationControl.cpp  
+       ApplicationControl.cpp
        ApplicationControlData.cpp
        RequestedApplicationControl.cpp
        ApplicationFactory.cpp
@@ -57,11 +55,7 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${app-manager_LIBRARIES}
-       ${application_LIBRARIES}
-       ${package-manager_LIBRARIES}
-       ${pkgmgr_LIBRARIES}
-       ${pkgmgr-info_LIBRARIES}
+       ${platform_pkgs_application_LIBRARIES}
 )
 
 SET(SRCS_CONFIG
@@ -89,6 +83,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/application
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/application
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 82c88dd..42ba5cb 100644 (file)
@@ -466,7 +466,7 @@ void BluetoothCBManager::addConnectionStateCallback(std::string deviceAddress, v
        std::map<std::string, void*>::iterator it = 
                m_devicePrivateObjectMap.find(deviceAddress);
 
-       if (it != m_devicePrivateObjectMap.end())
+       if (type != FROM_SERVICE && it != m_devicePrivateObjectMap.end())
        {
                ThrowMsg(WrtDeviceApis::Commons::AlreadyInUseException, "connecting to same device address");
        }
index b6ab9c0..e1ec3d1 100644 (file)
@@ -143,7 +143,7 @@ BluetoothSocketNotifierPrivateDataPtr
 void BluetoothConverter::setBluetoothSocketNotifierCallback(JSStringRef propertyName, JSValueRef value, 
        JSObjectRef object, BluetoothSocketNotifierPrivateDataPtr& privData)
 {
-       JSValueRef successCallback = toFunction(value);
+       JSValueRef successCallback = toFunctionOrNull(value);
 
        if(JSStringIsEqualToUTF8CString(propertyName, "onclose")) 
        {
index 81b21b4..aef14f7 100644 (file)
@@ -114,6 +114,10 @@ void BluetoothServiceHandlerManager::setServiceHandlerListener(
        m_emitter = emitter;
 }
 
+EventBTServiceOnConnectEmitterPtr BluetoothServiceHandlerManager::getServiceHandlerListener()
+{
+       return m_emitter;
+}
 
 std::string BluetoothServiceHandlerManager::getUUID()
 {
index 1f2048f..9361cbb 100644 (file)
@@ -38,6 +38,7 @@ public:
        virtual ~BluetoothServiceHandlerManager();
        virtual void unRegister(const EventBTUnregisterRFCOMMServicePtr &event);
        virtual void setServiceHandlerListener(const EventBTServiceOnConnectEmitterPtr& emitter);
+       virtual EventBTServiceOnConnectEmitterPtr getServiceHandlerListener();
        virtual void setUUID(std::string uuid);
        virtual std::string getUUID();
        virtual void setRegisterSocket(int socket);
index 335e38f..f6bbacb 100755 (executable)
@@ -2,17 +2,18 @@ SET(TARGET_NAME ${bluetooth_target})
 SET(DESTINATION_NAME ${bluetooth_dest})
 SET(TARGET_IMPL_NAME ${bluetooth_impl})
 
+PKG_CHECK_MODULES(platform_pkgs_bluetooth REQUIRED capi-network-bluetooth)
+
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${platform_pkgs_bluetooth_INCLUDE_DIRS}
+)
+
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
 )
 
-PKG_SEARCH_MODULE(capi-network-bluetooth REQUIRED capi-network-bluetooth)
-
-INCLUDE_DIRECTORIES(${capi-network-bluetooth_INCLUDE_DIRS}
-       ${TOP}/Common
-)
-
 SET(SRCS_PLATFORM_API_BLUETOOTH
        BluetoothFactory.cpp
        EventBTGetKnownDevices.cpp
@@ -26,6 +27,7 @@ SET(SRCS_PLATFORM_API_BLUETOOTH
        IBluetoothServiceHandlerManager.cpp
        IBluetoothSocketManager.cpp
 )
+
 SET(SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH
        BluetoothAdapterManager.cpp
        BluetoothDeviceManager.cpp
@@ -33,36 +35,38 @@ SET(SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH
        BluetoothServiceHandlerManager.cpp
        BluetoothCBManager.cpp
 )
+
 SET(SRCS_IMPL
-       ${SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH}       
+       ${SRCS_PLATFORM_IMPLEMENTATION_BLUETOOTH}
        ${SRCS_PLATFORM_API_BLUETOOTH}
-       BluetoothAdapterListener.cpp  
-       BluetoothSocketListener.cpp   
+       BluetoothAdapterListener.cpp
+       BluetoothSocketListener.cpp
        BluetoothDeviceManagerListener.cpp
-       BluetoothClass.cpp 
+       BluetoothClass.cpp
        BluetoothMultiCallback.cpp
        BluetoothConverter.cpp
-       JSBluetoothAdapter.cpp  
-       JSBluetoothDevice.cpp  
-       JSBluetoothClass.cpp    
-       JSBluetoothClassDeviceMajor.cpp 
-       JSBluetoothClassDeviceMinor.cpp 
+       JSBluetoothAdapter.cpp
+       JSBluetoothDevice.cpp
+       JSBluetoothClass.cpp
+       JSBluetoothClassDeviceMajor.cpp
+       JSBluetoothClassDeviceMinor.cpp
        JSBluetoothClassDeviceService.cpp
        JSBluetoothServiceHandler.cpp
-       JSBluetoothManager.cpp 
+       JSBluetoothManager.cpp
        JSBluetoothSocket.cpp
        JSBluetoothDevice.cpp
 )
-SET(SRCS
-       plugin_config.cpp
-       plugin_initializer.cpp
-)
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${capi-network-bluetooth_LIBRARIES}
+       ${platform_pkgs_bluetooth_LIBRARIES}
+)
+
+SET(SRCS
+       plugin_config.cpp
+       plugin_initializer.cpp
 )
 
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
@@ -74,6 +78,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bluetooth
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bluetooth
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 45accef..a6cfa91 100644 (file)
@@ -34,6 +34,7 @@ public:
        virtual ~IBluetoothServiceHandlerManager();
        virtual void unRegister(const EventBTUnregisterRFCOMMServicePtr &event) = 0;
        virtual void setServiceHandlerListener(const EventBTServiceOnConnectEmitterPtr& emitter) = 0;
+       virtual EventBTServiceOnConnectEmitterPtr getServiceHandlerListener() = 0;
        virtual void setUUID(std::string uuid) = 0;
        virtual std::string getUUID() = 0;
        virtual void setRegisterSocket(int socket) = 0;
index b04b573..5219df3 100644 (file)
@@ -232,7 +232,7 @@ JSValueRef JSBluetoothClass::getProperty(JSContextRef context,
        {
                LogError("Unkwon Exception");
        }       
-       return JSValueMakeNull(context);
+       return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSBluetoothClass::hasService(JSContextRef context, JSObjectRef object,
index a391c55..4e4814c 100644 (file)
@@ -70,7 +70,7 @@ JSClassDefinition JSBluetoothServiceHandler::m_classInfo =
 JSStaticValue JSBluetoothServiceHandler::m_properties[] = 
 {
        {"uuid", getUuid, NULL, kJSPropertyAttributeReadOnly},
-       {"onconnect", NULL, setOnConnect, kJSPropertyAttributeNone},
+       {"onconnect", getOnConnect, setOnConnect, kJSPropertyAttributeNone},
        {"name", getName, NULL, kJSPropertyAttributeReadOnly},                  
        {"isConnected", getIsConnected, NULL, kJSPropertyAttributeReadOnly},                    
        {0, 0, 0, 0}
@@ -132,62 +132,111 @@ bool JSBluetoothServiceHandler::setOnConnect(JSContextRef context,
        try 
        {
                JSBluetoothServiceHandlerPriv *priv = static_cast<JSBluetoothServiceHandlerPriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "private object null");
+               }
+
                BluetoothConverter converter(priv->getContext());
                JSValueRef successCallback = NULL;
                JSValueRef errorCallback = NULL;
 
-               if (priv == NULL)
+               if( JSValueIsNull(context, value) ||
+                       JSObjectIsFunction(context, converter.toJSObjectRef(value)) )
+               {
+                       LogDebug("Callable or null");
+                       successCallback = converter.toFunctionOrNull(value);
+               }
+               else
                {
-                       ThrowMsg(UnknownException, "private object null");
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Non callable object");
                }
 
                JSCallbackManagerPtr cbm = JSCallbackManager::createObject(priv->getContext(), NULL, NULL);
-
                if (cbm == NULL)
                {
-                       ThrowMsg(ConversionException, "callback manager creation fail");
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "callback manager creation fail");
                }
-
-               successCallback = converter.toFunction(value);
                
                cbm->setOnSuccess(successCallback);
                cbm->setOnError(errorCallback);
-               //cbm->setObject(object);
 
                IBluetoothServiceHandlerManagerPtr BluetoothServiceHandlerManager(priv->getObject());
                EventBTServiceOnConnectEmitterPtr emitter(new EventBTServiceOnConnectEmitter);
+               if (BluetoothServiceHandlerManager == NULL || emitter == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException,
+                               "IBluetoothServiceHandlerManagerPtr or EventBTServiceOnConnectEmitterPtr is NULL");
+               }
 
                emitter->setListener(&BluetoothAdapterListener::getInstance());
                emitter->setEventPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(cbm));
                BluetoothServiceHandlerManager->setServiceHandlerListener(emitter);
-                               
+
                return true;
        }
-       catch (const WrtDeviceApis::Commons::Exception& ex) 
+       catch (const WrtDeviceApis::Commons::ConversionException& ex)
        {
                LogError("Exception: " << ex.GetMessage());
+               *exception = JSTizenExceptionFactory::makeErrorObject(context,
+                       JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
+       }       
+       catch (const WrtDeviceApis::Commons::Exception& ex)
+       {
+               LogWarning("Exception: " << ex.GetMessage());
+       }
+
+       return false;
+}
+
+
+JSValueRef JSBluetoothServiceHandler::getOnConnect(JSContextRef context,
+                                       JSObjectRef object,
+                                       JSStringRef propertyName,
+                                       JSValueRef* exception)
+{
+       LogDebug("OK");
 
-               switch (ex.getCode())
+       try
+       {
+               JSBluetoothServiceHandlerPriv *priv = static_cast<JSBluetoothServiceHandlerPriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
                {
-               case WrtDeviceApis::Commons::ExceptionCodes::ConversionException:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
-                       break;
-               case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");
-                       break;
-               case WrtDeviceApis::Commons::ExceptionCodes::Exception:
-               default:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::UNKNOWN_ERROR, "Unkown error");
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
                }
-       }       
-       return false;
 
-}
+               IBluetoothServiceHandlerManagerPtr BluetoothServiceHandlerManager(priv->getObject());
+               if(BluetoothServiceHandlerManager == NULL)
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "IBluetoothServiceHandlerManagerPtr is null");
 
+               EventBTServiceOnConnectEmitterPtr emitter = BluetoothServiceHandlerManager->getServiceHandlerListener();
+               if(emitter == NULL)
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "EventBTServiceOnConnectEmitterPtr is null");
 
+               JSCallbackManagerPtr privData =
+                       DPL::DynamicPointerCast<JSCallbackManager>(emitter->getEventPrivateData());
+
+               if(privData == NULL)
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "JSCallbackManagerPtr is null");
+
+               JSValueRef callback = privData->getOnSuccess();
+               if(callback == NULL)
+               {
+                       LogDebug("callback is NULL");
+               }
+               else
+               {
+                       LogDebug("callback is not NULL");
+                       return callback;
+               }
+       }
+       catch (const WrtDeviceApis::Commons::Exception& ex)
+       {
+               LogWarning("Exception: " << ex.GetMessage());
+       }
+
+       return JSValueMakeNull(context);
+}
        
 
 JSValueRef JSBluetoothServiceHandler::getUuid(JSContextRef context,
@@ -217,7 +266,7 @@ JSValueRef JSBluetoothServiceHandler::getUuid(JSContextRef context,
                LogWarning("Exception: " << ex.GetMessage());
        }       
        
-       return NULL;
+       return JSValueMakeUndefined(context);
 }
 
 
@@ -248,7 +297,7 @@ JSValueRef JSBluetoothServiceHandler::getName(JSContextRef context,
                LogWarning("Exception"<<ex.GetMessage());
        }       
        
-       return NULL;
+       return JSValueMakeUndefined(context);
 }
 
 JSValueRef JSBluetoothServiceHandler::getIsConnected(JSContextRef context,
@@ -278,7 +327,7 @@ JSValueRef JSBluetoothServiceHandler::getIsConnected(JSContextRef context,
                LogWarning("Exception"<<ex.GetMessage());
        }       
 
-       return NULL;
+       return JSValueMakeUndefined(context);
 }
 
 const JSClassDefinition* JSBluetoothServiceHandler::getClassInfo() 
index e5e5afe..89b710f 100644 (file)
@@ -45,6 +45,7 @@ private:
        static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
        static JSValueRef getUuid(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static bool setOnConnect(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+       static JSValueRef getOnConnect(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static void getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames);
        static JSValueRef unregisterRFCOMMService(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, 
                const JSValueRef arguments[], JSValueRef* exception);
index 44bda49..e11a8b3 100644 (file)
@@ -54,11 +54,11 @@ JSClassDefinition JSBluetoothSocket::m_classInfo =
        m_function,
        initialize,
        finalize,
-       NULL, 
-       NULL, 
-       NULL, 
-       NULL, 
-       NULL, 
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
        NULL,
        NULL,
        hasInstance,
@@ -71,9 +71,9 @@ JSStaticValue JSBluetoothSocket::m_properties[] =
 //     {"protocol", getProperty, NULL, kJSPropertyAttributeReadOnly},
        {"state", getProperty, NULL, kJSPropertyAttributeReadOnly},
        {"peer", getProperty, NULL, kJSPropertyAttributeReadOnly},
-       {"onerror", NULL, setProperty, kJSPropertyAttributeNone},
-       {"onmessage", NULL, setProperty, kJSPropertyAttributeNone},
-       {"onclose", NULL, setProperty, kJSPropertyAttributeNone},
+       {"onerror", getCallback, setProperty, kJSPropertyAttributeNone},
+       {"onmessage", getCallback, setProperty, kJSPropertyAttributeNone},
+       {"onclose", getCallback, setProperty, kJSPropertyAttributeNone},
        {0, 0, 0, 0}
 };
 
@@ -104,7 +104,6 @@ JSClassRef JSBluetoothSocket::m_jsClassRef = JSClassCreate(JSBluetoothSocket::ge
 
 JSObjectRef JSBluetoothSocket::m_peer = NULL;
 
-
 bool JSBluetoothSocket::setProperty(JSContextRef context, 
                                        JSObjectRef object,
                                        JSStringRef propertyName,
@@ -112,63 +111,64 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
                                        JSValueRef* exception)
 {
        LogDebug("OK");
-       
-       try 
+
+       try
        {
                JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "private object is null");
+               }
+
                IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
                BluetoothConverter converter(priv->getContext());
-               
-               if (priv == NULL)
+               if (BluetoothSocketManager == NULL)
                {
-                       ThrowMsg(ConversionException, "private object null");
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
                }
 
                EventBTSocketNotificationEmitterPtr emitter = BluetoothSocketManager->getSocketNotifier();
-       
-               if (BluetoothSocketManager == NULL || emitter == NULL)
+               if (emitter == NULL)
                {
-                       LogError("BluetoothManager or event or listener NULL");
-                       Throw(WrtDeviceApis::Commons::UnknownException);        
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "emitter is NULL");
                }
-               
-               BluetoothSocketNotifierPrivateDataPtr privData = 
+
+               BluetoothSocketNotifierPrivateDataPtr privData =
                                DPL::DynamicPointerCast<BluetoothSocketNotifierPrivateData>(emitter->getEventPrivateData());
 
                if (privData == NULL)
                {
-                       LogError("privData NULL");
-                       Throw(WrtDeviceApis::Commons::UnknownException);        
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothSocketNotifierPrivateData is NULL");
+               }
+
+               if(JSValueIsNull(context, value) ||
+                       JSObjectIsFunction(context, converter.toJSObjectRef(value)) )
+               {
+                       LogDebug("Callable or null");
+                       converter.setBluetoothSocketNotifierCallback(propertyName, value, object, privData);
+               }
+               else
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Non callable object");
                }
                
-               converter.setBluetoothSocketNotifierCallback(propertyName, value, object, privData);
                emitter->setListener(&BluetoothSocketListener::getInstance());
                emitter->setEventPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(privData));
 
                return true;
        }
-       catch (WrtDeviceApis::Commons::Exception& ex) 
+       catch (const WrtDeviceApis::Commons::ConversionException& ex)
        {
                LogError("Exception: " << ex.GetMessage());
-
-               switch (ex.getCode())
-               {
-               case WrtDeviceApis::Commons::ExceptionCodes::ConversionException:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
-                       break;
-               case WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");
-                       break;
-               case WrtDeviceApis::Commons::ExceptionCodes::Exception:
-               default:
-                       JSTizenExceptionFactory::postException(context, exception,
-                               JSTizenException::UNKNOWN_ERROR, "Unkown error");
-               }
+               *exception = JSTizenExceptionFactory::makeErrorObject(context,
+                       JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
        }       
-       return false;
+       catch (WrtDeviceApis::Commons::Exception& ex)
+       {
+               LogWarning("Exception: " << ex.GetMessage());
+       }
 
+       return false;
 }
 
 void JSBluetoothSocket::initialize(JSContextRef context, JSObjectRef object) 
@@ -255,24 +255,31 @@ JSObjectRef JSBluetoothSocket::createJSObject(JSContextRef context, BluetoothSoc
        BluetoothSocketManager->setReadData(readData);
        return JSObjectMake(context, getClassRef(), priv);
 }
+
 JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
                                                        JSObjectRef object,
                                                        JSStringRef propertyName,
                                                        JSValueRef* exception)
 {
-       LogDebug("OK"); 
+       LogDebug("OK");
 
        
        Try
        {
+               if(JSStringIsEqualToUTF8CString(propertyName, "peer") && m_peer != NULL)
+                       return m_peer;
+
                JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
+               }
+
                IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
                BluetoothConverter converter(priv->getContext());
-
-               if (priv == NULL)
+               if (BluetoothSocketManager == NULL)
                {
-                       LogError("priv null");
-                       Throw(WrtDeviceApis::Commons::ConversionException);     
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
                }
 
                if(JSStringIsEqualToUTF8CString(propertyName, "uuid")) 
@@ -280,25 +287,15 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
                        std::string uuid = BluetoothSocketManager->getUUID();
                        return converter.toJSValueRef(uuid);
                }
-               else if(JSStringIsEqualToUTF8CString(propertyName, "protocol")) 
-               {
-                       unsigned short int protocol = BluetoothSocketManager->getProtocol();
-                       return converter.toBluetoothProtocolJSValue(protocol);
-
-               }
                else if(JSStringIsEqualToUTF8CString(propertyName, "state")) 
                {
                        unsigned short int state = BluetoothSocketManager->getState();
                        return converter.toBluetoothStateJSValue(state);
                }
-               else if(JSStringIsEqualToUTF8CString(propertyName, "peer")) 
+               else
                {
-                       if(m_peer == NULL)
-                       {
-                               BluetoothDeviceData device = BluetoothSocketManager->getPeer();
-                               m_peer = JSBluetoothDevice::createJSObject(priv->getContext(), device);
-                       }
-
+                       BluetoothDeviceData device = BluetoothSocketManager->getPeer();
+                       m_peer = JSBluetoothDevice::createJSObject(priv->getContext(), device);
                        return m_peer;
                }
        }
@@ -310,6 +307,90 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
        return JSValueMakeUndefined(context);
 }
 
+JSValueRef JSBluetoothSocket::getCallback(JSContextRef context,
+                                                       JSObjectRef object,
+                                                       JSStringRef propertyName,
+                                                       JSValueRef* exception)
+{
+       LogDebug("OK");
+
+       Try
+       {
+               JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "private object null");
+               }
+
+               IBluetoothSocketManagerPtr BluetoothSocketManager(priv->getObject());
+               BluetoothConverter converter(priv->getContext());
+               if (BluetoothSocketManager == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "BluetoothManager is NULL");
+               }
+
+               EventBTSocketNotificationEmitterPtr emitter = BluetoothSocketManager->getSocketNotifier();
+               if (emitter == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "emitter is NULL");
+               }
+
+               BluetoothSocketNotifierPrivateDataPtr privData =
+                               DPL::DynamicPointerCast<BluetoothSocketNotifierPrivateData>(emitter->getEventPrivateData());
+
+               if (privData == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "privData NULL");
+               }
+
+               if(JSStringIsEqualToUTF8CString(propertyName, "onmessage"))
+               {
+                       JSValueRef callback = privData->getOnMessage()->getOnSuccess();
+                       if(callback == NULL)
+                       {
+                               LogDebug("callback is NULL");
+                       }
+                       else
+                       {
+                               LogDebug("callback is not NULL");
+                               return callback;
+                       }
+               }
+               else if(JSStringIsEqualToUTF8CString(propertyName, "onclose"))
+               {
+                       JSValueRef callback = privData->getOnClose()->getOnSuccess();
+                       if(callback == NULL)
+                       {
+                               LogDebug("callback is NULL");
+                       }
+                       else
+                       {
+                               LogDebug("callback is not NULL");
+                               return callback;
+                       }
+               }
+               else if(JSStringIsEqualToUTF8CString(propertyName, "onerror"))
+               {
+                       JSValueRef callback = privData->getOnError()->getOnSuccess();
+                       if(callback == NULL)
+                       {
+                               LogDebug("callback is NULL");
+                       }
+                       else
+                       {
+                               LogDebug("callback is not NULL");
+                               return callback;
+                       }
+               }
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+       }
+
+       return JSValueMakeNull(context);
+}
+
 
 JSValueRef JSBluetoothSocket::writeData(JSContextRef context, JSObjectRef object,
                JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
@@ -497,6 +578,8 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context, JSObjectRef object,
                        JSTizenException::UNKNOWN_ERROR, "unknown error");
        }               
 }
+
+
 }
 }
 
index 142eb33..bcc65eb 100644 (file)
@@ -79,6 +79,11 @@ private:
                                JSStringRef propertyName,
                                JSValueRef* exception);
 
+       static JSValueRef getCallback(JSContextRef context,
+                               JSObjectRef object,
+                               JSStringRef propertyName,
+                               JSValueRef* exception);
+
        static JSClassDefinition m_classInfo;
        static JSStaticFunction m_function[];
        static JSStaticValue m_properties[];
index 859f38b..326b33e 100755 (executable)
@@ -154,7 +154,7 @@ std::vector<BookmarkDataPtr> BookmarkManager::_getCompleteCB(BookmarkSearchDataP
                                                        folders.push((it->second).get());
 
                                                if ((it->second)->m_id != lastItemId) {
-                                                       LogDebug("not last");
+                                                       LogDebug("not last item");
                                                        it++;
                                                        LogDebug("it->first:"<<it->first << " it->second:" <<(it->second)->m_id);
                                                } else
index 0520b61..8eb1d34 100755 (executable)
@@ -2,13 +2,18 @@ SET(TARGET_NAME ${bookmark_target})
 SET(DESTINATION_NAME ${bookmark_dest})
 SET(TARGET_IMPL_NAME ${bookmark_impl})
 
-PKG_SEARCH_MODULE(favorites REQUIRED capi-web-favorites)
+PKG_CHECK_MODULES(platform_pkgs_bookmark REQUIRED capi-web-favorites)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
 )
 
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${platform_pkgs_bookmark_INCLUDE_DIRS}
+)
+
 SET(SRCS_IMPL
        JSBookmarkManager.cpp
        BookmarkManager.cpp
@@ -16,16 +21,11 @@ SET(SRCS_IMPL
        JSBookmarkItem.cpp
 )
 
-INCLUDE_DIRECTORIES(
-       ${TOP}/Common
-       ${favorites_INCLUDE_DIRS}
-)
-
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${favorites_LIBRARIES}
+       ${platform_pkgs_bookmark_LIBRARIES}
 )
 
 SET(SRCS
@@ -42,6 +42,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bookmark
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/bookmark
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index 979d67d..83bf3df 100755 (executable)
@@ -19,7 +19,6 @@
 #include <JSTizenException.h>
 #include <SecurityExceptions.h>
 #include <CommonsJavaScript/Converter.h>
-#include <ArgumentValidationChecker.h>
 #include <GlobalContextManager.h>
 #include "JSBookmarkManager.h"
 #include "JSBookmarkFolder.h"
index 38887fa..c310af9 100755 (executable)
@@ -29,6 +29,7 @@ set(LIBS_TEST
 # -----------------------------------------------------------------------------
 
 add_plugin(
+       TimeUtil
        Tizen
        Content
        Calendar
@@ -38,7 +39,6 @@ add_plugin(
        Application
        Messaging
        Callhistory
-       TimeUtil
        Systeminfo
        NFC
        Log
index a3476a2..26b3581 100755 (executable)
@@ -2,8 +2,15 @@ SET(TARGET_NAME ${calendar_target})
 SET(DESTINATION_NAME ${calendar_dest})
 SET(TARGET_IMPL_NAME ${calendar_impl})
 
-PKG_SEARCH_MODULE(calendar REQUIRED calendar-service2)
-PKG_SEARCH_MODULE(icu REQUIRED icu-i18n)
+PKG_CHECK_MODULES(platform_pkgs_calendar REQUIRED calendar-service2 icu-i18n)
+
+INCLUDE_DIRECTORIES(
+       ${TOP}/Tizen
+       ${TOP}/TimeUtil
+       ${TOP}/Contact
+       ${TOP}/Common
+       ${platform_pkgs_calendar_INCLUDE_DIRS}
+)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
@@ -43,24 +50,17 @@ SET(SRCS_IMPL
        EventRecurrenceRule.cpp
        EventId.cpp
        EventAlarm.cpp
-    CalendarUtility.cpp
-)
-
-INCLUDE_DIRECTORIES(
-       ${TOP}/Tizen
-       ${TOP}/TimeUtil
-       ${TOP}/Contact
-       ${TOP}/Common
-       ${calendar_INCLUDE_DIRS}
-    ${icu_INCLUDE_DIRS}
+       CalendarUtility.cpp
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${calendar_LIBRARIES}
-       ${icu_LIBRARIES}
+       ${tizen_impl}
+       ${timeutil_impl}
+       ${contact_impl}
+       ${platform_pkgs_calendar_LIBRARIES}
 )
 
 SET(SRCS
@@ -72,16 +72,12 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${contact_impl}
-       ${contact_config}
-       ${tizen_impl}
-       ${timeutil_impl}
-       ${LIBS_COMMON}
+       "-Wl,--no-as-needed" ${contact_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/calendar
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/calendar
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 85663b1..82f139e 100755 (executable)
@@ -768,7 +768,92 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event)
 
             calendar_list_next(resultList);
         }
-        LogDebug("Length of found events: "<<event->getEvents()->size());
+        LogDebug("Length of found items: "<<event->getEvents()->size());
+
+               // Handle the recurring event range filter corner case.
+               int id = -1, parentCount = -1;
+               bool found = false;
+        resultList = calendarFilter->getNormalInstanceResultRecordList();
+        count = calendarFilter->getNormalInstanceResultRecordCount();
+               LogDebug("Number of found normal instances: "<<count);
+
+        currentRecord = NULL;
+        calendar_list_first(resultList);
+        while(count--) {
+            currentRecord = NULL;
+            ret = calendar_list_get_current_record_p(resultList, &currentRecord);
+            if ( CALENDAR_ERROR_NONE != ret ) {
+                ThrowMsg(PlatformException, "Can't get a current record: "<<ret);
+            }
+
+                       id = -1;
+                       ret = calendar_record_get_int(currentRecord, _calendar_instance_normal_calendar_book.event_id, &id);
+                       if (CALENDAR_ERROR_NONE != ret) {
+                               ThrowMsg(PlatformException, "Can't get the normal instance parent id: "<<ret);
+                       }
+
+                       // Skip if the parent event is already found.
+                       parentCount = event->getEvents()->size();
+                       found = false;
+                       while(parentCount--) {
+                               if(id==event->getEvents()->at(parentCount)->getId()) {
+                                       LogDebug("Found the id: "<<id<<", thus skip this.");
+                                       found = true;
+                                       break;
+                               }
+                       }
+
+                       if(false==found) {
+                               LogDebug("Add the normal instance parent: "<<id);
+                   DPL::ScopedPtr<EventWrapper> eventWrapper(new EventWrapper(getType()));
+                               eventWrapper->loadEvent(id);
+                   event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent());
+                       }
+
+            calendar_list_next(resultList);
+        }
+        LogDebug("Length of found items including normal instances: "<<event->getEvents()->size());
+
+        resultList = calendarFilter->getAlldayInstanceResultRecordList();
+        count = calendarFilter->getAlldayInstanceResultRecordCount();
+               LogDebug("Number of found allday instances: "<<count);
+
+        currentRecord = NULL;
+        calendar_list_first(resultList);
+        while(count--) {
+            currentRecord = NULL;
+            ret = calendar_list_get_current_record_p(resultList, &currentRecord);
+            if ( CALENDAR_ERROR_NONE != ret ) {
+                ThrowMsg(PlatformException, "Can't get a current record: "<<ret);
+            }
+
+                       id = -1;
+                       ret = calendar_record_get_int(currentRecord, _calendar_instance_allday_calendar_book.event_id, &id);
+                       if (CALENDAR_ERROR_NONE != ret) {
+                               ThrowMsg(PlatformException, "Can't get the allday instance parent id: "<<ret);
+                       }
+
+                       // Skip if the parent event is already found.
+                       parentCount = event->getEvents()->size();
+                       found = false;
+                       while(parentCount--) {
+                               if(id==event->getEvents()->at(parentCount)->getId()) {
+                                       LogDebug("Found the id: "<<id<<", thus skip this.");
+                                       found = true;
+                                       break;
+                               }
+                       }
+
+                       if(false==found) {
+                               LogDebug("Add the allday instance parent: "<<id);
+                   DPL::ScopedPtr<EventWrapper> eventWrapper(new EventWrapper(getType()));
+                               eventWrapper->loadEvent(id);
+                   event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent());
+                       }
+
+            calendar_list_next(resultList);
+        }
+        LogDebug("Length of found items including allday instances: "<<event->getEvents()->size());
 
         event->setResult(true);
     }
index 3fab69b..440e646 100755 (executable)
@@ -82,6 +82,10 @@ CalendarFilter::CalendarFilter()
     m_filter = NULL;
     m_recordList = NULL;
     m_recordCount = 0;
+    m_normalInstanceRecordList = NULL;
+    m_normalInstanceRecordCount = 0;
+    m_alldayInstanceRecordList = NULL;
+    m_alldayInstanceRecordCount = 0;
 }
 
 CalendarFilter::~CalendarFilter()
@@ -98,6 +102,13 @@ CalendarFilter::~CalendarFilter()
     if(m_recordList) {
         calendar_list_destroy(m_recordList, false);
     }
+
+       if(m_normalInstanceRecordList) {
+               calendar_list_destroy(m_normalInstanceRecordList, true);
+       }
+       if(m_alldayInstanceRecordList) {
+               calendar_list_destroy(m_alldayInstanceRecordList, true);
+       }
 }
 
 void CalendarFilter::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth)
@@ -369,6 +380,81 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen
             }
                        calendar_filter_add_operator(m_filter, CALENDAR_FILTER_OPERATOR_OR);
                        calendar_filter_add_filter(m_filter, 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.");
+            if (!initialValue->isNullOrUndefined()) {
+                calendar_filter_add_caltime(normalFilter, _calendar_instance_normal_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTime);
+            }
+            if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+                calendar_filter_add_operator(normalFilter, 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);
+            }
+                       LogDebug("Add a filter for allday instances.");
+            if (!initialValue->isNullOrUndefined()) {
+                calendar_filter_add_caltime(alldayFilter, _calendar_instance_allday_calendar_book.start_time, CALENDAR_MATCH_GREATER_THAN_OR_EQUAL, startTimeAllday);
+            }
+            if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) {
+                calendar_filter_add_operator(alldayFilter, 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);
+            }
+
+                       int ret;
+                       LogDebug("Query for normal instances.");
+                       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);
+                       }
+                       LogDebug("Query for allday instances.");
+                       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);
+                       }
+
+                       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("Added caltime range filter with initial value: "<<startTime.time.utime<<", end value: "<<endTime.time.utime);
     } else if(CALENDAR_FILTER_ATTRIBUTE_LATITUDE==attrName ||
@@ -541,6 +627,26 @@ calendar_list_h CalendarFilter::getResultRecordList() const
        return m_recordList;
 }
 
+int CalendarFilter::getNormalInstanceResultRecordCount() const
+{
+       return m_normalInstanceRecordCount;
+}
+
+calendar_list_h CalendarFilter::getNormalInstanceResultRecordList() const
+{
+       return m_normalInstanceRecordList;
+}
+
+int CalendarFilter::getAlldayInstanceResultRecordCount() const
+{
+       return m_alldayInstanceRecordCount;
+}
+
+calendar_list_h CalendarFilter::getAlldayInstanceResultRecordList() const
+{
+       return m_alldayInstanceRecordList;
+}
+
 int CalendarFilter::convertStringToIntValue(const std::string attrName, const std::string valueString)
 {
        LogDebug("attrName: "<<attrName<<", valueString: "<<valueString);
index 25b1344..6c94ba6 100755 (executable)
@@ -26,8 +26,6 @@
 #include "CalendarEvent.h"
 #include <calendar2.h>
 
-
-
 namespace DeviceAPI {
 namespace Calendar {
 
@@ -65,6 +63,12 @@ private:
        calendar_filter_h m_filter;
     calendar_list_h m_recordList;
     int m_recordCount;
+       // Corner case handling for recurring event range filter.
+    calendar_list_h m_normalInstanceRecordList;
+    int m_normalInstanceRecordCount;
+    calendar_list_h m_alldayInstanceRecordList;
+    int m_alldayInstanceRecordCount;
+
        static std::map<std::string, unsigned int> m_eventAttributeMap;
        static std::map<std::string, unsigned int> m_taskAttributeMap;
 
@@ -100,6 +104,14 @@ public:
 
        calendar_list_h getResultRecordList() const;
 
+       int getNormalInstanceResultRecordCount() const;
+
+       calendar_list_h getNormalInstanceResultRecordList() const;
+
+       int getAlldayInstanceResultRecordCount() const;
+
+       calendar_list_h getAlldayInstanceResultRecordList() const;
+
 private:
        int convertStringToIntValue(const std::string attrName, const std::string valueString);
 };
index b3aed2b..d22c1b6 100755 (executable)
@@ -2,18 +2,14 @@ SET(TARGET_NAME ${callhistory_target})
 SET(DESTINATION_NAME ${callhistory_dest})
 SET(TARGET_IMPL_NAME ${callhistory_impl})
 
-PKG_SEARCH_MODULE(contacts-service REQUIRED contacts-service2)
-PKG_SEARCH_MODULE(glib REQUIRED glib-2.0)
-PKG_SEARCH_MODULE(libpcrecpp REQUIRED libpcrecpp)
+PKG_CHECK_MODULES(platform_pkgs_callhistory REQUIRED contacts-service2 glib-2.0 libpcrecpp)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/Tizen
        ${TOP}/Contact
-       ${contacts-service_INCLUDE_DIRS}
-       ${glib_INCLUDE_DIRS}
-       ${libpcrecpp_INCLUDE_DIRS}
- )
+       ${platform_pkgs_callhistory_INCLUDE_DIRS}
+)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
@@ -47,10 +43,8 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${contacts-service_LIBRARIES}
-       ${capicall_LIBRARIES}
-       ${glib_LIBRARIES}
-       ${libpcrecpp_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_callhistory_LIBRARIES}
 )
 
 SET(SRCS
@@ -62,13 +56,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${tizen_impl}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/callhistory
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/callhistory
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 776097e..af445e8 100755 (executable)
@@ -141,7 +141,7 @@ bool CallHistory::convertCallHistory(callhistory_query_s *query_log, CallHistory
        std::string tags("");
        std::string direction("");
        std::string number("");
-       
+
        if (query_log->phone_number != NULL) {
                number.append(query_log->phone_number);
        }
@@ -266,6 +266,7 @@ void CallHistory::removeAll(const EventRemoveAllPtr& event)
 long CallHistory::addListener(const EventCallHistoryListenerEmitterPtr& emitter)
 {
        int ret =0;
+
        if (CallHistory::m_watchers.size() == 0) {
                WatcherPtr watcher(new Watcher(0, emitter));
                ret = contacts_db_add_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, watcher.Get());
@@ -288,7 +289,7 @@ long CallHistory::addListener(const EventCallHistoryListenerEmitterPtr& emitter)
                        if (ret != CONTACTS_ERROR_NONE) {
                                LogDebug("callhistory query error [" << ret << "]");
                        }
-                       
+
                        if (parseRecord(&recordList, callHistoryListPtr)) {
                                if (callHistoryListPtr->size() > 0) {
                                        watcher->setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
@@ -317,6 +318,10 @@ void CallHistory::removeListener(const long id)
        int ret = CONTACTS_ERROR_NONE;
 
        for (;it < CallHistory::m_watchers.end();) {
+
+               LogDebug("removeListener : id ["<<id<<"]");
+               LogDebug("removeListener : handle() ["<<(*it)->getHandle()<<"]");
+
                if (id == (*it)->getHandle()) {
                        flag = true;
                        ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
@@ -329,8 +334,8 @@ void CallHistory::removeListener(const long id)
                        continue;
                }
                ++it;
-       }
 
+       }
        LogDebug("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")");
 
        if (!flag) {
@@ -619,7 +624,7 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event)
 
                        if (record == NULL) {
                                ret = contacts_list_next(record_list);
-                               if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){ 
+                               if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){
                                        LogDebug("callhistory remove All error [" << ret << "]");
                                        event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
                                }
@@ -684,7 +689,7 @@ void CallHistory::callRemoveBatchEvent(int error, const EventRemoveBatchPtr &eve
        if (error != CONTACTS_ERROR_NONE) {
                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
        }
-       
+
        EventRequestReceiver<EventRemoveBatch>::ManualAnswer(event);
 
        std::vector<EventRemoveBatchDataPtr>::iterator it;
@@ -702,7 +707,7 @@ void CallHistory::callRemoveAllEvent(int error, const EventRemoveAllPtr &event)
        if (error != CONTACTS_ERROR_NONE) {
                event->setExceptionCode(Commons::ExceptionCodes::PlatformException);
        }
-       
+
        EventRequestReceiver<EventRemoveAll>::ManualAnswer(event);
 
        std::vector<EventRemoveAllDataPtr>::iterator it;
@@ -826,7 +831,7 @@ void CallHistory::Watcher::changedListenerCB()
        contacts_query_h query = NULL;
        contacts_filter_h filter = NULL;
        contacts_list_h recordList = NULL;
-       
+
        if (missedCallListPtr->size() > 0) {
                contacts_query_create(_contacts_phone_log._uri, &query);
                contacts_filter_create(_contacts_phone_log._uri, &filter);
index d219db1..ed81e4d 100755 (executable)
@@ -69,12 +69,12 @@ public:
        void removeBatch(const EventRemoveBatchPtr& event);
        void removeAll(const EventRemoveAllPtr& event);
        long addListener(const EventCallHistoryListenerEmitterPtr& emitter);
-       void removeListener(const long id);
+       void removeListener(const long id);
 
        class Watcher
        {
        private:
-               long m_handle;
+               long m_handle;
                EventCallHistoryListenerEmitterPtr m_emitter;
                unsigned int m_currentLogId;
                MissedCallListPtr m_missedCallList;
@@ -83,19 +83,23 @@ public:
                Watcher(long handle, const EventCallHistoryListenerEmitterPtr& emitter);
                ~Watcher();
 
-               void setHandle(long handle)
+               void setHandle(long handle)
                {
+                       LogDebug("setHandle : handle ["<<handle<<"]");
                        m_handle = handle;
                }
 
-               long getHandle()
+               long getHandle()
                {
+                       LogDebug("getHandle : handle ["<<m_handle<<"]");
                        return m_handle;
                }
 
                void setCurrentLogId(unsigned int logId)
                {
                        m_currentLogId = logId;
+                       LogDebug("setCurrentLogId : logId ["<<logId);
+
                }
 
                unsigned int getCurrentLogId()
index ce52b4a..526a6d1 100755 (executable)
@@ -47,9 +47,9 @@ public:
        virtual void removeAll(const EventRemoveAllPtr& event) = 0;
 
        virtual long addListener(const EventCallHistoryListenerEmitterPtr& emitter) = 0;
-
-       virtual void removeListener(const long id) = 0;
-
+       virtual void removeListener(const long id) = 0;
+       
 protected:
        ICallHistory();
        virtual void OnRequestReceived(const EventCallHistoryPtr& event) = 0;
index 57c4e1a..7fb2d75 100755 (executable)
@@ -28,8 +28,9 @@
 #include "CallHistoryFactory.h"
 #include "ICallHistory.h"
 #include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h> 
+#include <JSTizenException.h>
 #include <SecurityExceptions.h>
+#include <JSUtil.h>
 
 #include "JSCallHistoryEntry.h"
 #include "JSCallHistory.h"
@@ -41,6 +42,8 @@
 #include "CallHistoryAsyncCallbackManager.h"
 #include "CallHistoryListenerManager.h"
 
+
+
 using namespace std;
 using namespace DPL;
 using namespace WrtDeviceApis::Commons;
@@ -323,7 +326,7 @@ JSValueRef JSCallHistory::removeBatch(JSContextRef context, JSObjectRef object,
                }
 
                cbm->setObject(thisObject);
-               
+
                EventRemoveBatchPtr event(new EventRemoveBatch());
                ICallHistoryPtr callHistory(priv->getObject());
 
@@ -455,12 +458,14 @@ JSValueRef JSCallHistory::addChangeListener(JSContextRef context, JSObjectRef ob
                        ICallHistoryPtr callHistory(priv->getObject());
                        id = callHistory->addListener(emitter);
 
+                       LogDebug("addChangeListener : id [" <<id<<"]");
+
                        CallHistoryListenerCancellerPtr canceller = CallHistoryListenerCancellerPtr(new CallHistoryListenerCanceller(gContext, thisObject, id));
                        DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast<DeviceAPI::Common::IListenerItem>(canceller);
                        CallHistoryListenerManagerSingleton::Instance().registerListener(listenerItem, gContext);
                }
+               return JSUtil::toJSValueRef(context, id);
 
-               return converter.toJSValueRefLong(id);
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage());
        } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
@@ -496,12 +501,14 @@ JSValueRef JSCallHistory::removeChangeListener(JSContextRef context, JSObjectRef
 
        try {
                long id = 0;
+
                if (argumentCount >= 1) {
                        if (check.isNullOrUndefined(arguments[0])) {
                                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : handle");
                        }
 
-                       id = static_cast<long>(converter.toLong(arguments[0]));
+                       id=JSUtil::JSValueToLong(context, arguments[0]);
+                       LogDebug("removeChangeListener : id [" <<id<<"]");
                }
 
                if (id != 0) {
old mode 100755 (executable)
new mode 100644 (file)
index 35b3d33..60875d3
@@ -1,30 +1,28 @@
 SET(SRCS
-  JSTizenException.cpp
-  TizenExceptionData.cpp
-  JSTizenExceptionFactory.cpp
-  JSWebAPIError.cpp
-  ArgumentValidationChecker.cpp
-  CallbackUserData.cpp
-  GlobalContextManager.cpp
-  ArgumentValidator.cpp
-  JSUtil.cpp
-  PlatformException.cpp
-  MultiCallbackUserData.cpp
-  JSWebAPIErrorFactory.cpp
-  JSWebAPIError2.cpp
-  WebAPIError.cpp
+       JSTizenException.cpp
+       TizenExceptionData.cpp
+       JSTizenExceptionFactory.cpp
+       JSWebAPIError.cpp
+       ArgumentValidationChecker.cpp
+       CallbackUserData.cpp
+       GlobalContextManager.cpp
+       ArgumentValidator.cpp
+       JSUtil.cpp
+       PlatformException.cpp
+       MultiCallbackUserData.cpp
+       JSWebAPIErrorFactory.cpp
+       JSWebAPIError2.cpp
+       WebAPIError.cpp
 )
 
 ADD_LIBRARY(${COMMON_TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${COMMON_TARGET_NAME}
-  #${LIBS_WIDGETDB}
-  ${LIBS_COMMON}
-  #${wrt-plugins-plugin-manager_LIBRARIES}
+       ${LIBS_COMMON}
 )
 
 INSTALL(TARGETS ${COMMON_TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${COMMON_DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/common
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/common
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index 3605dfc..d384d65 100755 (executable)
@@ -320,6 +320,7 @@ JSValueRef StandaloneConsole::RunScriptEx(const char* path, JSValueRef *exceptio
         return RunLineEx(buff, exception);
     }
     fclose(f);
+    return JSValueMakeUndefined(mGlobalContext);
 }
 
 void StandaloneConsole::RunLine(const char * line){
index 13420af..52cc741 100755 (executable)
@@ -3,16 +3,12 @@ SET(DESTINATION_NAME ${contact_dest})
 SET(TARGET_IMPL_NAME ${contact_impl})
 SET(TARGET_CONFIG_NAME ${contact_config})
 
-PKG_SEARCH_MODULE(contacts-service REQUIRED contacts-service2)
-PKG_SEARCH_MODULE(pcrecpp REQUIRED libpcrecpp)
-PKG_SEARCH_MODULE(download REQUIRED capi-web-url-download)
+PKG_CHECK_MODULES(platform_pkgs_contact REQUIRED contacts-service2 libpcrecpp)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Tizen
        ${TOP}/Common
-       ${contacts-service_INCLUDE_DIRS}
-       ${pcrecpp_INCLUDE_DIRS}
-       ${download_INCLUDE_DIRS}
+       ${platform_pkgs_contact_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -90,11 +86,11 @@ SET(SRCS_IMPL
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
-       ${contacts-service_LIBRARIES}
-       ${pcrecpp_LIBRARIES}
-       ${download_LIBRARIES}
        ${LIBS_COMMON}
+       ${tizen_impl}
+       ${platform_pkgs_contact_LIBRARIES}
 )
 
 SET(SRCS_CONFIG
@@ -116,13 +112,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
        ${TARGET_CONFIG_NAME}
-       ${tizen_impl}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/contact
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/contact
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index 2ffb3fa..4a2c84b 100755 (executable)
@@ -43,12 +43,30 @@ Contact::Contact()
        , m_platformContactObjectList(NULL)
 {
 //     LogDebug("entered");
+
+       m_notesJSObjIsSet = false;
+       m_groupIdsJSObjIsSet = false;
+       m_context = NULL;
+       m_groupIdsObj = NULL;
+       m_groupIdsJSValue = NULL;
 }
 
 Contact::~Contact()
 {
        if (m_platformContactObjectList != NULL)
                contacts_list_destroy(m_platformContactObjectList, true);
+
+       if(groupIdsJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getGroupIdsJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
+
+       if(notesJSObjIsSet()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getNotesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 
 string Contact::convertToString(const string &format)
@@ -124,5 +142,58 @@ void Contact::setContactFromString(const std::string &vObjectStr)
        m_platformContactObjectList = contacts_list;
 }
 
+void Contact::setNotesJSObj(bool value, JSObjectRef initObj)
+{
+       m_notesJSObjIsSet = value;
+       m_notesObj = initObj;
+}
+
+bool Contact::notesJSObjIsSet() const
+{
+       return m_notesJSObjIsSet;
+}
+
+JSObjectRef Contact::getNotesJSObj()
+{
+       return m_notesObj;
+}
+
+JSValueRef Contact::getNotesJSValue()
+{
+       return m_notesJSValue;
+}
+
+void Contact::setGroupIdsJSObj(bool value, JSObjectRef initObj)
+{
+       m_groupIdsJSObjIsSet = value;
+       m_groupIdsObj = initObj;
+}
+
+bool Contact::groupIdsJSObjIsSet() const
+{
+       return m_groupIdsJSObjIsSet;
+}
+
+JSObjectRef Contact::getGroupIdsJSObj()
+{
+       return m_groupIdsObj;
+}
+
+JSValueRef Contact::getGroupIdsJSValue()
+{
+       return m_groupIdsJSValue;
+}
+
+void Contact::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef Contact::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI
index 7d649f9..1f797e2 100755 (executable)
@@ -45,9 +45,32 @@ public:
 
        contacts_record_h getPlatformContactObject() const { return m_platformContactObject; };
 
+       void setNotesJSObj(bool value, JSObjectRef initObj);
+       bool notesJSObjIsSet() const;
+       JSObjectRef getNotesJSObj();
+       JSValueRef getNotesJSValue();
+
+       void setGroupIdsJSObj(bool value, JSObjectRef initObj);
+       bool groupIdsJSObjIsSet() const;
+       JSObjectRef getGroupIdsJSObj();
+       JSValueRef getGroupIdsJSValue();
+
+       void setContext(JSContextRef contextRef);
+       JSContextRef getContext();
+
 private:
        contacts_record_h m_platformContactObject;
        contacts_list_h m_platformContactObjectList;
+
+       bool m_notesJSObjIsSet;
+       JSObjectRef m_notesObj;
+       JSValueRef m_notesJSValue;
+
+       bool m_groupIdsJSObjIsSet;
+       JSObjectRef m_groupIdsObj;
+       JSValueRef m_groupIdsJSValue;
+
+       JSContextRef m_context;
 };
 
 } // Contact
index be7e834..74e97de 100755 (executable)
@@ -38,11 +38,19 @@ ContactAddress::ContactAddress() :
        m_isDefault(false)
 {
        m_types = ContactAddressTypeArrayPtr(new ContactAddressTypeArray());
+       is_typesSetJSArray = false;
+       m_context = NULL;
+       m_typesJsValue = NULL;
+       m_typesObj = NULL;
 }
 
 ContactAddress::~ContactAddress()
 {
-       //nothing to do
+       if(IsTypesSetJSArray()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getTypesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 std::string ContactAddress::getCountry() const
 {
@@ -336,5 +344,38 @@ ContactAddressPtr ContactAddress::clone() const
        return result;
 }
 
+void ContactAddress::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+       is_typesSetJSArray = value;
+       m_typesObj = initValue;
+}
+
+JSValueRef ContactAddress::getTypesJSArray()
+{
+       return m_typesJsValue;
+}
+
+JSObjectRef ContactAddress::getTypesJSObj()
+{
+       return m_typesObj;
+}
+
+bool ContactAddress::IsTypesSetJSArray() const
+{
+       return is_typesSetJSArray;
+}
+
+
+void ContactAddress::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef ContactAddress::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI
index 33d14d0..a43dd57 100755 (executable)
@@ -29,6 +29,7 @@
 #include <vector>
 #include <dpl/shared_ptr.h>
 #include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
 
 namespace DeviceAPI {
 namespace Contact {
@@ -98,6 +99,14 @@ public:
        void clear();
        ContactAddressPtr clone() const;
 
+       void setTypesJSArray(bool value, JSObjectRef initValue);
+       JSValueRef getTypesJSArray();
+       JSObjectRef getTypesJSObj();
+       bool IsTypesSetJSArray() const;
+
+       void setContext(JSContextRef contextRef);
+       JSContextRef getContext();
+
 private:
        std::string     m_country;
        bool            m_countryIsSet;
@@ -120,6 +129,13 @@ private:
        bool            m_isDefault;
 
        ContactAddressTypeArrayPtr m_types;
+
+       bool is_typesSetJSArray;
+       JSValueRef m_typesJsValue;
+       JSObjectRef m_typesObj;
+
+       JSContextRef m_context;
+
 };
 
 } // Contact
index e2e8c64..0dc7bf8 100755 (executable)
@@ -224,7 +224,65 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue)
                ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute");
        }
 
-       return JSContact::getContact(m_context, jsValue);
+       ContactPtr tempContact = JSContact::getContact(m_context, jsValue);
+
+       const ScopedJSStringRef nameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NAME));
+       const ScopedJSStringRef addressesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ADDRESSES));
+       const ScopedJSStringRef groupIdsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_GROUP_IDS));
+       const ScopedJSStringRef notesStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NOTES));
+       const ScopedJSStringRef phoneNumbersStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_PHONE_NUMBERS));
+       const ScopedJSStringRef emailsStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_EMAILS));
+
+       JSObjectRef jsObject = toJSObjectRef(jsValue);
+       JSValueRef nameData = JSObjectGetProperty(m_context, jsObject, nameStr.get(), NULL);
+       JSValueRef addressesData = JSObjectGetProperty(m_context, jsObject, addressesStr.get(), NULL);
+       JSValueRef phoneNumbersData = JSObjectGetProperty(m_context, jsObject, phoneNumbersStr.get(), NULL);
+       JSValueRef emailsData = JSObjectGetProperty(m_context, jsObject, emailsStr.get(), NULL);
+       JSValueRef groupIdsData = JSObjectGetProperty(m_context, jsObject, groupIdsStr.get(), NULL);
+       JSValueRef notesData = JSObjectGetProperty(m_context, jsObject, notesStr.get(), NULL);
+
+       ContactNamePtr name;
+       ContactAddressArrayPtr addresses;
+       ContactPhoneNumberArrayPtr phoneNumbers;
+       ContactEmailAddressArrayPtr emails;
+       StringArrayPtr groupIds;
+       StringArrayPtr notes;
+
+       Validator validator(m_context);
+
+       if (!validator.isNullOrUndefined(nameData)) {
+               name = toContactName(nameData);
+               tempContact->setName(name);
+       }
+
+       if (!validator.isNullOrUndefined(addressesData)) {
+               addresses = toContactAddressArray(addressesData);
+               tempContact->setAddresses(addresses);
+       }
+
+       if (!validator.isNullOrUndefined(phoneNumbersData)) {
+               phoneNumbers = toContactPhoneNumberArray(phoneNumbersData);
+               tempContact->setPhoneNumbers(phoneNumbers);
+       }
+
+       if (!validator.isNullOrUndefined(emailsData)) {
+               emails = toContactEmailAddressArray(emailsData);
+               tempContact->setEmails(emails);
+       }
+
+       if (!validator.isNullOrUndefined(groupIdsData)) {
+               groupIds = toStringArray(groupIdsData);
+               tempContact->setGroupIds(groupIds);
+       }
+
+       if (!validator.isNullOrUndefined(notesData)) {
+               notes = toStringArray(notesData);
+               tempContact->setNotes(notes);
+       }
+
+       return tempContact;
+
+//     return JSContact::getContact(m_context, jsValue);
 }
 
 ContactPtr ContactConverter::toContactFromInit(const JSValueRef &jsValue)
@@ -417,7 +475,20 @@ PersonPtr ContactConverter::toPerson(const JSValueRef &jsValue)
 
 JSValueRef ContactConverter::toJSValueRef(const PersonArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSPersonArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 PersonArrayPtr ContactConverter::toPersonArray(const JSValueRef &jsValue)
@@ -456,7 +527,20 @@ ContactGroupPtr ContactConverter::toContactGroup(const JSValueRef &jsValue)
 
 JSValueRef ContactConverter::toJSValueRef(const ContactGroupArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactGroupArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactGroupArrayPtr ContactConverter::toContactGroupArray(const JSValueRef &jsValue)
@@ -659,6 +743,7 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV
        const ScopedJSStringRef departmentStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_DEPARTMENT));
        const ScopedJSStringRef titleStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_TITLE));
        const ScopedJSStringRef roleStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_ROLE));
+       const ScopedJSStringRef logoURIStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_LOGO_URI));
 
        JSObjectRef jsObject = toJSObjectRef(jsValue);
 
@@ -666,11 +751,13 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV
        JSValueRef departmentData = JSObjectGetProperty(m_context, jsObject, departmentStr.get(), NULL);
        JSValueRef titleData = JSObjectGetProperty(m_context, jsObject, titleStr.get(), NULL);
        JSValueRef roleData = JSObjectGetProperty(m_context, jsObject, roleStr.get(), NULL);
+       JSValueRef logoURIData = JSObjectGetProperty(m_context, jsObject, logoURIStr.get(), NULL);
 
        std::string name;
        std::string department;
        std::string title;
        std::string role;
+       std::string logoURI;
 
        ContactOrganizationPtr result(new ContactOrganization());
        if (!result) {
@@ -705,12 +792,32 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV
                result->setRole(role);
        }
 
+       if (!validator.isNullOrUndefined(logoURIData)) {
+               if(!JSValueIsString(m_context, logoURIData))
+                       ThrowMsg(WrtDeviceApis::Commons::ConversionException, "logoURI is not string");
+               logoURI = toString(logoURIData);
+               result->setLogoURI(logoURI);
+       }
+
        return result;
 }
 
 JSValueRef ContactConverter::toJSValueRef(const ContactOrganizationArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactOrganizationArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactOrganizationArrayPtr ContactConverter::toContactOrganizationArray(const JSValueRef &jsValue)
@@ -749,7 +856,20 @@ ContactWebSitePtr ContactConverter::toContactWebSite(const JSValueRef &jsValue)
 
 JSValueRef ContactConverter::toJSValueRef(const ContactWebSiteArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactWebSiteArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactWebSiteArrayPtr ContactConverter::toContactWebSiteArray(const JSValueRef &jsValue)
@@ -788,7 +908,20 @@ ContactAnniversaryPtr ContactConverter::toContactAnniversary(const JSValueRef &j
 
 JSValueRef ContactConverter::toJSValueRef(const ContactAnniversaryArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAnniversaryArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactAnniversaryArrayPtr ContactConverter::toContactAnniversaryArray(const JSValueRef &jsValue)
@@ -935,7 +1068,20 @@ ContactAddressPtr ContactConverter::toContactAddressFromInit(const JSValueRef &j
 
 JSValueRef ContactConverter::toJSValueRef(const ContactAddressArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAddressArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactAddressArrayPtr ContactConverter::toContactAddressArray(const JSValueRef &jsValue)
@@ -974,7 +1120,20 @@ ContactPhoneNumberPtr ContactConverter::toContactPhoneNumber(const JSValueRef &j
 
 JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactPhoneNumberArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactPhoneNumberArrayPtr ContactConverter::toContactPhoneNumberArray(const JSValueRef &jsValue)
@@ -1013,7 +1172,20 @@ ContactEmailAddressPtr ContactConverter::toContactEmailAddress(const JSValueRef
 
 JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactEmailAddressArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactEmailAddressArrayPtr ContactConverter::toContactEmailAddressArray(const JSValueRef &jsValue)
@@ -1119,7 +1291,20 @@ JSValueRef ContactConverter::toJSValueRef(ContactAddressType arg)
 
 JSValueRef ContactConverter::toJSValueRef(const ContactAddressTypeArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactAddressTypeArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactAddressTypeArrayPtr ContactConverter::toContactAddressTypeArray(const JSValueRef &jsValue)
@@ -1230,7 +1415,20 @@ JSValueRef ContactConverter::toJSValueRef(ContactPhoneNumberType arg)
 
 JSValueRef ContactConverter::toJSValueRef(const ContactPhoneNumberTypeArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactPhoneNumberTypeArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactPhoneNumberTypeArrayPtr ContactConverter::toContactPhoneNumberTypeArray(const JSValueRef &jsValue)
@@ -1301,7 +1499,20 @@ JSValueRef ContactConverter::toJSValueRef(ContactEmailAddressType arg)
 
 JSValueRef ContactConverter::toJSValueRef(const ContactEmailAddressTypeArrayPtr &arg)
 {
-       return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(m_context, JSContactEmailAddressTypeArray::getClassRef(), arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 ContactEmailAddressTypeArrayPtr ContactConverter::toContactEmailAddressTypeArray(const JSValueRef &jsValue)
@@ -1345,7 +1556,20 @@ StringArrayPtr ContactConverter::toStringArray(const JSValueRef &jsValue)
 
 JSValueRef ContactConverter::toJSValueRef(const StringArrayPtr &arg)
 {
-       return JSStringArray::createArray(m_context, arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject)
+               ThrowMsg(ConversionException, "Can not create array object.");
+
+       for(int i = 0; i < size; i++)
+       {
+               JSValueRef jsvalue = toJSValueRef(arg->at(i));
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue))
+                       ThrowMsg(ConversionException, "Can not add object to array.");
+       }
+
+       return static_cast<JSValueRef>(resultObject);
 }
 
 //std::string ContactConverter::toAttributesOfInterest(const JSValueRef &value)
index 867dd8d..433e41b 100755 (executable)
@@ -32,10 +32,19 @@ ContactEmailAddress::ContactEmailAddress() :
                m_isDefault(false)
 {
        m_types = ContactEmailAddressTypeArrayPtr(new ContactEmailAddressTypeArray());
+       is_typesSetJSArray = false;
+       m_context = NULL;
+       m_typesJsValue = NULL;
+       m_typesObj = NULL;
 }
 
 ContactEmailAddress::~ContactEmailAddress()
 {
+       if(IsTypesSetJSArray()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getTypesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 
 std::string ContactEmailAddress::getEmail() const
@@ -122,5 +131,37 @@ ContactEmailAddressPtr ContactEmailAddress::clone() const
        return result;
 }
 
+void ContactEmailAddress::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+       is_typesSetJSArray = value;
+       m_typesObj = initValue;
+}
+
+JSValueRef ContactEmailAddress::getTypesJSArray()
+{
+       return m_typesJsValue;
+}
+
+JSObjectRef ContactEmailAddress::getTypesJSObj()
+{
+       return m_typesObj;
+}
+
+bool ContactEmailAddress::IsTypesSetJSArray() const
+{
+       return is_typesSetJSArray;
+}
+
+void ContactEmailAddress::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef ContactEmailAddress::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI
index 4b8721e..b470b7c 100755 (executable)
@@ -30,6 +30,7 @@
 #include <string>
 #include <dpl/shared_ptr.h>
 #include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
 
 namespace DeviceAPI {
 namespace Contact {
@@ -66,6 +67,14 @@ public:
        void clear();
        ContactEmailAddressPtr clone() const;
 
+       void setTypesJSArray(bool value, JSObjectRef initValue);
+       JSValueRef getTypesJSArray();
+       JSObjectRef getTypesJSObj();
+       bool IsTypesSetJSArray() const;
+
+       void setContext(JSContextRef contextRef);
+       JSContextRef getContext();
+
 private:
        std::string     m_email;
        bool            m_emailIsSet;
@@ -73,6 +82,12 @@ private:
        bool            m_isDefault;
 
        ContactEmailAddressTypeArrayPtr m_types;
+
+       bool is_typesSetJSArray;
+       JSValueRef m_typesJsValue;
+       JSObjectRef m_typesObj;
+
+       JSContextRef m_context;
 };
 
 } // Contact
index e892926..1c694e1 100755 (executable)
@@ -38,10 +38,19 @@ ContactName::ContactName() :
                m_displayNameIsSet(false)
 {
        m_nicknames = StringArrayPtr(new StringArray());
+       is_typesSetJSArray = false;
+       m_context = NULL;
+       m_typesJsValue = NULL;
+       m_typesObj = NULL;
 }
 
 ContactName::~ContactName()
 {
+       if(IsTypesSetJSArray()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getTypesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 
 std::string ContactName::getPrefix() const
@@ -316,5 +325,37 @@ ContactNamePtr ContactName::clone() const
        return result;
 }
 
+void ContactName::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+       is_typesSetJSArray = value;
+       m_typesObj = initValue;
+}
+
+JSValueRef ContactName::getTypesJSArray()
+{
+       return m_typesJsValue;
+}
+
+JSObjectRef ContactName::getTypesJSObj()
+{
+       return m_typesObj;
+}
+
+bool ContactName::IsTypesSetJSArray() const
+{
+       return is_typesSetJSArray;
+}
+
+void ContactName::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef ContactName::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI
index 894db20..6230f87 100755 (executable)
@@ -28,6 +28,7 @@
 #include <vector>
 #include <string>
 #include <dpl/shared_ptr.h>
+#include <JavaScriptCore/JavaScript.h>
 #include "ContactTypes.h"
 
 namespace DeviceAPI {
@@ -94,6 +95,14 @@ public:
        void clear();
        ContactNamePtr clone() const;
 
+       void setTypesJSArray(bool value, JSObjectRef initValue);
+       JSValueRef getTypesJSArray();
+       JSObjectRef getTypesJSObj();
+       bool IsTypesSetJSArray() const;
+
+       void setContext(JSContextRef contextRef);
+       JSContextRef getContext();
+
 private:
        std::string     m_prefix;
        bool            m_prefixIsSet;
@@ -120,6 +129,12 @@ private:
 
        std::string     m_displayName;
        bool            m_displayNameIsSet;
+
+       bool is_typesSetJSArray;
+       JSValueRef m_typesJsValue;
+       JSObjectRef m_typesObj;
+
+       JSContextRef m_context;
 };
 
 } // Contact
index d5cfa62..d0db2bc 100755 (executable)
@@ -662,15 +662,19 @@ void ContactObjectA2PConverter::importCompanyList()
                        }
                }
 
+               LogDebug("organization->getLogoURIIsSet() : " << organization->getLogoURIIsSet());
                // ContactOrganization.logoURI
                if(organization->getLogoURIIsSet())
                {
+                       LogDebug("organization->getLogoURI() : " << organization->getLogoURI());
                        string logoURI = organization->getLogoURI();
                        if(!logoURI.empty())
                        {
-                               logoURI = ContactUtility::convertUriToPath(logoURI);
+//                             logoURI = ContactUtility::convertUriToPath(logoURI);
+                               LogDebug("logoURI.c_str() : " << logoURI.c_str());
 
                                errorCode = contacts_record_set_str(child_record, _contacts_company.logo, logoURI.c_str());
+                               LogDebug("errorCode : " << errorCode);
                                if(errorCode != CONTACTS_ERROR_NONE)
                                {
                                        LogWarning("importing logoURI N (err:" << errorCode << ", str:" << logoURI << ")");
index a01a8ad..91ad6de 100755 (executable)
@@ -34,10 +34,19 @@ ContactPhoneNumber::ContactPhoneNumber() :
                m_isDefault(false)
 {
        m_types = ContactPhoneNumberTypeArrayPtr(new ContactPhoneNumberTypeArray());
+       is_typesSetJSArray = false;
+       m_context = NULL;
+       m_typesJsValue = NULL;
+       m_typesObj = NULL;
 }
 
 ContactPhoneNumber::~ContactPhoneNumber()
 {
+       if(IsTypesSetJSArray()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getTypesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 
 std::string ContactPhoneNumber::getNumber() const
@@ -127,5 +136,37 @@ ContactPhoneNumberPtr ContactPhoneNumber::clone() const
        return result;
 }
 
+void ContactPhoneNumber::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+       is_typesSetJSArray = value;
+       m_typesObj = initValue;
+}
+
+JSObjectRef ContactPhoneNumber::getTypesJSObj()
+{
+       return m_typesObj;
+}
+
+JSValueRef ContactPhoneNumber::getTypesJSArray()
+{
+       return m_typesJsValue;
+}
+
+bool ContactPhoneNumber::IsTypesSetJSArray() const
+{
+       return is_typesSetJSArray;
+}
+
+void ContactPhoneNumber::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef ContactPhoneNumber::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI
index a2c2256..ac1445f 100755 (executable)
@@ -30,6 +30,7 @@
 #include <vector>
 #include <dpl/shared_ptr.h>
 #include "ContactTypes.h"
+#include <JavaScriptCore/JavaScript.h>
 
 namespace DeviceAPI {
 namespace Contact {
@@ -67,6 +68,14 @@ public:
        void clear();
        ContactPhoneNumberPtr clone() const;
 
+       void setTypesJSArray(bool value, JSObjectRef initValue);
+       JSValueRef getTypesJSArray();
+       JSObjectRef getTypesJSObj();
+       bool IsTypesSetJSArray() const;
+
+       void setContext(JSContextRef contextRef);
+       JSContextRef getContext();
+
 private:
        std::string     m_number;
        bool            m_numberIsSet;
@@ -74,6 +83,12 @@ private:
        bool            m_isDefault;
 
        ContactPhoneNumberTypeArrayPtr m_types;
+
+       bool is_typesSetJSArray;
+       JSValueRef m_typesJsValue;
+       JSObjectRef m_typesObj;
+
+       JSContextRef m_context;
 };
 
 } // Contact
index a145a17..c00f48c 100755 (executable)
@@ -270,6 +270,7 @@ JSValueRef JSAddressBook::get(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -277,6 +278,8 @@ JSValueRef JSAddressBook::get(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
+
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
@@ -294,7 +297,7 @@ JSValueRef JSAddressBook::get(JSContextRef context,
 
        string id;
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                id = converter->toString(arguments[0]);
        } Catch(Exception) {
@@ -357,6 +360,7 @@ JSValueRef JSAddressBook::add(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -364,6 +368,7 @@ JSValueRef JSAddressBook::add(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
@@ -386,7 +391,7 @@ JSValueRef JSAddressBook::add(JSContextRef context,
 
        ContactPtr contact(NULL);
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                contact = converter->toContact(arguments[0]);
        } Catch(Exception) {
@@ -542,6 +547,7 @@ JSValueRef JSAddressBook::update(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -549,6 +555,7 @@ JSValueRef JSAddressBook::update(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
@@ -571,7 +578,7 @@ JSValueRef JSAddressBook::update(JSContextRef context,
 
        ContactPtr contact(NULL);
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                contact = converter->toContact(arguments[0]);
        } Catch(Exception) {
@@ -730,6 +737,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -737,6 +745,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object");
@@ -753,7 +762,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context,
 
        string contactId;
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                contactId = converter->toString(arguments[0]);
        }
@@ -1264,6 +1273,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -1271,6 +1281,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception,
@@ -1289,7 +1300,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context,
 
        string id;
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                id = converter->toString(arguments[0]);
        } Catch(Exception) {
@@ -1358,6 +1369,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -1365,6 +1377,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception,
@@ -1389,7 +1402,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context,
 
        ContactGroupPtr group(NULL);
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                group = converter->toContactGroup(arguments[0]);
        } Catch(Exception) {
@@ -1439,6 +1452,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -1446,6 +1460,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception,
@@ -1470,7 +1485,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context,
 
        ContactGroupPtr contact(NULL);
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                contact = converter->toContactGroup(arguments[0]);
        } Catch(Exception) {
@@ -1527,6 +1542,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -1534,6 +1550,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception,
@@ -1552,7 +1569,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context,
 
        string groupId;
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
        Try     {
                groupId = converter->toString(arguments[0]);
        }
@@ -1611,6 +1628,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
        LogDebug("entered");
        AddressBookPtr addressBook;
        AddressBookController *controller;
+       JSContextRef gContext;
 
        Try     {
                controller = static_cast<AddressBookController*>(JSObjectGetPrivate(thisObject));
@@ -1618,6 +1636,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "No private object.");
                }
                addressBook = controller->getObject();
+               gContext = controller->getContext();
        } Catch(Exception) {
                LogError("No private object");
                return JSTizenExceptionFactory::postException(context, exception,
@@ -1629,7 +1648,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context,
 
        string id;
 
-       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+       ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
 
        EventAddressBookGetGroupsPtr dplEvent(new EventAddressBookGetGroups());
 
index 9d1de73..92b9c11 100755 (executable)
@@ -32,6 +32,7 @@
 #include "plugin_config.h"
 #include "ContactConverter.h"
 #include "JSContact.h"
+#include "Contact.h"
 
 #define FILTER_CLASS_NAME "Contact"
 
@@ -419,8 +420,13 @@ JSValueRef JSContact::getName(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
                ContactNamePtr contactName = contact->getName();
                if(contactName == NULL)
@@ -445,10 +451,8 @@ bool JSContact::setName(JSContextRef context,
        Try
        {
                ContactPtr contact = getPrivData(object);
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
-               BasicValidator validator =
-                               BasicValidatorFactory::getValidator(context, exception);
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
+               BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
                if(validator->isNullOrUndefined(value))
                        contact->unsetName();
                else
@@ -471,8 +475,13 @@ JSValueRef JSContact::getAddresses(JSContextRef context,
 {
        Try
        {
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
                ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+                               ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
                return converter->toJSValueRef(contact->getAddresses());
        }
@@ -565,8 +574,13 @@ JSValueRef JSContact::getPhoneNumbers(JSContextRef context,
 {
        Try
        {
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
                ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+                               ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
                return converter->toJSValueRef(contact->getPhoneNumbers());
        }
@@ -609,8 +623,14 @@ JSValueRef JSContact::getEmails(JSContextRef context,
 {
        Try
        {
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
                ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+                               ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
                return converter->toJSValueRef(contact->getEmails());
        }
@@ -791,10 +811,30 @@ JSValueRef JSContact::getNotes(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getNotes());
+
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+               if(newContactT->notesJSObjIsSet()){
+                       return newContactT->getNotesJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getNotesJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getNotes());
+
+                       JSObjectRef convertedJSObject = newContactT->getNotesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setNotesJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -928,10 +968,31 @@ JSValueRef JSContact::getGroupIds(JSContextRef context,
 {
        Try
        {
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
                ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+                               ContactConverterFactory::getConverter(gContext);
                ContactPtr contact = getPrivData(object);
-               return converter->toJSValueRef(contact->getGroupIds());
+               DPL::SharedPtr<Contact> newContactT = DPL::StaticPointerCast<Contact>(contact);
+
+               if(newContactT->groupIdsJSObjIsSet()){
+                       return newContactT->getGroupIdsJSObj();
+               }else{
+                       JSValueRef tempJSValue = newContactT->getGroupIdsJSValue();
+                       tempJSValue = converter->toJSValueRef(newContactT->getGroupIds());
+
+                       JSObjectRef convertedJSObject = newContactT->getGroupIdsJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       newContactT->setGroupIdsJSObj(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       newContactT->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -1070,7 +1131,12 @@ JSValueRef JSContact::clone(JSContextRef context,
 
        JSValueRef result;
        Try {
-               result = createJSObject(context, clonedContact);
+               JSContactPriv *priv = static_cast<JSContactPriv*>(JSObjectGetPrivate(thisObject));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+               result = createJSObject(gContext, clonedContact);
        } Catch(Exception) {
                LogError("Error on conversion : " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error");
index 57a765c..d59fc32 100755 (executable)
@@ -582,11 +582,28 @@ JSValueRef JSContactAddress::getTypes(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactAddressPriv *priv = static_cast<JSContactAddressPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactAddressPtr contactAddress = getPrivData(object);
 
-               return converter->toJSValueRef(contactAddress->getTypes());
+               if(contactAddress->IsTypesSetJSArray()){
+                       return contactAddress->getTypesJSObj();
+               }else{
+                       JSValueRef tempJSValue = contactAddress->getTypesJSArray();
+                       tempJSValue = converter->toJSValueRef(contactAddress->getTypes());
+
+                       JSObjectRef convertedJSObject = contactAddress->getTypesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       contactAddress->setTypesJSArray(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       contactAddress->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
index e143e9a..af4fc69 100755 (executable)
@@ -347,10 +347,29 @@ JSValueRef JSContactEmailAddress::getTypes(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactEmailAddressPriv *priv = static_cast<JSContactEmailAddressPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactEmailAddressPtr emailAddress = getPrivData(object);
-               return JSContactEmailAddressTypeArray::createArray(context, emailAddress->getTypes());
+
+               if(emailAddress->IsTypesSetJSArray()){
+                       return emailAddress->getTypesJSObj();
+               }else{
+                       JSValueRef tempJSValue = emailAddress->getTypesJSArray();
+                       tempJSValue = converter->toJSValueRef(emailAddress->getTypes());
+
+                       JSObjectRef convertedJSObject = emailAddress->getTypesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       emailAddress->setTypesJSArray(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       emailAddress->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
index 9531516..6ac722b 100755 (executable)
@@ -503,10 +503,29 @@ JSValueRef JSContactName::getNicknames(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactNamePriv *priv = static_cast<JSContactNamePriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+
+               ContactConverterFactory::ConverterType converter =      ContactConverterFactory::getConverter(gContext);
                ContactNamePtr contactName = getPrivData(object);
-               return converter->toJSValueRef(contactName->getNicknames());
+
+               if(contactName->IsTypesSetJSArray()){
+                       return contactName->getTypesJSObj();
+               }else{
+                       JSValueRef tempJSValue = contactName->getTypesJSArray();
+                       tempJSValue = converter->toJSValueRef(contactName->getNicknames());
+
+                       JSObjectRef convertedJSObject = contactName->getTypesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       contactName->setTypesJSArray(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       contactName->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
index 06a1ef0..822091d 100755 (executable)
@@ -472,16 +472,15 @@ bool JSContactOrganization::setLogoURI(JSContextRef context,
 {
        Try
        {
-               // NOTE: Currently not support this field
-//             ContactOrganizationPtr organization = getPrivData(object);
-//             ContactConverterFactory::ConverterType converter =
-//                             ContactConverterFactory::getConverter(context);
-//             BasicValidator validator =
-//                             BasicValidatorFactory::getValidator(context, exception);
-//             if(validator->isNullOrUndefined(value))
-//                     organization->unsetLogoURI();
-//             else
-//                     organization->setLogoURI(converter->toString(value));
+               ContactOrganizationPtr organization = getPrivData(object);
+               ContactConverterFactory::ConverterType converter =
+                               ContactConverterFactory::getConverter(context);
+               BasicValidator validator =
+                               BasicValidatorFactory::getValidator(context, exception);
+               if(validator->isNullOrUndefined(value))
+                       organization->unsetLogoURI();
+               else
+                       organization->setLogoURI(converter->toString(value));
                return true;
        }
        Catch(WrtDeviceApis::Commons::Exception)
index cee777f..5fd9374 100755 (executable)
@@ -350,11 +350,28 @@ JSValueRef JSContactPhoneNumber::getTypes(JSContextRef context,
 {
        Try
        {
-               ContactConverterFactory::ConverterType converter =
-                               ContactConverterFactory::getConverter(context);
+               JSContactPhoneNumberPriv *priv = static_cast<JSContactPhoneNumberPriv*>(JSObjectGetPrivate(object));
+               if (!priv) {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null");
+               }
+               JSContextRef gContext = priv->getContext();
+               ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(gContext);
                ContactPhoneNumberPtr contactPhoneNumber = getPrivData(object);
 
-               return converter->toJSValueRef(contactPhoneNumber->getTypes());
+               if(contactPhoneNumber->IsTypesSetJSArray()){
+                       return contactPhoneNumber->getTypesJSObj();
+               }else{
+                       JSValueRef tempJSValue = contactPhoneNumber->getTypesJSArray();
+                       tempJSValue = converter->toJSValueRef(contactPhoneNumber->getTypes());
+
+                       JSObjectRef convertedJSObject = contactPhoneNumber->getTypesJSObj();
+                       convertedJSObject = JSValueToObject( gContext, tempJSValue, NULL );
+                       contactPhoneNumber->setTypesJSArray(true, convertedJSObject);
+
+                       JSValueProtect(gContext, convertedJSObject);
+                       contactPhoneNumber->setContext(gContext);
+                       return tempJSValue;
+               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
index 77aa8ac..b27054b 100755 (executable)
@@ -2,14 +2,12 @@ SET(TARGET_NAME ${content_target})
 SET(DESTINATION_NAME ${content_dest})
 SET(TARGET_IMPL_NAME ${content_impl})
 
-PKG_SEARCH_MODULE(mediacontent REQUIRED capi-content-media-content)
-PKG_SEARCH_MODULE(extractor REQUIRED capi-media-metadata-extractor)
+PKG_CHECK_MODULES(platform_pkgs_content REQUIRED capi-content-media-content capi-media-metadata-extractor)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/Tizen
-       ${mediacontent_INCLUDE_DIRS}
-       ${extractor_INCLUDE_DIRS}
+       ${platform_pkgs_content_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -47,10 +45,11 @@ SET(SRCS_IMPL
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${mediacontent_LIBRARIES}
-       ${extractor_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_content_LIBRARIES}
 )
 
 SET(SRCS
@@ -59,15 +58,14 @@ SET(SRCS
 )
 
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
+
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${tizen_impl}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/content
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/content
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 50efbae..d735276 100755 (executable)
@@ -25,10 +25,10 @@ namespace Content{
 
 static PropertyStructArray folderProperties =
 {
-       {"id",                          PrimitiveType_String},
+       {"id",                                  PrimitiveType_String},
        {"directoryURI",                PrimitiveType_String},
        {"storageType",                 PrimitiveType_String},
-       {"title",                       PrimitiveType_String},
+       {"title",                               PrimitiveType_String},
        {"modifiedDate",                PrimitiveType_Time},
        {0,     PrimitiveType_NoType}
 };
@@ -37,12 +37,12 @@ static PropertyStructArray mediaProperties =
 {
        {"id",                          PrimitiveType_String},
        {"type",                        PrimitiveType_String},
-       {"mimeType",                    PrimitiveType_String},
+       {"mimeType",            PrimitiveType_String},
        {"name",                        PrimitiveType_String},
        {"title",                       PrimitiveType_String},
-       {"contentURI",                  PrimitiveType_String},
-       {"thumbnailURIs",               PrimitiveType_String},
-       {"description",                 PrimitiveType_String},  
+       {"contentURI",          PrimitiveType_String},
+       {"thumbnailURIs",       PrimitiveType_String},
+       {"description",         PrimitiveType_String},
        {"rating",                      PrimitiveType_Int},     
        {"releasedDate",                PrimitiveType_Time},
        {"modifiedDate",                PrimitiveType_Time},
@@ -52,7 +52,7 @@ static PropertyStructArray mediaProperties =
        {"artists",                     PrimitiveType_String},  
        {"width",                       PrimitiveType_String},  
        {"height",                      PrimitiveType_String},                  
-       {"genres",                      PrimitiveType_String},                  
+       {"genres",                      PrimitiveType_String},
        {0, PrimitiveType_NoType}
 
 };
index efbb3b2..75791db 100755 (executable)
@@ -40,8 +40,8 @@ ContentListener::ContentListener(JSContextRef globalCtx, JSObjectRef object)
 {\r
        m_callback = new MultiCallbackUserData(globalCtx);\r
 \r
-       LOGD("[DENNIS] %s:%d, thread_id=%ld", __FUNCTION__, __LINE__, pthread_self());\r
-       LOGD("[DENNIS] %s:%d, context=%p", __FUNCTION__, __LINE__, globalCtx);\r
+       LOGD("%s:%d, thread_id=%ld", __FUNCTION__, __LINE__, pthread_self());\r
+       LOGD("%s:%d, context=%p", __FUNCTION__, __LINE__, globalCtx);\r
 \r
        Validator validator(globalCtx);\r
 \r
@@ -122,6 +122,7 @@ void ContentListener::oncontentadded(MediacontentMediaPtr content)
 \r
 void ContentListener::oncontentupdated(MediacontentMediaPtr content)\r
 {\r
+\r
        JSContextRef context = m_callback->getContext();\r
 \r
        MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context);\r
index 2355f3c..4e3d5b2 100755 (executable)
@@ -966,7 +966,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse
                                LogError("media_filter_create Error: " << ret);
                        }
                }
-               
+
        }
        catch(const Exception &ex){
                        LogError("Exception: " << ex.DumpToString());
@@ -975,11 +975,11 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse
        }
 
 
-       
+
 }
 
 bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
-{      
+{
        string type  = mediaPtr->getMediaType();        //media type.
        string mediaId = mediaPtr->getMediaUUID();
 
@@ -1018,7 +1018,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                if(type.compare("IMAGE") ==0 )
                {
                        MediacontentImagePtr imagePtr = DPL::DynamicPointerCast<MediacontentImage>(mediaPtr);
-                       
+
                        if(imagePtr && (imagePtr->isChangedOrientaion() 
                                || imagePtr->isChangedLatitude() || imagePtr->isChangedLongitude()))
                        {
@@ -1034,37 +1034,37 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                        ret = false;
                                                }
                                        }
-                       
-                                               if ( MEDIA_CONTENT_ERROR_NONE != 
-                                                       media_info_set_latitude(media, imagePtr->getImageLatitude())
-                                                       )
-                                               {
-                                                       LogDebug("Error: set Latitude"); 
-                                                       ret = false;
-                                               }
 
-                                               if ( MEDIA_CONTENT_ERROR_NONE != 
-                                                       media_info_set_longitude(media, imagePtr->getImageLongitude())
-                                                       )
-                                               {
-                                                       LogDebug("Error: set Longitude");
-                                                       ret = false;
-                                               }
+                                       if ( MEDIA_CONTENT_ERROR_NONE != 
+                                               media_info_set_latitude(media, imagePtr->getImageLatitude())
+                                               )
+                                       {
+                                               LogDebug("Error: set Latitude"); 
+                                               ret = false;
+                                       }
+
+                                       if ( MEDIA_CONTENT_ERROR_NONE != 
+                                               media_info_set_longitude(media, imagePtr->getImageLongitude())
+                                               )
+                                       {
+                                               LogDebug("Error: set Longitude");
+                                               ret = false;
+                                       }
 
                                        if ( MEDIA_CONTENT_ERROR_NONE != image_meta_update_to_db (img) )
                                        {
                                                LogDebug("Error: update db");
                                                ret = false;
                                        }
-                                                                       
+
                                        if ( MEDIA_CONTENT_ERROR_NONE != image_meta_destroy(img))
                                        {
                                                LogDebug("Error: destroy media info");  
                                                ret = false;
                                        }
-                                       
+
                                        img = NULL;
-                                       
+
                                }
                                else
                                {
@@ -1076,7 +1076,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                }
 
                if(type.compare("VIDEO") ==0 )
-               {       
+               {
                        MediacontentVideoPtr videoPtr = DPL::DynamicPointerCast<MediacontentVideo>(mediaPtr);
                        if (videoPtr && ( videoPtr->isChangedArtists () ||  videoPtr->isChangedAlbum() 
                                || videoPtr->isChangedLatitude() ||videoPtr->isChangedLongitude()) )
@@ -1085,7 +1085,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                video_meta_h video = NULL;
                                if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_video(media, &video))
                                {
-#if 0 //NOT support                            
+#if 0 //NOT support
                                        if (  videoPtr->isChangedPlayCount() )
                                        {
                                                if ( MEDIA_CONTENT_ERROR_NONE != 
@@ -1093,10 +1093,10 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                {
                                                        LogDebug("Error: set play count"); 
                                                        ret = false;
-                                                       
+
                                                }       
                                        }
-                                       
+
                                        if (videoPtr->isChangedPlayedTime())
                                        {
                                                if ( MEDIA_CONTENT_ERROR_NONE != 
@@ -1118,30 +1118,30 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                LogDebug("Not support - Artist API"); 
                                                ret = false;
                                        }
-#endif                                                                 
-                                               if ( MEDIA_CONTENT_ERROR_NONE != 
-                                                       media_info_set_latitude(media, videoPtr->getVideoLatitude())
-                                                       )
-                                               {
-                                                       LogDebug("Error: set Latitude"); 
-                                                       ret = false;
-                                               }
+#endif
+                                       if ( MEDIA_CONTENT_ERROR_NONE != 
+                                               media_info_set_latitude(media, videoPtr->getVideoLatitude())
+                                               )
+                                       {
+                                               LogDebug("Error: set Latitude");
+                                               ret = false;
+                                       }
+
+                                       if ( MEDIA_CONTENT_ERROR_NONE != 
+                                               media_info_set_longitude(media, videoPtr->getVideoLongitude())
+                                               )
+                                       {
+                                               LogDebug("Error: set Latitude");
+                                               ret = false;
+                                       }
 
-                                               if ( MEDIA_CONTENT_ERROR_NONE != 
-                                                       media_info_set_longitude(media, videoPtr->getVideoLongitude())
-                                                       )
-                                               {
-                                                       LogDebug("Error: set Latitude"); 
-                                                       ret = false;
-                                               }                                               
 
-                                       
                                        if ( MEDIA_CONTENT_ERROR_NONE != video_meta_update_to_db (video) )
                                        {
                                                LogDebug("Error: update db");
                                                ret = false;
                                        }
-                                       
+
                                        if ( MEDIA_CONTENT_ERROR_NONE != video_meta_destroy(video))
                                        {
                                                LogDebug("Error: destroy video meta");  
@@ -1149,17 +1149,17 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                        }
 
                                        video = NULL;
-                                       
-                               }                               
+
+                               }
                        }
-                       
+
                } //video
 
-               
+
 
                if(type.compare("AUDIO") ==0 )
                {
-                       
+
                        MediacontentAudioPtr audioPtr = DPL::DynamicPointerCast<MediacontentAudio>(mediaPtr);
                        if (audioPtr && ( audioPtr->isChangedAudioArtist () ||  audioPtr->isChangedAudioAlbum() 
                                || audioPtr->isChangedAudioGenre() ||audioPtr->isChangedAudioComposer()
@@ -1169,7 +1169,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                audio_meta_h audio=NULL;
                                if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_audio(media, &audio))
                                {
-#if 0 //NOT support                            
+#if 0 //NOT support
                                        if (  audioPtr->isChangedPlayCount() )
                                        {
                                                if ( MEDIA_CONTENT_ERROR_NONE != 
@@ -1177,9 +1177,9 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr)
                                                {
                                                        LogDebug("Error: set play count"); 
                                                        ret = false;
-                                               }       
+                                               }
                                        }
-                                       
+
                                        if (audioPtr->isChangedPlayedTime())
                                        {
                                                if ( MEDIA_CONTENT_ERROR_NONE != 
index 8592f39..e164fa8 100755 (executable)
@@ -77,8 +77,8 @@ class MediacontentMedia
        virtual void setMimeType(const string &value);
        virtual void setDisplayName(const string &value, bool isChanged=false);
        virtual void setTitle(const string &value);
-       virtual void setFilePath(const string &value);  
-       virtual void setThumbnailPath(const string &value);     
+       virtual void setFilePath(const string &value);
+       virtual void setThumbnailPath(const string &value);
        virtual void setCreatedDate(const tm &value);
        virtual void setReleasedDate(const tm &value);
        virtual void setModifiedDate(const tm &value);  
index 1739217..a65e858 100755 (executable)
@@ -53,33 +53,33 @@ map<string, string> MediaSearchVisitor::attrFolderEnumMap = {
                {"id",                  "id"},
                {"directoryURI",        "FOLDER_PATH"},
                {"title",               "FOLDER_NAME"},
-               {"storageType",         "FOLDER_STORAGE_TYPE"},         
-               {"modifiedDate",        "FOLDER_MODIFIED_TIME"},                                
+               {"storageType",         "FOLDER_STORAGE_TYPE"},
+               {"modifiedDate",        "FOLDER_MODIFIED_TIME"},
 };
 
 map<string, string> MediaSearchVisitor::attrMediaEnumMap = {
 //media item attribues.
-               {"id",                          "MEDIA_ID"},
-               {"type",                        "MEDIA_TYPE"},
+               {"id",                  "MEDIA_ID"},
+               {"type",                "MEDIA_TYPE"},
                {"mimeType",            "MEDIA_MIME_TYPE"},
                {"name",                "MEDIA_DISPLAY_NAME"},
-               {"title",                       "MEDIA_TITLE"},
+               {"title",               "MEDIA_TITLE"},
                {"contentURI",          "MEDIA_PATH"},
                {"thumbnailURIs",       "MEDIA_THUMBNAIL_PATH"},
                {"description",         "MEDIA_DESCRIPTION"},
-               {"rating",                      "MEDIA_RATING"},
+               {"rating",              "MEDIA_RATING"},
                {"createdDate",         "MEDIA_ADDED_TIME"},
                {"releaseDate",         "MEDIA_DATETAKEN"},
-               {"modifiedDate",        "MEDIA_MODIFIED_TIME"},         
+               {"modifiedDate",        "MEDIA_MODIFIED_TIME"},
 //media image,video,audio attribues.
                {"geolocation.latitude",        "MEDIA_LATITUDE"},
                {"geolocation.longitude",       "MEDIA_LONGITUDE"},
-               {"album",                       "MEDIA_ALBUM"},
-               {"artists",                     "MEDIA_ARTIST"},
-               {"width",                       "MEDIA_WIDTH"},
-               {"height",                      "MEDIA_HEIGHT"},
-               {"genres",                      "MEDIA_GENRE"},
-               {"size",                        "MEDIA_SIZE"},
+               {"album",               "MEDIA_ALBUM"},
+               {"artists",             "MEDIA_ARTIST"},
+               {"width",               "MEDIA_WIDTH"},
+               {"height",              "MEDIA_HEIGHT"},
+               {"genres",              "MEDIA_GENRE"},
+               {"size",                "MEDIA_SIZE"},
 
 };
 
@@ -125,7 +125,7 @@ string MediaSearchVisitor::getPlatformAttr(string attrName)
        if( queryType == QUERY_FOLDER)
        {
                pos = attrFolderEnumMap.find(attrName);
-               
+
                if(attrFolderEnumMap.end() != pos)
                {
                        platformAttr = pos->second;
@@ -138,7 +138,7 @@ string MediaSearchVisitor::getPlatformAttr(string attrName)
        else if(queryType == QUERY_MEDIA)
        {
                pos = attrMediaEnumMap.find(attrName);
-               
+
                if(attrMediaEnumMap.end() != pos)
                {
                        platformAttr = pos->second;
@@ -247,7 +247,7 @@ string MediaSearchVisitor::convertAttribute(string &attrName, AnyPtr& matchValue
                valueStr = os.str();
        }
        operatorStr = operatorKey[cond];
-               conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
+       conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
 
        return conditionStr;
 }
index 7de0345..24bb722 100755 (executable)
@@ -157,6 +157,7 @@ bool IMediacontentManager::scanFile(scanCompletedCallback callback, std::string
 static bool mediaItemCallback(media_info_h info, void* user_data)
 {
        media_content_type_e type;
+       LogDebug("mediaItemCallback is called");
 
        if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_media_type( info, &type) )
        {
@@ -192,6 +193,7 @@ static void content_notification_cb(
                                                                        char *mime_type,
                                                                        void *user_data)
 {
+
        ContentListener *listener = static_cast<ContentListener*>(user_data);
        std::string err_msg;
        if( error == MEDIA_CONTENT_ERROR_NONE)
@@ -199,13 +201,11 @@ static void content_notification_cb(
                err_msg = "";
                if( update_item == MEDIA_ITEM_FILE)
                {
-                       string uuid = uuid;
-                       string path = path;
-                       string condition = "MEDIA_ID=";
+                       string condition = "MEDIA_ID=\"";
                        condition += uuid;
+                       condition += "\"";
 
                        MediacontentMedia *p_content;
-
                        if(update_type == MEDIA_CONTENT_INSERT)
                        {
                                filter_h filter = NULL;
@@ -240,6 +240,7 @@ static void content_notification_cb(
                        }
                        else if(update_type == MEDIA_CONTENT_UPDATE)
                        {
+
                                filter_h filter = NULL;
                                if ( MEDIA_CONTENT_ERROR_NONE == media_filter_create(&filter))
                                {
@@ -270,7 +271,6 @@ static void content_notification_cb(
                                        media_filter_destroy(filter);
                                }
 
-
                        }
                        else if(update_type == MEDIA_CONTENT_DELETE)
                        {
index a26eab7..2e9267b 100755 (executable)
@@ -34,7 +34,7 @@ namespace Content {
 #define TIZEN_CONTENT_MEDIA_TYPE                       "type"
 #define TIZEN_CONTENT_MEDIA_MIME_TYPE                  "mimeType"
 #define TIZEN_CONTENT_MEDIA_NAME                       "name"
-#define TIZEN_CONTENT_MEDIA_TITLE                              "title"
+#define TIZEN_CONTENT_MEDIA_TITLE                      "title"
 #define TIZEN_CONTENT_MEDIA_FILE_URL                   "contentURI"
 #define TIZEN_CONTENT_MEDIA_THUMBNAILPATH              "thumbnailURIs"
 #define TIZEN_CONTENT_MEDIA_RELEASEDDATE               "releaseDate"
index e87dc9f..9f29a6b 100755 (executable)
@@ -116,7 +116,7 @@ class JSMedia
 
        static JSValueRef   getPropertyDescription(
                                                JSContextRef context,
-                                               JSObjectRef object, 
+                                               JSObjectRef object,
                                                JSStringRef propertyName, 
                                                JSValueRef* exception);
 
index 86f1ab7..eb4786d 100755 (executable)
@@ -2,10 +2,10 @@ SET(TARGET_NAME ${datacontrol_target})
 SET(DESTINATION_NAME ${datacontrol_dest})
 SET(TARGET_IMPL_NAME ${datacontrol_impl})
 
-PKG_SEARCH_MODULE(platform REQUIRED capi-appfw-application appsvc pkgmgr)
+PKG_CHECK_MODULES(platform_pkgs_datacontrol REQUIRED capi-appfw-application appsvc pkgmgr)
 
 INCLUDE_DIRECTORIES(
-       ${platform_INCLUDE_DIRS}
+       ${platform_pkgs_datacontrol_INCLUDE_DIRS}
        ${TOP}/Common
 )
 
@@ -23,7 +23,7 @@ SET(SRCS_IMPL
        MappedDataControlConsumer.cpp
        SelectDataObject.cpp
        SqlDataControlConsumer.cpp
-       SelectDataObject.cpp    
+       SelectDataObject.cpp
        DataControlConverter.cpp
        DataControlListener.cpp
        JSDataControlManager.cpp
@@ -37,7 +37,8 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${platform_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_datacontrol_LIBRARIES}
 )
 
 SET(SRCS
@@ -49,12 +50,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${tizen_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/datacontrol
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/datacontrol
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index c123211..5a2d76e 100755 (executable)
@@ -262,15 +262,5 @@ JSValueRef DataSyncConverter::toJSValueRefSyncStatisticsList(const SyncStatistic
     return toJSValueRef_(*arg, &DataSyncConverter::toJSValueRefSyncStatistics, this);
 }
 
-JSValueRef DataSyncConverter::toFunctionOrNull(const JSValueRef& arg)
-{
-    if (Validator(m_context).isCallback(arg)) {
-        return arg;
-    } else if (!JSValueIsNull(m_context, arg) && !JSValueIsUndefined(m_context, arg)) {
-        ThrowMsg(ConversionException, "Not a function nor JS null.");
-    }
-    return NULL;
-}
-
 }
 }
index d20301d..8b8c44b 100755 (executable)
@@ -62,8 +62,6 @@ class DataSyncConverter : public WrtDeviceApis::CommonsJavaScript::Converter
 
     JSValueRef toJSValueRefSyncStatistics(const SyncStatisticsPtr &arg);
     JSValueRef toJSValueRefSyncStatisticsList(const SyncStatisticsListPtr &arg);
-
-    JSValueRef toFunctionOrNull(const JSValueRef& arg);
 };
 
 }
index b0a69a3..11774eb 100755 (executable)
@@ -66,6 +66,7 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use
         OnDataSyncStateChangedPtr eventPtr(new OnDataSyncStateChanged());
         DataSyncManager* thisDataSyncManager = (DataSyncManager*) user_data;
 
+               LogDebug("Get state info.");
                sync_agent_get_event_data_param(request, &profileDirName);
                sync_agent_get_event_data_param(request, &sync_type);
                sync_agent_get_event_data_param(request, &progress);
@@ -138,6 +139,7 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
 
                int isFromServer, totalPerOperation, syncedPerOperation, totalPerDb, syncedPerDb;
 
+               LogDebug("Get progress info.");
                sync_agent_get_event_data_param(request, &profileDirName);
                sync_agent_get_event_data_param(request, &syncType);
                sync_agent_get_event_data_param(request, &uri);
@@ -481,26 +483,20 @@ void DataSyncManager::OnRequestReceived(const IEventAddProfilePtr &event)
         LogDebug("profileId from platform: "<<profileId);
 
                char* profileName = NULL;
-               char* profileDirName = NULL;
                ret = sync_agent_ds_get_profile_name(profile_h, &profileName);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
                        ThrowMsg(PlatformException, "Platform error while getting a profile name: "<<ret);
                }
-               ret = sync_agent_ds_get_profile_dir_name(profile_h, &profileDirName);
-               if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(PlatformException, "Platform error while getting a profile dir name: "<<ret);
-               }
 
-        LogDebug("profileName: "<<profileName<<", profileDirName: "<<profileDirName);
+        LogDebug("profileName: "<<profileName<<", profileId: "<<profileId);
 
-        profile->setProfileId(profileDirName);
+               std::stringstream ss;
+               ss<<profileId;
+               profile->setProfileId(ss.str());
 
                if(profileName) {
                        free(profileName);
                }
-               if(profileDirName) {
-                       free(profileDirName);
-               }
 
         event->setResult(true);
     }
@@ -538,14 +534,12 @@ void DataSyncManager::OnRequestReceived(const IEventUpdateProfilePtr &event)
 
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
 
-               ret = sync_agent_ds_create_profile_info(&profile_h);
-               if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(PlatformException, "Platform error while creating a profile: "<<ret);
-               }
-
-               ret = sync_agent_ds_set_profile_dir_name(profile_h, (char*)(profile->getProfileId().c_str()));
+               int profileId;
+               std::stringstream ss(profile->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(PlatformException, "Platform error while settting a profile dir name: "<<ret);
+                       ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
 
                ret = sync_agent_ds_set_profile_name(profile_h, (char*)(profile->getProfileName().c_str()));
@@ -626,19 +620,17 @@ void DataSyncManager::OnRequestReceived(const IEventRemoveProfilePtr &event)
 
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
 
-               ret = sync_agent_ds_create_profile_info(&profile_h);
-               if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(PlatformException, "Platform error while creating a profile: "<<ret);
-               }
-
-               ret = sync_agent_ds_set_profile_dir_name(profile_h, (char*)(event->getProfileId().c_str()));
+               int profileId;
+               std::stringstream ss(event->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(PlatformException, "Platform error while settting a profile dir name: "<<ret);
+                       ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
 
                ret = sync_agent_ds_delete_profile(profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                       ThrowMsg(NotFoundException, "Platform error while deleting a profile: "<<ret);
+                       ThrowMsg(PlatformException, "Platform error while deleting a profile: "<<ret);
                }
 
         event->setResult(true);
@@ -723,7 +715,10 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event)
 
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
 
-               ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+               int profileId;
+               std::stringstream ss(event->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
                        ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
@@ -838,14 +833,17 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event)
                        profile_h = (ds_profile_h) iter->data;
                        SyncProfileInfoPtr profile( new SyncProfileInfo() );
 
-                       char *profileDirName = NULL;
-                       ret = sync_agent_ds_get_profile_dir_name(profile_h, &profileDirName);
+                       int profileId;
+                       ret = sync_agent_ds_get_profile_id(profile_h, &profileId);
                        if (SYNC_AGENT_DS_SUCCESS!=ret) {
-                               ThrowMsg(PlatformException, "Platform error while gettting a profile dir name: "<<ret);
+                               ThrowMsg(PlatformException, "Platform error while gettting a profile id: "<<ret);
                        }
-                       profile->setProfileId(profileDirName);
 
-                       LogDebug("Processing a profile with id: "<<profileDirName);
+                       std::stringstream ss;
+                       ss<<profileId;
+                       profile->setProfileId(ss.str());
+
+                       LogDebug("Processing a profile with id: "<<profile->getProfileId());
 
                        char *profileName = NULL;
                        ret = sync_agent_ds_get_profile_name(profile_h, &profileName);
@@ -944,7 +942,10 @@ void DataSyncManager::OnRequestReceived(const IEventStartSyncPtr &event)
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
                sync_agent_event_error_e err= SYNC_AGENT_EVENT_FAIL;
 
-               ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+               int profileId;
+               std::stringstream ss(event->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
                        ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
@@ -999,7 +1000,10 @@ void DataSyncManager::OnRequestReceived(const IEventStopSyncPtr &event)
 
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
 
-               ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+               int profileId;
+               std::stringstream ss(event->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
                        ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
@@ -1040,7 +1044,10 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev
 
         sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL;
 
-               ret = sync_agent_ds_get_profile((char*)(event->getProfileId().c_str()), &profile_h);
+               int profileId;
+               std::stringstream ss(event->getProfileId());
+               ss>>profileId;
+               ret = sync_agent_ds_get_profile(profileId, &profile_h);
                if (SYNC_AGENT_DS_SUCCESS!=ret) {
                        ThrowMsg(NotFoundException, "Platform error while getting a profile: "<<ret);
                }
@@ -1055,21 +1062,25 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev
 
                int statistics_count = g_list_length(statistics_list);
                LogDebug("statistics_count: "<<statistics_count);
+               sync_agent_ds_statistics_info *statistics = NULL;
                for (int i = 0; i < statistics_count; i++) {
-                       sync_agent_ds_statistics_info *statistics = (sync_agent_ds_statistics_info *) g_list_nth_data(statistics_list, i);
+                       statistics = (sync_agent_ds_statistics_info *) g_list_nth_data(statistics_list, i);
 
                        SyncStatisticsPtr statisticsPtr( new SyncStatistics() );
 
                        if(0==i) {
+                               LogDebug("Statistics for contact.");
                                statisticsPtr->setServiceType(convertToSyncServiceType(SYNC_AGENT_CONTACT));
                        } else if(1==i) {
+                               LogDebug("Statistics for event.");
                                statisticsPtr->setServiceType(convertToSyncServiceType(SYNC_AGENT_CALENDAR));
                        } else {
                                LogWarning("Unsupported category for statistics: "<<i);
                                continue;
                        }
-                       statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
 
+                       LogDebug("dbsynced: "<<statistics->dbsynced);
+                       statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced));
                        statisticsPtr->setClientToServerTotal(statistics->client2server_total);
                        statisticsPtr->setClientToServerAdded(statistics->client2server_nrofadd);
                        statisticsPtr->setClientToServerUpdated(statistics->client2server_nrofreplace);
index 69e4df2..873a30f 100755 (executable)
@@ -636,10 +636,10 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context,
                if (argumentCount>=2) {
                LogDebug("Process the listener callback.");
 
-                       if(converter.toFunctionOrNull(arguments[1])) {
+            if (JSValueIsObject(context, arguments[1])) {
                                LogDebug("Non-null callbacks.");
 
-                               JSObjectRef objectCallbacks = converter.toJSObjectRef(converter.toFunctionOrNull(arguments[1]));
+                               JSObjectRef objectCallbacks = converter.toJSObjectRef(arguments[1]);
                                JSCallbackManagerPtr onProgressCbm(NULL), onCompletedCbm(NULL), onStoppedCbm(NULL), onFailedCbm(NULL);
                        Validator validator(context);
 
@@ -686,6 +686,10 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context,
                        emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
 
                                dplEvent->setEmitter(emitter);
+                       } else  if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1]) ) {
+                               LogDebug("Null or undefined listener.");
+                       } else {
+                               ThrowMsg(ConversionException, "Wrong second parameter type.");
                        }
                }
 
index 1ed99bf..0dfb4d7 100755 (executable)
@@ -2,7 +2,13 @@ SET(TARGET_NAME ${download_target})
 SET(DESTINATION_NAME ${download_dest})
 SET(TARGET_IMPL_NAME ${download_impl})
 
-PKG_SEARCH_MODULE(download REQUIRED capi-web-url-download)
+PKG_CHECK_MODULES(platform_pkgs_download REQUIRED capi-web-url-download)
+
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${TOP}/Filesystem
+       ${platform_pkgs_download_INCLUDE_DIRS}
+)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
@@ -20,17 +26,13 @@ SET(SRCS_IMPL
        JSDownloadRequest.cpp
 )
 
-INCLUDE_DIRECTORIES(
-       ${TOP}/Common
-       ${TOP}/Filesystem
-       ${download_INCLUDE_DIRS}
-)
-
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${download_LIBRARIES}
+       ${tizen_impl}
+       ${filesystem_impl}
+       ${platform_pkgs_download_LIBRARIES}
 )
 
 SET(SRCS
@@ -42,15 +44,12 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${filesystem_impl}
-       ${filesystem_config}
-       ${tizen_impl}
-       ${timeutil_impl}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/download
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/download
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index 038aded..63781de 100755 (executable)
@@ -3,11 +3,11 @@ SET(DESTINATION_NAME ${filesystem_dest})
 SET(TARGET_IMPL_NAME ${filesystem_impl})
 SET(TARGET_CONFIG_NAME ${filesystem_config})
 
-PKG_SEARCH_MODULE(fs REQUIRED capi-appfw-application libpcrecpp ecore ecore-1)
+PKG_CHECK_MODULES(platform_pkgs_filesystem REQUIRED capi-appfw-application libpcrecpp ecore)
 
 INCLUDE_DIRECTORIES(
-       ${fs_INCLUDE_DIRS}
        ${TOP}/Common
+       ${platform_pkgs_filesystem_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -20,7 +20,7 @@ SET(CMAKE_INSTALL_RPATH
 SET(SRCS_IMPL
        IManager.cpp
        IPath.cpp
-       IStream.cpp  
+       IStream.cpp
        EventResolve.cpp
        EventGetStorage.cpp
        EventListStorages.cpp
@@ -36,7 +36,7 @@ SET(SRCS_IMPL
        PathUtils.cpp
        StorageProperties.cpp
        EventStoragestateChanged.cpp
-       Manager.cpp 
+       Manager.cpp
        Node.cpp
        Path.cpp
        Stream.cpp
@@ -61,7 +61,8 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
        ${LIBS_WIDGETDB}
-       ${fs_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_filesystem_LIBRARIES}
 )
 
 SET(SRCS_CONFIG
@@ -83,13 +84,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
        ${TARGET_CONFIG_NAME}
-       ${tizen_impl}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/filesystem
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/filesystem
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 4282535..58653b3 100644 (file)
@@ -2,7 +2,7 @@ SET(TARGET_NAME ${log_target})
 SET(DESTINATION_NAME ${log_dest})
 
 set(SRCS_DEVICEINTERACTION
-       JSTizenLog.cpp    
+       JSTizenLog.cpp
        plugin_initializer.cpp
 
 )
@@ -25,6 +25,6 @@ target_link_libraries(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/log
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/log
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
\ No newline at end of file
index cfcf486..3e04191 100644 (file)
@@ -2,17 +2,11 @@ SET(TARGET_NAME ${messageport_target})
 SET(DESTINATION_NAME ${messageport_dest})
 SET(TARGET_IMPL_NAME ${messageport_impl})
 
-PKG_SEARCH_MODULE(message-port REQUIRED message-port)
-PKG_SEARCH_MODULE(capi-appfw-app-manager REQUIRED capi-appfw-app-manager)
+PKG_CHECK_MODULES(platform_pkgs_messageport REQUIRED message-port)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
-       ${message-port_INCLUDE_DIRS}
-       ${capi-appfw-app-manager_INCLUDE_DIRS}
-)
-
-LINK_DIRECTORIES(
-       ${message-port_LIBRARY_DIRS}
+       ${platform_pkgs_messageport_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -20,17 +14,7 @@ SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
 )
 
-SET(SRCS_CONFIG
-       plugin_config.cpp
-)
-
-ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_CONFIG})
-
-TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
-       ${LIBS_COMMON}
-)
-
-SET(SRCS
+SET(SRCS_IMPL
        ILocalMessagePort.cpp
        IMessagePortManager.cpp
        IRemoteMessagePort.cpp
@@ -46,21 +30,29 @@ SET(SRCS
        LocalMessagePortController.cpp
        MessagePortConverter.cpp
        MessagePortListenerManager.cpp
+)
+
+ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
+
+TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
+       ${LIBS_COMMON}
+       ${platform_pkgs_messageport_LIBRARIES}
+)
+
+SET(SRCS
+       plugin_config.cpp
        plugin_initializer.cpp
 )
 
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
-       ${LIBS_COMMON}
-       ${message-port_LIBRARIES}     
-       ${capi-appfw-app-manager_LIBRARIES}
        ${TARGET_IMPL_NAME}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messageport
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messageport
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 22c6958..5be7b26 100644 (file)
@@ -9,7 +9,7 @@
 
     <api-feature>
         <name>http://tizen.org/privilege/messageport</name>
-        <!-- device-capability>messageport</device-capability -->
+        <device-capability>messageport</device-capability>
     </api-feature>
 
 </plugin-properties>
index 6e6c687..8d15aeb 100755 (executable)
@@ -2,23 +2,17 @@ SET(TARGET_NAME ${messaging_target})
 SET(DESTINATION_NAME ${messaging_dest})
 SET(TARGET_IMPL_NAME ${messaging_impl})
 
-PKG_SEARCH_MODULE(msg-service-module REQUIRED msg-service)
-PKG_SEARCH_MODULE(email-service-module REQUIRED email-service)
-PKG_SEARCH_MODULE(dbus REQUIRED dbus-1)
+PKG_CHECK_MODULES(platform_pkgs_messaging REQUIRED msg-service email-service dbus-1)
 
 INCLUDE_DIRECTORIES(
-       ${TOP}/Tizen
+       ${TOP}/Tizen
        ${TOP}/Common
        ${TOP}/Filesystem
-       ${msg-service-module_INCLUDE_DIRS}
-       ${email-service-module_INCLUDE_DIRS}
-       ${dbus_INCLUDE_DIRS}
-       ${INCLUDES_PLATFORM_IMPLEMENTATION_DBUS}
+       ${platform_pkgs_messaging_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
-       ${wrt-deviceapis-filesystem_LIBRARY_DIRS}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${tizen_dest}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
        ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${timeutil_dest}
@@ -29,7 +23,7 @@ SET(SRCS_MESSAGING
        IMessagingServiceManager.cpp
        IMessagingService.cpp
        MessagingFactory.cpp
-       Attachments.cpp
+       Attachments.cpp
        IAttachment.cpp
        AttachmentFactory.cpp
        BccRecipient.cpp
@@ -37,7 +31,7 @@ SET(SRCS_MESSAGING
        CcRecipient.cpp
        From.cpp
        IBinarySms.cpp
-       IEmptyMessage.cpp 
+       IEmptyMessage.cpp
        IEmail.cpp
        IMessage.cpp
        IMessaging.cpp
@@ -61,21 +55,21 @@ SET(SRCS_MESSAGING
        EventMessageReceived.cpp
        EmitterMessageReceived.cpp
        EmitterConversationReceived.cpp
-       EmitterFolderReceived.cpp  
+       EmitterFolderReceived.cpp
        MessageFilterValidatorFactory.cpp
        MessageFilterValidator.cpp
        ConversationFilterValidatorFactory.cpp
        ConversationFilterValidator.cpp
        FolderFilterValidatorFactory.cpp
-       FolderFilterValidator.cpp  
+       FolderFilterValidator.cpp
        StorageChangesMessageFilterValidatorFactory.cpp
        StorageChangesMessageFilterValidator.cpp
-       StorageChangesMessageGenerator.cpp  
+       StorageChangesMessageGenerator.cpp
        StorageChangesConversationFilterValidatorFactory.cpp
-       StorageChangesConversationFilterValidator.cpp  
-       StorageChangesConversationGenerator.cpp  
+       StorageChangesConversationFilterValidator.cpp
+       StorageChangesConversationGenerator.cpp
        StorageChangesFolderFilterValidatorFactory.cpp
-       StorageChangesFolderFilterValidator.cpp  
+       StorageChangesFolderFilterValidator.cpp
        StorageChangesFolderGenerator.cpp
        MessagingServiceManager.cpp
        MessagingService.cpp
@@ -98,7 +92,7 @@ SET(SRCS_MESSAGING
        Conversation.cpp
        MessageFolder.cpp
        ConversationQueryGenerator.cpp
-       FolderQueryGenerator.cpp  
+       FolderQueryGenerator.cpp
        messageDB/MsgSqliteWrapper.cpp
        messageDB/MessageStorageReader.cpp
        DBus/Connection.cpp
@@ -123,7 +117,7 @@ SET(SRCS_MESSAGING
 )
 
 SET(SRCS_IMPL
-  ${SRCS_MESSAGING}
+       ${SRCS_MESSAGING}
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
@@ -131,12 +125,9 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
        ${LIBS_WIDGETDB}
-       ${msg-service-module_LIBRARIES}
-       ${email-service-module_LIBRARIES}
-       ${dbus_LIBRARIES}
-       ${LIBS_PLATFORM_IMPLEMENTATION_DBUS}
-       ${LIBS_PLATFORM_IMPLEMENTATION_FILESYSTEM}
-       ${wrt-deviceapis-filesystem_LDFLAGS}
+       ${tizen_impl}
+       ${filesystem_impl}
+       ${platform_pkgs_messaging_LIBRARIES}
 )
 
 SET(SRCS
@@ -148,15 +139,12 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${filesystem_impl}
-       ${filesystem_config}
-       ${tizen_impl}
-       ${timeutil_impl}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messaging
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/messaging
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index b069cdf..d7663cc 100755 (executable)
@@ -2,20 +2,20 @@ SET(TARGET_NAME ${nfc_target})
 SET(DESTINATION_NAME ${nfc_dest})
 SET(TARGET_IMPL_NAME ${nfc_impl})
 
-PKG_SEARCH_MODULE(capi-network-nfc REQUIRED capi-network-nfc)
+PKG_CHECK_MODULES(platform_pkgs_nfc REQUIRED capi-network-nfc)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
-       ${capi-network-nfc_INCLUDE_DIRS}
+       ${platform_pkgs_nfc_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
-  ${CMAKE_INSTALL_RPATH}
-  ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
+${CMAKE_INSTALL_RPATH}
+${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME}
 )
 
 SET(SRCS_IMPL
-       JSNFCManager.cpp
+       JSNFCManager.cpp
        JSNFCAdapter.cpp
        JSNFCTag.cpp
        JSNdefMessage.cpp
@@ -25,31 +25,31 @@ SET(SRCS_IMPL
        JSNdefRecordMedia.cpp
        JSNdefRecordArray.cpp
        JSNFCTarget.cpp
-       NFCConverter.cpp
-       EventNFCChangedPrivateData.cpp
-       NFCStaticController.cpp
-       NFCAsyncCallbackManager.cpp
-       NFCListenerManager.cpp
-       ResponseDispatcher.cpp
-       NFCFactory.cpp
-       INFCAdapter.cpp
-       INFCTag.cpp
-       TagFilter.cpp  
-       INFCTarget.cpp
-       NFCDefaultAdapter.cpp
-       NFCAdapter.cpp
-       NFCTag.cpp
-       NdefMessage.cpp
-       NdefRecord.cpp
-       NFCTarget.cpp
-       NFCUtil.cpp
+       NFCConverter.cpp
+       EventNFCChangedPrivateData.cpp
+       NFCStaticController.cpp
+       NFCAsyncCallbackManager.cpp
+       NFCListenerManager.cpp
+       ResponseDispatcher.cpp
+       NFCFactory.cpp
+       INFCAdapter.cpp
+       INFCTag.cpp
+       TagFilter.cpp
+       INFCTarget.cpp
+       NFCDefaultAdapter.cpp
+       NFCAdapter.cpp
+       NFCTag.cpp
+       NdefMessage.cpp
+       NdefRecord.cpp
+       NFCTarget.cpp
+       NFCUtil.cpp
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${capi-network-nfc_LIBRARIES}
+       ${platform_pkgs_nfc_LIBRARIES}
 )
 
 SET(SRCS
@@ -66,6 +66,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/nfc
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/nfc
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 1956ed5..2802b33 100755 (executable)
@@ -1,9 +1,14 @@
 SET(TARGET_NAME ${networkbearerselection_target})
 SET(DESTINATION_NAME ${networkbearerselection_dest})
 
-PKG_SEARCH_MODULE(capi-network-connection REQUIRED capi-network-connection)
+PKG_CHECK_MODULES(platform_pkgs_networkbearerselection REQUIRED capi-network-connection)
 
-SET(SRCS 
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${platform_pkgs_networkbearerselection_INCLUDE_DIRS}
+)
+
+SET(SRCS
        INetworkBearerSelection.cpp
        NetworkBearerSelectionFactory.cpp
        NetworkBearerSelection.cpp  plugin_initializer.cpp
@@ -13,21 +18,16 @@ SET(SRCS
        NetworkBearerSelectionResponseDispatcher.cpp
 )
 
-INCLUDE_DIRECTORIES(
-       ${capi-network-connection_INCLUDE_DIRS}
-       ${TOP}/Common
-)
-
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${LIBS_COMMON}
-       ${capi-network-connection_LIBRARIES}
+       ${platform_pkgs_networkbearerselection_LIBRARIES}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/networkbearerselection
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/networkbearerselection
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index b63c625..4299e17 100755 (executable)
@@ -1,17 +1,14 @@
 SET(TARGET_NAME ${notification_target})
 SET(DESTINATION_NAME ${notification_dest})
 SET(TARGET_IMPL_NAME ${notification_impl})
-SET(TARGET_CONFIG_NAME ${notification_config})
 
-PKG_SEARCH_MODULE(noti REQUIRED notification)
-PKG_SEARCH_MODULE(application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_notification REQUIRED notification capi-appfw-application)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/Application
        ${TOP}/Filesystem
-       ${noti_INCLUDE_DIRS}
-       ${application_INCLUDE_DIRS}
+       ${platform_pkgs_notification_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -42,21 +39,14 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${noti_LIBRARIES}
-       ${application_LIBRARIES}
- )
-
-SET(SRCS_CONFIG
-       plugin_config.cpp
-)
-
-ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
-
-TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
-       ${LIBS_COMMON}
+       ${tizen_impl}
+       ${application_impl}
+       ${filesystem_impl}
+       ${platform_pkgs_notification_LIBRARIES}
 )
 
 SET(SRCS
+       plugin_config.cpp
        plugin_initializer.cpp
 )
 
@@ -64,18 +54,13 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${TARGET_CONFIG_NAME}
-       ${application_impl}
-       ${application_config}
-       ${filesystem_impl}
-       ${filesystem_config}
-       ${tizen_impl}
-       ${timeutil_impl}
+       "-Wl,--no-as-needed" ${application_config}
+       "-Wl,--no-as-needed" ${filesystem_config}
 )
 
-INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
+INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/notification
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/notification
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index cef8163..e761720 100755 (executable)
@@ -96,6 +96,8 @@ public:
        
        void setUpdatedFlag(bool value)
        {
+               if (value)
+                       LogDebug("set True");
                m_notiUpdated = value;
        }
        
index a006ff4..49dd327 100755 (executable)
 //
 
 #include <algorithm>
-#include <dpl/log/log.h>
 #include <CommonsJavaScript/ScopedJSStringRef.h>
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include "NotificationConverter.h"
 #include "JSNotificationLineArray.h"
+#include "Logger.h"
 
 #define FUNCTION_CONCAT "concat"
 #define FUNCTION_JOIN "join"
index 91244ce..f002cd2 100644 (file)
@@ -172,7 +172,6 @@ JSValueRef JSNotificationManager::cancel(JSContextRef context, JSObjectRef objec
                LogWarning("Exception: "<<_rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, 
                                        JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage());
-
        }
        Catch (WrtDeviceApis::Commons::InvalidArgumentException) 
        {
@@ -341,8 +340,8 @@ JSValueRef JSNotificationManager::get(JSContextRef context, JSObjectRef object,
        try 
        {
 
-               AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+               //AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
+               //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
                
                if (argumentCount == 1)
                        reserveArguments = arguments[0];
@@ -481,8 +480,8 @@ JSValueRef JSNotificationManager::getAll(JSContextRef context, JSObjectRef objec
        try 
        {
 
-               AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
-               TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+               //AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC);
+               //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
                
                if (priv == NULL)
                {
index 4523122..eeccd99 100755 (executable)
@@ -79,6 +79,7 @@ JSStaticValue JSStatusNotification::m_properties[] =
        {NOTIFICATION_NUMBER,   JSStatusNotification::getProperty, JSStatusNotification::setProperty,   kJSPropertyAttributeNone },     
        {NOTIFICATION_THUMBNAILS,       JSStatusNotification::getProperty, JSStatusNotification::setProperty,   kJSPropertyAttributeNone },     
        {NOTIFICATION_SUB_ICON_PATH,    JSStatusNotification::getProperty, JSStatusNotification::setProperty,   kJSPropertyAttributeNone },     
+       {NOTIFICATION_PROGRESS_TYPE,    JSStatusNotification::getProperty, JSStatusNotification::setProperty,   kJSPropertyAttributeNone },     
        {0, 0, 0, 0}
 };
 
@@ -239,6 +240,11 @@ bool JSStatusNotification::setProperty(JSContextRef context,
                                                
                        return true;
                }
+
+               else if (property == NOTIFICATION_PROGRESS_TYPE)
+               {
+                       notification->setProgressType(converter->toNotificationProgressType(value));
+               }
                
                else if (property == NOTIFICATION_LINES)
                {
@@ -383,7 +389,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context,
                else if (property == NOTIFICATION_TYPE)
                {
                        LogDebug(" TYPE : " << notification->getNotiType());
-                       return converter->toJSValueRef(notification->getNotiType());
+                       return converter->toJSValueRef("STATUS");
                }
                else if (property == NOTIFICATION_POSTED_TIME)
                {       
@@ -511,7 +517,25 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context,
                }
                else if (property == NOTIFICATION_THUMBNAILS)
                {
-                       return converter->toJSValueRef(notification->getThumbnails());
+                       StringArrayPtr thumbnailsPtr = notification->getThumbnails();
+                       
+                       std::vector<std::string>::iterator it;
+
+                       int idx = 0;
+                       for (it = thumbnailsPtr->begin(); it < thumbnailsPtr->end(); ++it)
+                       {
+                               std::string str = *it;
+                               LogDebug(" thumbs : " << str);
+                               str = DeviceAPI::Filesystem::Utils::toVirtualPath(context, str);
+                               //str = path->getFullPath();
+
+                               LogDebug(" thumbs : " << str);
+                               *it = str;
+                               idx ++;
+                       }
+                       return converter->toJSValueRef(thumbnailsPtr);
+                       
+                       //return converter->toJSValueRef(notification->getThumbnails());
                }
                else if (property == NOTIFICATION_SUB_ICON_PATH )
                {
@@ -523,6 +547,10 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context,
                        strSubIcon = DeviceAPI::Filesystem::Utils::toVirtualPath(context, strSubIcon);
                        return converter->toJSValueRef(strSubIcon);
                }
+               else if (property == NOTIFICATION_PROGRESS_TYPE)
+               {
+                       return converter->toJSValueRef(notification->getProgressType());
+               }               
                else 
                {
                        ThrowMsg(WrtDeviceApis::Commons::ConversionException,"No attribute");
index e864ca3..78cd909 100755 (executable)
@@ -44,6 +44,7 @@ typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<INotificationPtr>::Type
 #endif
 #define NOTIFICATION_APP_CONTROL "appControl"
 #define NOTIFICATION_APP_ID "appId"
+#define NOTIFICATION_PROGRESS_TYPE "progressType"
 #define NOTIFICATION_PROGRESS_VALUE "progressValue"
 #define NOTIFICATION_LINES "detailInfo"
 #define NOTIFICATION_BACKGROUND_IMAGE_PATH "backgroundImagePath"
index a23bb61..1dd08c6 100755 (executable)
  */
 
 #include <algorithm>
-#include <dpl/log/log.h>
 #include <CommonsJavaScript/Converter.h>
 #include <CommonsJavaScript/ScopedJSStringRef.h>
 #include <JSTizenExceptionFactory.h>
 #include <JSTizenException.h>
 #include "NotificationConverter.h"
 #include "JSStringArray.h"
+#include "Logger.h"
 
 #define FUNCTION_CONCAT "concat"
 #define FUNCTION_JOIN "join"
index 91fd33c..de98447 100755 (executable)
@@ -96,6 +96,25 @@ NotificationType NotificationConverter::toNotificationType(const JSValueRef arg)
        }       
 }
 
+NotificationProgressType NotificationConverter::toNotificationProgressType(const JSValueRef arg)
+{
+       std::string strType = toString(arg);
+       LogDebug("progress Type : " << strType);
+       if ( strType.compare("BYTE") == 0 ) 
+       {
+               return NOTI_PROGRESS_TYPE_SIZE;
+       }
+       else if ( strType.compare("PERCENTAGE") == 0 ) 
+       {
+               return NOTI_PROGRESS_TYPE_PERCENTAGE;
+       }       
+       else
+       {
+               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "notification type not supported");
+       }
+}
+
+
 void NotificationConverter::NotificationConverter::toNotificationFromDict( INotificationPtr& notification, const JSValueRef arg)
 {
        if (JSValueIsUndefined(m_context, arg) || JSValueIsNull(m_context, arg)) 
@@ -124,6 +143,7 @@ void NotificationConverter::NotificationConverter::toNotificationFromDict( INoti
        const ScopedJSStringRef numberStr(JSStringCreateWithUTF8CString(NOTIFICATION_NUMBER)); 
        const ScopedJSStringRef thumbnailsStr(JSStringCreateWithUTF8CString(NOTIFICATION_THUMBNAILS)); 
        const ScopedJSStringRef subIconPathStr(JSStringCreateWithUTF8CString(NOTIFICATION_SUB_ICON_PATH)); 
+       const ScopedJSStringRef progressTypeStr(JSStringCreateWithUTF8CString(NOTIFICATION_PROGRESS_TYPE)); 
 
        DeviceAPI::Filesystem::IPathPtr path;
        
@@ -145,6 +165,7 @@ void NotificationConverter::NotificationConverter::toNotificationFromDict( INoti
        JSValueRef numberValue = JSObjectGetProperty(m_context, dictObject, numberStr.get(), NULL);
        JSValueRef thumbnailsValue = JSObjectGetProperty(m_context, dictObject, thumbnailsStr.get(), NULL);
        JSValueRef subIconPathValue = JSObjectGetProperty(m_context, dictObject, subIconPathStr.get(), NULL);
+       JSValueRef progressTypeValue = JSObjectGetProperty(m_context, dictObject, progressTypeStr.get(), NULL);
 
     if (!JSValueIsUndefined(m_context, contentValue)) 
        {
@@ -193,13 +214,38 @@ void NotificationConverter::NotificationConverter::toNotificationFromDict( INoti
                std::string appId = toString(appIdValue);
                notification->setApplicationId(appId);
        }
+
+       if (!JSValueIsUndefined(m_context, progressTypeValue)) 
+       {
+               notification->setProgressType(toNotificationProgressType(progressTypeValue));
+       }
        
        if (!JSValueIsUndefined(m_context, progressValue)) 
        {
-               //unsigned short value = toULong(progressValue);
-               double value = toDouble(progressValue);
-               LogDebug(" Progress Value : " << value);
-               notification->setProgressValue(value);
+               unsigned int progressVal = toULong(progressValue);
+               NotificationProgressType progressType = notification->getProgressType();
+               
+               LogDebug(" progress type = " << progressType << "progressValue = " << progressVal);
+                                               
+               if ( NOTI_PROGRESS_TYPE_SIZE == progressType)
+               {
+                       notification->setProgressValue(progressVal);
+               }
+               else if ( NOTI_PROGRESS_TYPE_PERCENTAGE == progressType)
+               {
+                       //check arrang.
+                       if (  progressVal > 100 )
+                       {
+                               progressVal = 100;
+                       }
+                       double percentage = (double)progressVal/(double)100;
+                       LogDebug(" Percentage Value = " << percentage);
+                       notification->setProgressValue(percentage);
+               }
+                               
+               //double value = toDouble(progressValue);
+               //LogDebug(" Progress Value : " << value);
+               //notification->setProgressValue(value);
        }
 
        if (!JSValueIsUndefined(m_context, detailInfoValue)) 
@@ -252,6 +298,7 @@ void NotificationConverter::NotificationConverter::toNotificationFromDict( INoti
                subIconPath = path->getFullPath();
                notification->setSubIconPath(subIconPath);
        }
+       
 
 }
 
@@ -310,6 +357,24 @@ JSValueRef NotificationConverter::toJSValueRef(const NotificationType arg)
        {
                return toJSValueRef("PROGRESS"); 
        }
+       else if ( NOTI_TYPE_THUMBNAIL ==  arg)
+       {
+               return toJSValueRef("THUMBNAIL"); 
+       }
+       
+       return  JSValueMakeUndefined(m_context);
+}
+
+JSValueRef NotificationConverter::toJSValueRef(const NotificationProgressType &arg)
+{
+       if ( NOTI_PROGRESS_TYPE_SIZE ==  arg)
+       {
+               return toJSValueRef("BYTE");
+       }
+       else if ( NOTI_PROGRESS_TYPE_PERCENTAGE==  arg)
+       {
+               return toJSValueRef("PERCENTAGE");
+       }
        
        return  JSValueMakeUndefined(m_context);
 }
index 1793a45..b976536 100755 (executable)
 #ifndef TIZENAPIS_TIZEN_NOTIFICATION_CONVERTER_H_
 #define TIZENAPIS_TIZEN_NOTIFICATION_CONVERTER_H_
 
-#include <dpl/log/log.h>
 #include <CommonsJavaScript/Converter.h>
 #include <ApplicationControl.h>
 //#include <ApplicationConverter.h>
 #include <FilesystemUtils.h>
 #include "INotification.h"
 #include "NotificationLine.h"
+#include "Logger.h"
 
 namespace DeviceAPI {
 namespace Notification {
@@ -40,10 +40,11 @@ public:
        INotificationPtr toINotificationPtr(const JSValueRef arg);
        DeviceAPI::Application::ApplicationControlPtr toIApplicationPtr(const JSValueRef arg);
        void toNotificationFromDict(INotificationPtr& notification, const JSValueRef arg);
-    NotificationType toNotificationType(const JSValueRef arg);
+       NotificationType toNotificationType(const JSValueRef arg);
        
        NotificationLinePtr toNotificationLine(const JSValueRef &jsValue);
        NotificationLineArrayPtr toNotificationLineArray(const JSValueRef &jsValue);
+       NotificationProgressType toNotificationProgressType(const JSValueRef arg);
 
        JSValueRef toJSValueRef(const DeviceAPI::Application::ApplicationControlPtr &arg);
        JSValueRef toJSValueRef(const INotificationPtr arg);
@@ -52,6 +53,7 @@ public:
        
        JSValueRef toJSValueRef(const NotificationLinePtr &arg);
        JSValueRef toJSValueRef(const NotificationLineArrayPtr &arg);
+       JSValueRef toJSValueRef(const NotificationProgressType &arg);
 
        // String Array
        StringArrayPtr toStringArray(const JSValueRef &value);
index 8df0cb0..0b7c482 100755 (executable)
@@ -330,10 +330,10 @@ void NotificationManager::updateNotification(notification_h noti, INotificationP
                }       
                
                //set content
-               const char *contentStr = (notification->getContent()).c_str();
-               LogDebug("Content :" << contentStr);
+               //const char *contentStr = (notification->getContent()).c_str();
+               LogDebug("Content :" << (notification->getContent()).c_str());
 
-               if(notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, contentStr
+               if(notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, (notification->getContent()).c_str()
                        NULL,  NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
                {
                        LogDebug("set Content Error");
@@ -468,7 +468,7 @@ void NotificationManager::updateNotification(notification_h noti, INotificationP
                }
                else 
                {
-                       if ( notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, (notification->getSoundPath()).c_str()) 
+                       if ( notification_set_sound(noti, NOTIFICATION_SOUND_TYPE_DEFAULT, notification->getSoundPath().c_str()) 
                                != NOTIFICATION_ERROR_NONE)
                        {
                                ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification sound error");
@@ -807,8 +807,7 @@ void NotificationManager::post(INotificationPtr notification)
                        ret = notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data);
                        if (ret != NOTIFICATION_ERROR_NONE)
                        {
-                               LogError("notification_set_execute_option fail");
-                               ThrowMsg(WrtDeviceApis::Commons::PlatformException, "set execute option fail, Error Code : " << ret);
+i                              LogError("notification_set_execute_option fail");
                        }
                        bundle_free(service_data);
                }
@@ -874,10 +873,18 @@ void NotificationManager::update(INotificationPtr notification)
                                                        
                                LogDebug(" notification_update_progress = " << ret);
 
-                               if ( NOTIFICATION_ERROR_NONE != ret)
+                               if (NOTIFICATION_ERROR_NONE != ret)
                                {
-                                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Notification Object update grogress fail, Error Code : ");                         
+                                       if ( NOTIFICATION_ERROR_NOT_EXIST_ID == ret)
+                                       {
+                                               ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "maybe, notification is not inserted yet.");
+                                       }
+                                       else 
+                                       {
+                                               ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Notification Object update grogress fail, Error Code : ");                         
+                                       }
                                }
+
                                
 #if 0                                                  
                                if ( NOTIFICATION_ERROR_NONE
index 1203008..8c6fc9c 100755 (executable)
@@ -28,8 +28,11 @@ namespace DeviceAPI {
 namespace Notification{
 
 #define DEFAULT_ICON_PATH "/opt/share/icons/default/"
+#define MAX_NOTIFICATION_LINE_LENGTH 2
+#define MAX_THUMBNAIL_LENGTH 4
 
 extern "C" int service_create_event(bundle *data, struct service_s **service);
+extern "C" int service_to_bundle(service_h service, bundle **data);
 
 #if 0
 static void service_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
@@ -351,28 +354,34 @@ namespace {
        
 static bool service_extra_data_cb(service_h service, const char *key, void *user_data)
 {
+       LogDebug("OK");
        char **value = NULL;
        int length = 0;
 
        if (user_data != NULL && key != NULL)
        {       
-               LogDebug("OK");
+               LogDebug("user data & key is existed");
 
                DeviceAPI::Application::ApplicationControlPtr* appControl = 
                        (DeviceAPI::Application::ApplicationControlPtr*)(user_data);
 
                DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData());
+               LogDebug("key = " << key);
                std::string keyStr = key;
                std::vector<std::string> keyValue;
                int index = 0;
 
                if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE)
                {
+                       LogDebug("extra_data_array length = " << length);
+                       
                        if (value != NULL && length != 0)
                        {
+                               LogDebug("extra_data_length = " << length);
                                data->setKey(key);
                                for (index = 0; index < length; index++)
                                {
+                                       LogDebug("Value=" << value[index]);
                                        keyValue.push_back(value[index]);
                                }
                                
@@ -382,11 +391,29 @@ static bool service_extra_data_cb(service_h service, const char *key, void *user
                        
                        if(value)
                                free(value);
-                               
                }
        }
        return true;
 }
+
+static bool service_extra_data_delete_cb(service_h service, const char *key, void *user_data)
+{
+       LogDebug("OK");
+       if (key != NULL)
+       {       
+               LogDebug("del key = " << key);
+               
+               if (service_remove_extra_data(service, key) != SERVICE_ERROR_NONE)
+               {
+                       LogDebug("remove extra data failed");
+                       return false;
+               }
+       }
+       return true;
+}
+
+
+
 }//namespace
 
 int StatusNotification::getID()
@@ -1314,6 +1341,9 @@ void StatusNotification::setThumbnails(std::vector<std::string>& thumbs)
                        std::string str = *it;
                        LogDebug(" thumbs : " << str);
 
+                       if ( idx < MAX_THUMBNAIL_LENGTH )
+                               setThumbnail(str, idx);
+#if 0
                        notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE; 
                        switch (idx)
                        {
@@ -1335,20 +1365,31 @@ void StatusNotification::setThumbnails(std::vector<std::string>& thumbs)
                                default :
                                        type = NOTIFICATION_IMAGE_TYPE_NONE;
                        }
+                       
+                       if ( idx < MAX_THUMBNAIL_LENGTH )
+                       { 
 
-                       if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
-                       {
-                               if (getThumbnail(idx).compare(str))
-                               {       
-                                       if (notification_set_image(m_notiHandle, type, str.c_str()) != NOTIFICATION_ERROR_NONE)
-                                       {
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification thumbnail error");
+                               if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
+                               {
+                                       if (getThumbnail(idx).compare(str))
+                                       {       
+                                               if (notification_set_image(m_notiHandle, type, str.c_str()) != NOTIFICATION_ERROR_NONE)
+                                               {
+                                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "set notification thumbnail error");
+                                               }
+                                               setUpdatedFlag(true);
                                        }
-                                       setUpdatedFlag(true);
                                }
                        }
+
+#endif
                        idx ++;
                }
+
+               if ( idx < MAX_THUMBNAIL_LENGTH)
+               {
+                       setThumbnail("", idx);  //set empty value
+               }       
                
 
        }
@@ -1719,31 +1760,25 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication
        DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
 
        try {
-
                if (m_service)
                {
                        appControl->setService_h(m_service);
-
                        // mandatory
-                       int ret = service_get_operation(m_service, &tempStr);
-                       LogDebug("ret = " << ret);
-                       //if (service_get_operation(service, &tempStr) != SERVICE_ERROR_NONE)
-                       if(ret != SERVICE_ERROR_NONE)
-                       {
-                               LogDebug(" Opertation is Empty");
-                       }
-                       LogDebug("temp Str = " << tempStr);
-
-                       if (tempStr) 
+                       if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE)
                        {
-                               appControl->setOperation(tempStr);
-                               free(tempStr);
-                               tempStr = NULL;
+                               LogDebug("Operation Str = " << tempStr);
+                               if (tempStr) 
+                               {
+                                       appControl->setOperation(tempStr);
+                                       free(tempStr);
+                                       tempStr = NULL;
+                               }
                        }
 
                        // optional
                        if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE)
                        {
+                               LogDebug("Mime Str = " << tempStr);
                                if (tempStr) 
                                {
                                        appControl->setMime(tempStr);
@@ -1755,6 +1790,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication
                        // optional
                        if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE)
                        {
+                               LogDebug("Uri Str = " << tempStr);
                                if (tempStr)
                                {
                                        appControl->setUri(tempStr);
@@ -1763,6 +1799,17 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication
                                }
                        }
 
+                       if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE)
+                       {
+                               LogDebug("Category Str = " << tempStr);
+                               if (tempStr)
+                               {
+                                       appControl->setCategory(tempStr);
+                                       free(tempStr);
+                                       tempStr = NULL;
+                               }
+                       }
+                       
                        // optional
                        if ( service_foreach_extra_data(m_service, service_extra_data_cb,(void*)&appControl) != SERVICE_ERROR_NONE)
                        {
@@ -1961,96 +2008,13 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati
                                ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set mime error");
                        }
                }
-               
-               std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = appControl->getAppControlDataArray();
-               size_t index = 0;
 
-               LogDebug (" App Control Datas Count : " << appControlDataArray.size());
-
-               DeviceAPI::Application::ApplicationControlDataArray::iterator iter;
-
-               for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++)
+               //remove key
+               if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE)
                {
-                       DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter;
-                       std::string key = appControlData->getKey();
-                       LogDebug(" key : " << key);
-               
-                       if (key.empty())
-                               continue;
-               
-                       std::vector<std::string> value = appControlDataArray[index]->getValue();
-                       const char **arrayValue = (const char**)calloc(sizeof(char*), value.size());
-   
-                       for (size_t indexArray = 0; indexArray < value.size(); indexArray++)
-                       {
-                               arrayValue[indexArray] = (char*)value[indexArray].c_str();
-                               LogDebug( " value : " << arrayValue[indexArray]);
-                       }
-
-                       const char* strKey = key.c_str();
-                       if ( value.size() == 1)
-                       {
-                               if (service_add_extra_data(m_service, strKey, arrayValue[0]) != SERVICE_ERROR_NONE)
-                               {
-                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");     
-                               }       
-                       }
-                       else 
-                       {
-                               if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
-                               {
-                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");                     
-                               }
-
-                       }
-
-                       if (arrayValue)
-                               free(arrayValue);
-               }
-
-       }       
-#if 0
-       LogDebug("Entered");
-       service_h service = NULL;
-       int retcode = SERVICE_ERROR_NONE;
-       
-       LogDebug("m_service : " << m_service);
-
-       if(service == NULL && service_create(&service) != SERVICE_ERROR_NONE)
-       {
-               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service creation error");
-       }
-
-       if (service)
-       {
-               
-               LogDebug("getOperation : " << appControl->getOperation().c_str());
-               if (appControl->getOperation().size() != 0)
-               {
-                       if (service_set_operation(service, appControl->getOperation().c_str()) != SERVICE_ERROR_NONE)
-                       {
-                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set operation error");
-                       }
-               }
-                       
-               // optional
-               if (appControl->getUri().size() != 0)
-               {
-                       if (service_set_uri(service, appControl->getUri().c_str() ) != SERVICE_ERROR_NONE)
-                       {
-                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set uri error");
-                       }
-               }
-
-               // optional
-               if (appControl->getMime().size() != 0)
-               {
-                       if (service_set_mime(service, appControl->getMime().c_str() ) != SERVICE_ERROR_NONE)
-                       {
-                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set mime error");
-                       }
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get notification service uri error");
                }
-               
+                               
                std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = appControl->getAppControlDataArray();
                size_t index = 0, indexArray = 0;
 
@@ -2077,46 +2041,37 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati
                        }
 
                        const char* strKey = key.c_str();
-                       if ( value.size() == 1)
+                       LogDebug( " value size: " << value.size());
+                       if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
                        {
-                               if (service_add_extra_data(service, strKey, arrayValue[0]) != SERVICE_ERROR_NONE)
-                               {
-                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");     
-                               }       
-                       }
-                       else 
-                       {
-                               if (service_add_extra_data_array(service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
-                               {
-                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");                     
-                               }
-
+                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set extra data error");                     
                        }
-
+                        
                        if (arrayValue)
                                free(arrayValue);
+               }                                       
 
+               bundle *bundle_data=NULL;
+               
+               if(service_to_bundle(m_service, &bundle_data) != SERVICE_ERROR_NONE)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service get bundle");                       
                }
-
-               if (m_service != NULL)  //service destory.
+               
+               if (bundle_data)
                {
-                       service_destroy(m_service);
-                       m_service = NULL;
+                       notification_set_execute_option(m_notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+                               NULL,NULL, bundle_data);
+                       //bundle_free(bundle_data);     
                }
+                               
+       }       
 
-               m_service = service;
-       }
-       else
-       {
-               LogDebug(" Service is NULL ");
-       }
-       
-       LogDebug("m_service : " << m_service);
-#endif
 }
 
 void StatusNotification::setApplicationId(const std::string& appId)
 {
+       int retcode = 0;
        LogDebug("m_service = " << m_service << " appId = " << appId);
        if (!m_service)
        {       
@@ -2287,13 +2242,20 @@ void StatusNotification::setLines(const NotificationLineArrayPtr &value)
                        LogDebug("info = " << line->getInformation());
                        LogDebug("sub info = " << line->getSubInformation());
                        
-                       setInformation(line->getInformation(),index);
-                       setSubInformation(line->getSubInformation(),index);
+                       if ( index < MAX_NOTIFICATION_LINE_LENGTH)
+                       {       
+                               setInformation(line->getInformation(),index);
+                               setSubInformation(line->getSubInformation(),index);
+                       }
                        index ++;
-                       if (index>1)
-                               break;
                }
-
+               
+               //clean empty solt.`
+               for ( ;index < MAX_NOTIFICATION_LINE_LENGTH; index++)
+               {
+                       setInformation("", index);
+                       setSubInformation("", index);
+               }
        }
 }
 
index ce351df..585b13d 100755 (executable)
 // limitations under the License.
 //
 
-#include <dpl/log/log.h>
 #include <Commons/plugin_initializer_def.h>
 #include <Commons/WrtAccess/WrtAccess.h>
-#include <Commons/Exception.h>
-#include <GlobalContextManager.h>
 
 #include "JSNotificationManager.h"
 #include "JSStatusNotification.h"
 #include "JSNotificationLine.h"
+#include "Logger.h"
 
-using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
index 624c022..e7e94a2 100644 (file)
@@ -2,18 +2,17 @@ SET(TARGET_NAME ${package_target})
 SET(DESTINATION_NAME ${package_dest})
 SET(TARGET_IMPL_NAME ${package_impl})
 
-PKG_SEARCH_MODULE(app-manager REQUIRED capi-appfw-app-manager)
-PKG_SEARCH_MODULE(package-manager REQUIRED capi-appfw-package-manager)
-PKG_SEARCH_MODULE(package REQUIRED pkgmgr)
-PKG_SEARCH_MODULE(package REQUIRED pkgmgr-info)
+PKG_CHECK_MODULES(platform_pkgs_package REQUIRED
+       capi-appfw-app-manager
+       capi-appfw-package-manager
+       pkgmgr
+       pkgmgr-info
+)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/Package
-       ${app-manager_INCLUDE_DIRS}
-       ${package-manager_INCLUDE_DIRS}
-       ${pkgmgr_INCLUDE_DIRS}
-       ${pkgmgr-info_INCLUDE_DIRS}
+       ${platform_pkgs_package_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -33,10 +32,8 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${app-manager_LIBRARIES}
-       ${package-manager_LIBRARIES}
-       ${pkgmgr_LIBRARIES}
-       ${pkgmgr-info_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_package_LIBRARIES}
 )
 
 SET(SRCS
@@ -48,12 +45,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${tizen_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/package
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/package
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
index 4d883c3..839d82b 100755 (executable)
@@ -2,7 +2,12 @@ SET(TARGET_NAME ${power_target})
 SET(DESTINATION_NAME ${power_dest})
 SET(TARGET_IMPL_NAME ${power_impl})
 
-PKG_SEARCH_MODULE(power REQUIRED capi-system-power pmapi capi-system-device)
+PKG_CHECK_MODULES(platform_pkgs_power REQUIRED capi-system-power pmapi capi-system-device)
+
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${platform_pkgs_power_INCLUDE_DIRS}
+)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
@@ -16,16 +21,12 @@ SET(SRCS_IMPL
        PowerManager.cpp
 )
 
-INCLUDE_DIRECTORIES(
-       ${TOP}/Common
-       ${power_INCLUDE_DIRS}
-)
-
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${power_LIBRARIES}
+       ${tizen_impl}
+       ${platform_pkgs_power_LIBRARIES}
 )
 
 SET(SRCS
@@ -37,14 +38,13 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${tizen_impl}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/power
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/power
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
+
 add_subdir(test)
index 45cafb7..cb94e9d 100755 (executable)
@@ -1,8 +1,13 @@
 SET(TARGET_NAME ${push_target})
 SET(DESTINATION_NAME ${push_dest})
 
-PKG_SEARCH_MODULE(push REQUIRED push)
-PKG_SEARCH_MODULE(capi-appfw-application REQUIRED capi-appfw-application)
+PKG_CHECK_MODULES(platform_pkgs_push REQUIRED push capi-appfw-application)
+
+INCLUDE_DIRECTORIES(
+       ${TOP}/Common
+       ${TOP}/Application
+       ${platform_pkgs_push_INCLUDE_DIRS}
+)
 
 SET(CMAKE_INSTALL_RPATH
        ${CMAKE_INSTALL_RPATH}
@@ -24,28 +29,19 @@ SET(SRCS
        plugin_config.cpp
 )
 
-INCLUDE_DIRECTORIES(
-       ${TOP}/Application
-       ${TOP}/Common
-       ${push_INCLUDE_DIRS}
-       ${capi-appfw-application_INCLUDE_DIRS}
-)
-
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${LIBS_COMMON}
-       ${push_LIBRARIES}
-       ${capi-appfw-application_LIBRARIES}
        ${tizen_impl}
        ${application_impl}
-       ${application_config}
-       ${timeutil_impl}
+       "-Wl,--no-as-needed" ${application_config}
+       ${platform_pkgs_push_LIBRARIES}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/push
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/push
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 03c0f52..32c6794 100644 (file)
@@ -241,7 +241,7 @@ static void push_notify_cb(push_notification_h noti, void *user_data)
         LogWarning("Exception: "<<_rethrown_exception.GetMessage());
     }
 }
- static int get_current_pkg_id(char** pkg_id)
+ static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id)
 {
     LogDebug("get_current_pkg_id enter");
     int parent_pid = getppid();
@@ -279,12 +279,14 @@ static void push_notify_cb(push_notification_h noti, void *user_data)
         return ret;
     }
 
+    *app_id = _app_id;
     *pkg_id = _pkg_id;
 
     return ret;
 }
 
 PushManager::PushManager() : m_appId(NULL),
+    m_pkgId(NULL),
     m_connectionState(PUSH_STATE_UNREGISTERED),
     m_connectionHandle(NULL),
     m_emitter(NULL)
@@ -292,15 +294,16 @@ PushManager::PushManager() : m_appId(NULL),
     LogInfo("Connecting to the push service...");
     int ret;
 
-    ret = get_current_pkg_id(&m_appId);
+    ret = get_current_app_id_and_pkg_id(&m_appId, &m_pkgId);
     if (APP_ERROR_NONE!=ret) {
         LogError("Error while getting app id: "<<ret);
         return;
     }
 
-    LogInfo("Push App id: "<<m_appId);
+    LogInfo("Push App id: " << m_appId);
+    LogInfo("Push Package id: " << m_pkgId);
 
-    ret = push_connect(m_appId, push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
+    ret = push_connect(m_pkgId, push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
     if (PUSH_ERROR_NONE!=ret) {
         LogError("Error while connecting to the push service: "<<ret);
         return;
@@ -315,6 +318,10 @@ PushManager::~PushManager()
         free(m_appId);
     }
 
+    if(m_pkgId) {
+        free(m_pkgId);
+    }
+
     push_disconnect(m_connectionHandle);
 }
 
index f19755d..71ef948 100755 (executable)
@@ -33,6 +33,7 @@ class PushManager : public IPushManager
     virtual ~PushManager();
 
     char* m_appId;
+    char* m_pkgId;
     push_state_e m_connectionState;
     push_connection_h m_connectionHandle;
     OnPushNotifiedEmitterPtr m_emitter;
index 3f22d5e..1b9abb0 100755 (executable)
@@ -2,13 +2,11 @@ SET(TARGET_NAME ${secureelement_target})
 SET(DESTINATION_NAME ${secureelement_dest})
 SET(TARGET_IMPL_NAME ${secureelement_impl})
 
-PKG_SEARCH_MODULE(smartcard-service REQUIRED smartcard-service)
-PKG_SEARCH_MODULE(smartcard-service-common REQUIRED smartcard-service-common )
+PKG_CHECK_MODULES(platform_pkgs_secureelement REQUIRED smartcard-service smartcard-service-common)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
-       ${smartcard-service_INCLUDE_DIRS}
-       ${smartcard-service-common_INCLUDE_DIRS}
+       ${platform_pkgs_secureelement_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -41,6 +39,7 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
+       ${platform_pkgs_secureelement_LIBRARIES}
 )
 
 SET(SRCS
@@ -51,13 +50,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
-       ${smartcard-service_LIBRARIES}
-       ${smartcard-service-common_LIBRARIES}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/secureelement
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/secureelement
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )
old mode 100755 (executable)
new mode 100644 (file)
index 79496c5..34b5c54
@@ -1,12 +1,17 @@
 SET(TARGET_NAME ${systemsetting_target})
 SET(DESTINATION_NAME ${systemsetting_dest})
 
-PKG_SEARCH_MODULE(capi-system-system-settings REQUIRED capi-system-system-settings)
+PKG_CHECK_MODULES(platform_pkgs_systemsetting REQUIRED capi-system-system-settings)
 
 INCLUDE_DIRECTORIES(
-       ${capi-system-system-settings_INCLUDE_DIRS}
        ${TOP}/Common
        ${TOP}/Filesystem
+       ${platform_pkgs_systemsetting_INCLUDE_DIRS}
+)
+
+SET(CMAKE_INSTALL_RPATH
+       ${CMAKE_INSTALL_RPATH}
+       ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
 )
 
 SET(SRCS
@@ -21,23 +26,18 @@ SET(SRCS
        SystemSettingAsyncCallbackManager.cpp
 )
 
-SET(CMAKE_INSTALL_RPATH
-       ${CMAKE_INSTALL_RPATH}
-       ${CMAKE_INSTALL_PREFIX}/${DESTINATION_LIB_PREFIX}/${filesystem_dest}
-)
-
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${LIBS_COMMON}
-       ${capi-system-system-settings_LIBRARIES}
        ${filesystem_impl}
-       ${filesystem_config}
+       "-Wl,--no-as-needed" ${filesystem_config}
+       ${platform_pkgs_systemsetting_LIBRARIES}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systemsetting
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systemsetting
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 6737a72..659f224 100755 (executable)
@@ -2,21 +2,17 @@ SET(TARGET_NAME ${systeminfo_target})
 SET(DESTINATION_NAME ${systeminfo_dest})
 SET(TARGET_IMPL_NAME ${systeminfo_impl})
 
-PKG_SEARCH_MODULE(capi-telephony-sim REQUIRED capi-telephony-sim)
-PKG_SEARCH_MODULE(capi-network-connection REQUIRED capi-network-connection)
-PKG_SEARCH_MODULE(capi-system-info REQUIRED capi-system-info)
-PKG_SEARCH_MODULE(capi-system-runtime-info REQUIRED capi-system-runtime-info)
-PKG_SEARCH_MODULE(capi-system-sensor REQUIRED capi-system-sensor)
-PKG_SEARCH_MODULE(sys_sensor REQUIRED sensor)
-
+PKG_CHECK_MODULES(platform_pkgs_systeminfo REQUIRED
+       capi-telephony-sim
+       capi-network-connection
+       capi-system-info
+       capi-system-runtime-info
+       capi-system-sensor
+       sensor
+)
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
-       ${capi-telephony-sim_INCLUDE_DIRS}
-       ${capi-network-connection_INCLUDE_DIRS}
-       ${capi-system-info_INCLUDE_DIRS}
-       ${capi-system-runtime-info_INCLUDE_DIRS}
-       ${capi-system-sensor_INCLUDE_DIRS}
-       ${sys_sensor_INCLUDE_DIRS}
+       ${platform_pkgs_systeminfo_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -29,7 +25,7 @@ SET(SRCS_IMPL
        EventGetSysteminfo.cpp
        EventWatchSysteminfo.cpp
        ISysteminfo.cpp
-       Systeminfo.cpp 
+       Systeminfo.cpp
        JSDisplayInfo.cpp
        JSStorageInfo.cpp
        JSCpuInfo.cpp
@@ -37,11 +33,11 @@ SET(SRCS_IMPL
        JSCellularNetworkInfo.cpp
        JSBatteryInfo.cpp
        JSNetworkInfo.cpp
-       JSSIMInfo.cpp  
+       JSSIMInfo.cpp
        JSDeviceOrientationInfo.cpp
        JSBuildInfo.cpp
        JSLocaleInfo.cpp
-       JSDeviceCapabilitiesInfo.cpp  
+       JSDeviceCapabilitiesInfo.cpp
        JSPeripheralInfo.cpp
        JSSysteminfo.cpp
        SysteminfoAsyncCallbackManager.cpp
@@ -53,12 +49,7 @@ ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
        ${LIBS_COMMON}
-       ${capi-telephony-sim_LIBRARIES}
-       ${capi-network-connection_LIBRARIES}
-       ${capi-system-info_LIBRARIES}
-       ${capi-system-runtime-info_LIBRARIES}
-       ${capi-system-sensor_LIBRARIES}
-       ${sys_sensor_LIBRARIES}
+       ${platform_pkgs_systeminfo_LIBRARIES}
 )
 
 SET(SRCS
@@ -75,6 +66,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systeminfo
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/systeminfo
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 6945cfb..c41b66c 100755 (executable)
@@ -2,11 +2,11 @@ SET(TARGET_NAME ${timeutil_target})
 SET(DESTINATION_NAME ${timeutil_dest})
 SET(TARGET_IMPL_NAME ${timeutil_impl})
 
-PKG_SEARCH_MODULE(pkgs_time REQUIRED icu-i18n icu-io icu-le icu-lx icu-uc )
+PKG_CHECK_MODULES(platform_pkgs_time REQUIRED icu-i18n icu-io icu-le icu-lx icu-uc )
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
-       ${pkgs_time_INCLUDE_DIRS}
+       ${platform_pkgs_time_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -43,6 +43,6 @@ TARGET_LINK_LIBRARIES(${TARGET_NAME}
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/timeutil
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
-)
\ No newline at end of file
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/timeutil
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+)
index 651ad65..8ed84d6 100755 (executable)
@@ -597,8 +597,7 @@ JSValueRef JSTZDate::toUTC(JSContextRef context, JSObjectRef function,
                }
 
                TZDatePtr tzDate(privateObject->getObject());
-               TZDateProperties result = tzDate->toUTC();
-               return (static_cast<JSValueRef>(createJSObject(context, result)));
+               return createJSObject(context, tzDate->getTime(), tzDate->getUTCTimezoneName());
        } Catch(NullPointerException) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
@@ -626,8 +625,7 @@ JSValueRef JSTZDate::toLocalTimezone(JSContextRef context, JSObjectRef function,
                }
 
                TZDatePtr tzDate(privateObject->getObject());
-               TZDateProperties result = tzDate->toLocalTimezone();
-               return (static_cast<JSValueRef>(createJSObject(context, result)));
+               return createJSObject(context, tzDate->getTime(), tzDate->getLocalTimezoneName());
        } Catch(NullPointerException) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
index fa23d79..17b5108 100755 (executable)
@@ -220,6 +220,10 @@ TZDateProperties TZDate::_makeProperties(Calendar *cal)
        return result;
 }
 
+TZDateProperties TZDate::makeProperties() {
+       return _makeProperties(myCalendar);
+}
+
 std::string TZDate::getTimezone()
 {
        return _getTimezoneName(myCalendar);
@@ -465,42 +469,24 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) {
        return result;
 }
 
-TZDateProperties TZDate::toUTC() {
-       LogDebug("entered");
+std::string TZDate::getUTCTimezoneName() {
+       UnicodeString id;
        TimeUtilTools util;
-       TZDateProperties result;
-       Calendar *utcCalendar = myCalendar->clone();
 
-       try {
-               utcCalendar->setTimeZone(*(TimeZone::getGMT()));
-               result = _makeProperties(utcCalendar);
-               util.printDate(utcCalendar);
-               delete utcCalendar;
-       } catch (Commons::PlatformException) {
-               delete utcCalendar;
-               ThrowMsg(Commons::PlatformException, "Calendar error in toUTC");
-       }
-
-       return result;
+       TimeZone::getGMT()->getID(id);
+       std::string s_result = util.toString(id);
+       LogDebug(s_result);
+       return s_result;
 }
 
-TZDateProperties TZDate::toLocalTimezone() {
-       LogDebug("entered");
+std::string TZDate::getLocalTimezoneName() {
+       UnicodeString id;
        TimeUtilTools util;
-       TZDateProperties result;
-       Calendar *localCalendar = myCalendar->clone();
-
-       try {
-               localCalendar->setTimeZone(*(TimeZone::createDefault()));
 
-               result = _makeProperties(localCalendar);
-               util.printDate(localCalendar);
-               delete localCalendar;
-       } catch (Commons::PlatformException) {
-               delete localCalendar;
-               ThrowMsg(Commons::PlatformException, "Calendar error in toLocalTimezone");
-       }
-       return result;  
+       TimeZone::createDefault()->getID(id);
+       std::string s_result = util.toString(id);
+       LogDebug(s_result);
+       return s_result;
 }
 
 double TZDate::getTime() {
index 8716125..7fe7995 100755 (executable)
@@ -79,8 +79,9 @@ class TZDate
 
                virtual long long difference(const TZDateProperties &prop);
                virtual TZDateProperties addDuration(const DurationProperties &duration);
-               virtual TZDateProperties toUTC();
-               virtual TZDateProperties toLocalTimezone();
+               virtual std::string getUTCTimezoneName();
+               virtual std::string getLocalTimezoneName();
+               virtual TZDateProperties makeProperties();
 
                virtual double getTime();
                virtual bool setTime(const double time);
index 43508ba..2264afc 100755 (executable)
@@ -180,6 +180,8 @@ std::string TimeUtil::getTimeFormat(){
        TimeUtilTools util;
        UnicodeString timeFormat = util.getDateTimeFormat(TimeUtilTools::TIME_FORMAT, true);
        timeFormat = timeFormat.findAndReplace("H", "h");
+       timeFormat = timeFormat.findAndReplace("K", "h");
+       timeFormat = timeFormat.findAndReplace("k", "h");
        timeFormat = timeFormat.findAndReplace("a", "ap");
 
        int32_t i = 0;
index a42ed3c..9ec245b 100755 (executable)
@@ -269,8 +269,11 @@ tm TimeUtilConverter::toTZDateTime(JSObjectRef arg) {
        }
 
        TZDatePtr tzDate = privateObject->getObject();
+       TZDatePtr utcTzDate(new TZDate(tzDate->getUTCTimezoneName()));
+       if (!utcTzDate->setTime(tzDate->getTime()))
+               ThrowMsg(Commons::ConversionException, "Can not set UTC Time");
 
-       TZDateProperties utcProperties = tzDate->toUTC();
+       TZDateProperties utcProperties = utcTzDate->makeProperties();
        struct tm  utcTm;
        memset(&utcTm, 0, sizeof(utcTm));
 
index 60d5074..37ad489 100644 (file)
@@ -3,12 +3,12 @@ SET(DESTINATION_NAME ${tizen_dest})
 SET(TARGET_IMPL_NAME ${tizen_impl})
 SET(TARGET_CONFIG_NAME ${tizen_config})
 
-PKG_SEARCH_MODULE(wrt-plugins-plugin-manager REQUIRED wrt-plugins-plugin-manager)
+PKG_CHECK_MODULES(platform_pkgs_tizen REQUIRED wrt-plugins-plugin-manager)
 
 INCLUDE_DIRECTORIES(
        ${TOP}/Common
        ${TOP}/TimeUtil
-       ${wrt-plugins-plugin-manager_INCLUDE_DIRS}
+       ${platform_pkgs_tizen_INCLUDE_DIRS}
 )
 
 SET(CMAKE_INSTALL_RPATH
@@ -38,27 +38,26 @@ SET(SRCS_IMPL
        JSFeature.cpp
        JSFeatureParam.cpp
        PluginOnDemandPriv.cpp
+       JSTizen.cpp
 )
 
 ADD_LIBRARY(${TARGET_IMPL_NAME} SHARED ${SRCS_IMPL})
 
 TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
-       ${LIBS_WIDGETDB}
        ${LIBS_COMMON}
-       ${wrt-plugins-plugin-manager_LIBRARIES}
+       ${LIBS_WIDGETDB}
+       ${platform_pkgs_tizen_LIBRARIES}
+       ${timeutil_impl}
 )
 
 SET(SRCS_CONFIG
-       JSTizen.cpp
        plugin_config.cpp
 )
 
 ADD_LIBRARY(${TARGET_CONFIG_NAME} SHARED ${SRCS_CONFIG})
 
 TARGET_LINK_LIBRARIES(${TARGET_CONFIG_NAME}
-       ${LIBS_WIDGETDB}
        ${LIBS_COMMON}
-       ${wrt-plugins-plugin-manager_LIBRARIES}
 )
 
 SET(SRCS
@@ -70,12 +69,11 @@ ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${TARGET_NAME}
        ${TARGET_IMPL_NAME}
        ${TARGET_CONFIG_NAME}
-       ${timeutil_impl}
 )
 
 INSTALL(TARGETS ${TARGET_NAME} ${TARGET_CONFIG_NAME} ${TARGET_IMPL_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${DESTINATION_LIB_PREFIX}/${DESTINATION_NAME})
 INSTALL(
-        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/tizen
-        FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
+       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DESTINATION_HEADER_PREFIX}/tizen
+       FILES_MATCHING PATTERN "*.h" PATTERN "CMakeFiles" EXCLUDE
 )