Update change log and spec for wrt-plugins-tizen_0.4.13
authorDongjin Choi <milkelf.choi@samsung.com>
Fri, 29 Mar 2013 11:47:51 +0000 (20:47 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Fri, 29 Mar 2013 11:47:51 +0000 (20:47 +0900)
[Issue#] N/A
[Problem] N/A
[Cause]  N/A
[Solution] Secure Element's privilege is changed. Previous privilege will be deprecated

[Issue#] DCM-1021
[Problem] Crash when trying to set a null value to the event rrule
[Cause] No care for null/undefined value.
[Solution] Separate routien for null/undefined value for event rrule

[Issue#] N/A
[Problem] progress value property don't work in StatusNotification Constructor.
[Cause] progress update function has omitted
[Solution] progress update function will work when PROGRESS mode in the constructor.

[Issue#] N/A
[Problem] static member is temporary solution
[Cause] N/A
[Solution] Set object attributes into created JS object

[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Add errors and exceptions of OpenMobileAPI

[Issue#] DCM-1058
[Problem] Calling "removeBatch" with null id causes a crash.
[Cause] No null handling for removeBatch.
[Solution] Ignore invalid ids for removeBatch input parameter.

[Issue#] N_SE-30207, N_SE-30206
[Problem] Bugs in enum conversion routine for sync type and interval.
[Cause] Wrong enum conversion between platform and JS.
[Solution] Fix bugs in enum conversion routines.

[Issue#] Felica QA
[Problem] Raise IOError although the dir to delete does not exist.
[Cause] Wrong error raise.
[Solution] Error code modification.

[Issue#] DCM-1105
[Problem] Platform error while creating download. Full of available simultaneous downloads.
[Cause] Download F/W allows maximum 5 download session at time.
[Solution] Fixed to close download handle when the download session is finished.

[Issue#] DCM-1081
[Problem] sort parameter null is not working
[Cause] if sort is null offset and limit is not set
[Solution] sort check routine fix

[Issue#] TDIST-162
[Problem] findMessages with filter isRead on email bug fix
[Cause] mail_tbl attribute name changed.
[Solution] change isRead name to proper mail_tbl name

[Issue#] N_SE-29576
[Problem] No exception thrown for wrong enum value for AlarmAbsolute Constructor
[Cause] N/A
[Solution] throw exception

[Issue#] N/A
[Problem] Converting issue.
[Cause] wrong regular expression is used.
[Solution] use to std library

[Issue#] DCM-1106, DCM-1146
[Problem] Not support DESC sorting mode, freeze
[Cause] missing code, contacts-service-ipcd crash
[Solution] change code

[Issue#] DCM-828
[Problem] converting issue from struct tm
[Cause]  converting issue from struct tm
[Solution] if release date is not set, return the undefined

[Issue#] N/A
[Problem] Array.isArray test failed for platform arrays such as exceptions, setPositions, daysOfTheWeek, categories.
[Cause] Platform array doesn't support array test.
[Solution] Use JSC array interface instead of our own platform array object.

[Issue#] N/A
[Problem] Widget crash when progress CB is called.
[Cause] Wrong uri type from platform test code.
[Solution] Fix callback parameter type and relevent bugs.

[Issue#] N/A
[Problem] N/A
[Cause]  N/A
[Solution] Secure Element's privilege is changed. And apis and an attribute related to card emulation are removed.

[Issue#] DCM-992
[Problem] DCM wants to access another path, not virtual path.
[Cause] tizen policy blocks the file path except virtual path.
[Solution] modification.

[Issue#] DCM-1141
[Problem] read column bigger than 300byte fail.
[Cause] wrong memory size reservation
[Solution] memory size modification.

[Issue#] DCM-1087/DCM_1132
[Problem] sync and syncFolder successCallback is not called
[Cause] sync and syncFolder event is rewrited
[Solution] save each event

[Issue#] DCM-1043, DCM-1090, DCM-1094
[Problem] DCM-1043 : When celluar network is connected lte, Web api send wrong informaion.
DCM-1094 : Mcc value is incorrect.
DCM-1090 : Networkbearerselection exception is incorrect.
[Cause] internal bug
[Solution] modification.

[SCMRequest] N/A

164 files changed:
packaging/wrt-plugins-tizen.spec
pkgconfigs/wrt-plugins-tizen-alarm.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-application.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-bluetooth.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-bookmark.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-calendar.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-callhistory.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-common.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-contact.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-content.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-datacontrol.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-datasync.pc.in
pkgconfigs/wrt-plugins-tizen-download.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-filesystem.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-log.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-messageport.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-messaging.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-networkbearerselection.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-nfc.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-notification.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-package.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-power.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-push.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-secureelement.pc.in
pkgconfigs/wrt-plugins-tizen-systeminfo.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-systemsetting.pc.in [changed mode: 0755->0644]
pkgconfigs/wrt-plugins-tizen-timeutil.pc.in
pkgconfigs/wrt-plugins-tizen-tizen.pc.in [changed mode: 0755->0644]
src/Alarm/JSAlarmAbsolute.cpp
src/Bluetooth/JSBluetoothDevice.cpp
src/Bluetooth/JSBluetoothDevice.h
src/Bluetooth/JSBluetoothManager.cpp
src/Bluetooth/JSBluetoothManager.h
src/Bluetooth/JSBluetoothSocket.cpp
src/Bluetooth/JSBluetoothSocket.h
src/Calendar/CMakeLists.txt
src/Calendar/Calendar.cpp
src/Calendar/CalendarConverter.cpp
src/Calendar/CalendarConverter.h
src/Calendar/CalendarEvent.cpp
src/Calendar/CalendarEvent.h
src/Calendar/EventRecurrenceRule.cpp
src/Calendar/EventRecurrenceRule.h
src/Calendar/JSCalendar.cpp
src/Calendar/JSCalendarEvent.cpp
src/Calendar/JSCalendarEvent.h
src/Calendar/JSCalendarItemProperties.cpp
src/Calendar/JSCalendarItemProperties.h
src/Calendar/JSCalendarRecurrenceRule.cpp
src/Calendar/JSCalendarTask.cpp
src/Calendar/JSCalendarTask.h
src/Calendar/JSNumberArray.cpp [deleted file]
src/Calendar/JSNumberArray.h [deleted file]
src/Calendar/JSStringArray.cpp [deleted file]
src/Calendar/JSStringArray.h [deleted file]
src/Calendar/JSTZDateArray.cpp [deleted file]
src/Calendar/JSTZDateArray.h [deleted file]
src/Calendar/plugin_initializer.cpp
src/Callhistory/CallHistory.cpp
src/Callhistory/CallHistory.h
src/Callhistory/CallHistoryMultiCallback.cpp
src/Callhistory/CallHistoryMultiCallback.h
src/Callhistory/CallHistoryStaticController.cpp
src/Callhistory/Converter.cpp
src/Callhistory/EventCallHistoryListener.cpp
src/Callhistory/EventCallHistoryListener.h
src/Common/ArgumentValidator.cpp
src/Common/ArgumentValidator.h
src/Common/AsyncCallbackManager.h [changed mode: 0755->0644]
src/Common/CallbackUserData.cpp [changed mode: 0755->0644]
src/Common/CallbackUserData.h [changed mode: 0755->0644]
src/Common/GlobalContextManager.cpp [changed mode: 0755->0644]
src/Common/GlobalContextManager.h [changed mode: 0755->0644]
src/Common/IListenerManager.h [changed mode: 0755->0644]
src/Common/JSTizenException.cpp [changed mode: 0755->0644]
src/Common/JSTizenException.h [changed mode: 0755->0644]
src/Common/JSTizenExceptionFactory.cpp [changed mode: 0755->0644]
src/Common/JSTizenExceptionFactory.h [changed mode: 0755->0644]
src/Common/JSUtil.h
src/Common/JSWebAPIError.cpp [changed mode: 0755->0644]
src/Common/JSWebAPIError.h [changed mode: 0755->0644]
src/Common/PlatformException.cpp [changed mode: 0755->0644]
src/Common/PlatformException.h [changed mode: 0755->0644]
src/Common/SecurityExceptions.h [changed mode: 0755->0644]
src/Common/StandaloneConsole/CMakeLists.txt [changed mode: 0755->0644]
src/Common/StandaloneConsole/JSConsole.h [changed mode: 0755->0644]
src/Common/StandaloneConsole/StandaloneConsole.h [changed mode: 0755->0644]
src/Common/TizenExceptionData.cpp [changed mode: 0755->0644]
src/Common/TizenExceptionData.h [changed mode: 0755->0644]
src/Contact/AddressBook.cpp
src/Contact/ContactObjectA2PConverter.cpp
src/Contact/ContactObjectP2AConverter.cpp
src/Contact/ContactQueue.cpp
src/Contact/ContactSearchEngine.cpp
src/Contact/ContactUtility.cpp
src/Content/ContentFolder.cpp
src/Content/ContentFolder.h
src/Content/ContentManager.cpp
src/Content/ContentManager.h
src/Content/ContentMedia.cpp
src/Content/ContentMedia.h
src/Content/ContentUtility.cpp
src/Content/ContentUtility.h
src/Content/JSContent.cpp
src/Content/JSFolder.cpp
src/DataControl/SelectDataObject.cpp
src/DataSync/DataSyncConverter.cpp
src/DataSync/DataSyncManager.cpp
src/DataSync/JSDataSyncManager.cpp
src/Download/DownloadManager.cpp
src/Download/JSDownloadRequest.cpp
src/Filesystem/FilesystemUtils.cpp
src/Filesystem/FilesystemUtils.h
src/Filesystem/JSFile.cpp
src/Filesystem/ResponseDispatcher.cpp
src/Messaging/DBus/Connection.cpp
src/Messaging/IMessagingService.h
src/Messaging/JSMessagingService.cpp [changed mode: 0755->0644]
src/Messaging/MailSender.cpp
src/Messaging/MailSync.cpp
src/Messaging/MessageQueryGenerator.cpp
src/Messaging/Messaging.cpp
src/Messaging/MessagingService.cpp
src/Messaging/MessagingService.h
src/Messaging/SyncNetworkStatus.cpp
src/Messaging/messageDB/MessageStorageReader.cpp
src/NFC/EventNFCChanged.h
src/NFC/INFCAdapter.cpp
src/NFC/INFCAdapter.h
src/NFC/JSNFCAdapter.cpp [changed mode: 0644->0755]
src/NFC/JSNFCAdapter.h
src/NFC/NFCAdapter.cpp [changed mode: 0644->0755]
src/NFC/NFCAdapter.h
src/NFC/NFCConverter.cpp
src/NFC/NFCConverter.h
src/NFC/NFCDefaultAdapter.cpp [changed mode: 0644->0755]
src/NFC/NFCDefaultAdapter.h
src/NFC/NFCListenerManager.h [changed mode: 0644->0755]
src/NFC/NFCStaticController.cpp [changed mode: 0644->0755]
src/NFC/NFCStaticController.h
src/NFC/NFCUtil.cpp [changed mode: 0644->0755]
src/NFC/NFCUtil.h
src/NetworkBearerSelection/JSNetworkBearerSelection.cpp
src/Notification/NotificationLine.cpp
src/Notification/StatusNotification.cpp
src/SecureElement/CMakeLists.txt
src/SecureElement/EventSEService.h
src/SecureElement/JSSEChannel.cpp [changed mode: 0644->0755]
src/SecureElement/JSSEReader.cpp [changed mode: 0644->0755]
src/SecureElement/JSSEService.cpp [changed mode: 0644->0755]
src/SecureElement/JSSESession.cpp [changed mode: 0644->0755]
src/SecureElement/SEChannel.cpp
src/SecureElement/SEConverter.cpp
src/SecureElement/SEConverter.h
src/SecureElement/SEReader.cpp
src/SecureElement/SEResponseDispatcher.cpp
src/SecureElement/SESession.cpp
src/SecureElement/SEUtil.cpp
src/SecureElement/SEUtil.h
src/SecureElement/config.xml
src/SecureElement/plugin_config.cpp [new file with mode: 0755]
src/SecureElement/plugin_config.h [new file with mode: 0755]
src/Systeminfo/Systeminfo.cpp
src/Tizen/JSFeature.cpp

index daef2ff..f1eafc3 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.12
-Release:    1
+Version:    0.4.13
+Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
 Source0:    %{name}-%{version}.tar.gz
old mode 100755 (executable)
new mode 100644 (file)
index 3109f46..7ba86aa
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-application
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 0ac3dc6..d90c038
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-app-manager capi-appfw-application capi-appfw-package-manager pkgmgr pkgmgr-info
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d76b580..7b03f29
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-network-bluetooth
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 72b9e1e..f8109d2
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-web-favorites
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 664e822..0590345
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: calendar-service2 icu-i18n
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
old mode 100755 (executable)
new mode 100644 (file)
index 6325dfb..3a512ba
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: contacts-service2 glib-2.0 libpcrecpp
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 758eb7a..b9f163f
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: contacts-service2 libpcrecpp capi-web-url-download
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index b0a3847..69c4601
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-content-media-content  capi-media-metadata-extractor
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d7cf242..cb10aa0
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-application appsvc pkgmgr
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
index 582af64..49ca8bc 100644 (file)
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: sync-agent
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
old mode 100755 (executable)
new mode 100644 (file)
index 311a1ef..a703343
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-web-url-download
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-imp
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 106f82f..c9c5995
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires:
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 486097f..166ec31
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: osp-appfw capi-appfw-app-manager
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 52c8807..b186586
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: msg-service email-service dbus-1
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 90393d7..421f6ee
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-network-connection
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 561a246..187e0a1
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-network-nfc
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 2868c81..8795fe0
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-application
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 88fe80f..5f80e24
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-appfw-app-manager capi-appfw-package-manager wrt-deviceapis-commons wrt-deviceapis-commons-javascript pkgmgr pkgmgr-info
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index d0961f7..d113da9
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-system-power pmapi capi-system-device
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 8fc93e7..25dce1b 100644 (file)
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: smartcard-service smartcard-service-common 
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
old mode 100755 (executable)
new mode 100644 (file)
index fdec6fe..4219c95
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: capi-telephony-sim capi-network-connection capi-system-info capi-system-runtime-info capi-system-sensor sensor
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
index dcf9806..a6bbc6b 100644 (file)
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: icu-i18n icu-io icu-le icu-lx icu-uc 
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 8b5303c..8b86ec4
@@ -9,5 +9,5 @@ Name: wrt-plugins-tizen-${module_name}
 Description: wrt-plugins-tizen-${module_name}
 Version: @CMAKE_PROJECT_VERSION@
 Requires: wrt-plugins-plugin-manager
-Libs: -L${libdir} -lwrt-plugins-tizen-${module_name} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
+Libs: -L${libdir} -lwrt-plugins-tizen-${module_name}-impl -lwrt-plugins-tizen-${module_name}-config
 Cflags: -I${includedir}/${module_name}
\ No newline at end of file
index 23d1e2f..306f4c4 100755 (executable)
@@ -134,7 +134,18 @@ JSObjectRef JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRef construct
         {
             if(JSIsArrayValue(ctx, arguments[1])) {
                 std::vector<std::string> daysOfTheWeek = converter.toVectorOfStrings(arguments[1]);
-                if(daysOfTheWeek.size() >0) {
+
+                for( int i = 0; i< daysOfTheWeek.size(); i++ )
+                {
+                    if( (daysOfTheWeek[i]!="SU") && (daysOfTheWeek[i]!="MO") &&
+                        (daysOfTheWeek[i]!="TU") && (daysOfTheWeek[i]!="WE") &&
+                        (daysOfTheWeek[i]!="TH") && (daysOfTheWeek[i]!="FR") &&
+                        (daysOfTheWeek[i]!="SA") ) {
+                        ThrowMsg(ConversionException, "Invalid days of the week value.");
+                    }
+                }
+
+                if(daysOfTheWeek.size() > 0) {
                     privateData->setByDayRecurrence(daysOfTheWeek);    
                 }
             } else {
index 7d60493..f5e7c84 100644 (file)
@@ -32,6 +32,7 @@
 #include "JSBluetoothClass.h"
 #include "BluetoothConverter.h"
 #include "plugin_config.h"
+#include "JSUtil.h"
 
 using namespace std;
 using namespace DPL;
@@ -71,7 +72,6 @@ JSStaticFunction JSBluetoothDevice::m_function[] =
 JSStaticValue JSBluetoothDevice::m_properties[] = {
        {"name", getName, NULL, kJSPropertyAttributeReadOnly},
        {"address", getAddress, NULL, kJSPropertyAttributeReadOnly},
-       {"deviceClass", getDeviceClass, NULL, kJSPropertyAttributeReadOnly},
        {"isBonded", getBondProperty, NULL, kJSPropertyAttributeReadOnly},
        {"isTrusted", getTrustProperty, NULL, kJSPropertyAttributeReadOnly},
        {"isConnected", getConnectProperty, NULL, kJSPropertyAttributeReadOnly},
@@ -94,8 +94,6 @@ const JSClassDefinition* JSBluetoothDevice::getClassInfo()
 
 JSClassRef JSBluetoothDevice::m_jsClassRef = JSClassCreate(JSBluetoothDevice::getClassInfo());
 
-JSObjectRef JSBluetoothDevice::m_deviceClass = NULL;
-
 void JSBluetoothDevice::initialize(JSContextRef context, JSObjectRef object) 
 {
        LogDebug("initialize ");
@@ -115,10 +113,10 @@ void JSBluetoothDevice::initialize(JSContextRef context, JSObjectRef object)
        }
        else
        {
-               LogDebug("already exist");
+               LogDebug("already exist");              
        }
 
-
+       setAttributesIntoJSObject(context, object);     
 }
 
 void JSBluetoothDevice::finalize(JSObjectRef object) 
@@ -214,40 +212,6 @@ JSValueRef JSBluetoothDevice::getAddress(JSContextRef context,
        
        return NULL;
 }
-JSValueRef JSBluetoothDevice::getDeviceClass(JSContextRef context,
-                                                       JSObjectRef object,
-                                                       JSStringRef propertyName,
-                                                       JSValueRef* exception)
-{
-       LogDebug("Enter");      
-
-       if(m_deviceClass == NULL)
-       {
-               JSBluetoothDevicePriv *priv = static_cast<JSBluetoothDevicePriv*>(JSObjectGetPrivate(object));
-
-               Try
-               {
-                       if (priv == NULL)
-                       {
-                               ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is NULL.");
-                       }
-                       IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
-                       BluetoothDeviceDataClass devClass = BluetoothDeviceManager->getClass();
-
-                       LogDebug("Major:" << std::hex << devClass.major << "Minor:" << std::hex << devClass.minor << "Service Mask:" << std::hex <<  devClass.majorServiceMask);
-
-                       m_deviceClass = JSBluetoothClass::createJSObject(priv->getContext(), devClass);
-               }
-               Catch(WrtDeviceApis::Commons::Exception)
-               {
-                       LogWarning("Exception"<<_rethrown_exception.GetMessage());
-                       return JSValueMakeUndefined(context);
-               }
-       }
-       
-       return m_deviceClass;
-
-}
 JSValueRef JSBluetoothDevice::getBondProperty(JSContextRef context,
                                                        JSObjectRef object,
                                                        JSStringRef propertyName,
@@ -499,6 +463,31 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context, JSObj
 
        return JSValueMakeUndefined(context);
 }
+
+void JSBluetoothDevice::setAttributesIntoJSObject(JSContextRef context, JSObjectRef object)
+{
+       // deviceClass
+       Try
+       {       
+               JSBluetoothDevicePriv *priv = static_cast<JSBluetoothDevicePriv*>(JSObjectGetPrivate(object));
+               if (priv == NULL)
+               {
+                       ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is NULL.");
+               }
+               IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
+               BluetoothDeviceDataClass devClass = BluetoothDeviceManager->getClass();
+
+               LogDebug("Major:" << std::hex << devClass.major << "Minor:" << std::hex << devClass.minor << "Service Mask:" << std::hex <<  devClass.majorServiceMask);
+               
+               JSUtil::setProperty(context, object, "deviceClass",
+                               JSBluetoothClass::createJSObject(priv->getContext(), devClass), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete);
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("Exception"<<_rethrown_exception.GetMessage());              
+       }
+}
+
 }
 }
 
index 848d1fa..1d87e6a 100644 (file)
@@ -45,7 +45,6 @@ private:
                JSValueRef possibleInstance, JSValueRef* exception);
        static JSValueRef getName(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static JSValueRef getAddress(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
-       static JSValueRef getDeviceClass(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static JSValueRef getBondProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static JSValueRef getTrustProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static JSValueRef getConnectProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
@@ -53,11 +52,16 @@ private:
        static JSValueRef connectToServiceByUUID(JSContextRef context, JSObjectRef object,
                JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
                JSValueRef* exception);
+       /**
+        * Sets attributes into JS object.
+        */
+       static void setAttributesIntoJSObject(JSContextRef context,
+                       JSObjectRef object);    
+       
        static JSClassDefinition m_classInfo;
        static JSStaticFunction m_function[];
        static JSStaticValue m_properties[];
        static JSClassRef m_jsClassRef;
-       static JSObjectRef m_deviceClass;
 };
 
 } 
index 28546b1..82390d2 100644 (file)
@@ -33,6 +33,7 @@
 #include "JSBluetoothClassDeviceMinor.h"
 #include "JSBluetoothClassDeviceService.h"
 #include "plugin_config.h"
+#include "JSUtil.h"
 
 using namespace WrtDeviceApis::Commons;
 using namespace DeviceAPI::Common;
@@ -47,10 +48,6 @@ namespace DeviceAPI {
 namespace Bluetooth {
 
 JSClassRef JSBluetoothManager::m_jsClassRef = NULL;
-JSObjectRef JSBluetoothManager::m_deviceMajor = NULL;
-JSObjectRef JSBluetoothManager::m_deviceMinor = NULL;
-JSObjectRef JSBluetoothManager::m_deviceService = NULL;
-
 
 JSClassDefinition JSBluetoothManager::m_classInfo =
 {
@@ -58,7 +55,7 @@ JSClassDefinition JSBluetoothManager::m_classInfo =
        kJSClassAttributeNone,
        "BluetoothManager",
        NULL,
-       m_properties,
+       NULL,
        m_function,
        initialize,
        finalize,
@@ -80,17 +77,6 @@ JSStaticFunction JSBluetoothManager::m_function[] =
        { 0, 0, 0 }
 };
 
-
-JSStaticValue JSBluetoothManager::m_properties[] = 
-{
-       {DEVICE_MAJOR, getProperty, NULL, kJSPropertyAttributeReadOnly},
-       {DEVICE_MINOR, getProperty, NULL, kJSPropertyAttributeReadOnly},
-       {DEVICE_SERVICE, getProperty, NULL, kJSPropertyAttributeReadOnly},      
-       {0, 0, 0, 0}
-};
-
-
-
 const JSClassRef JSBluetoothManager::getClassRef() 
 {
        if (!m_jsClassRef) 
@@ -144,46 +130,6 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context, JSObjectR
        }
 }
 
-
-JSValueRef JSBluetoothManager::getProperty(JSContextRef context,
-                                       JSObjectRef object,
-                                       JSStringRef propertyName,
-                                       JSValueRef* exception)
-{
-       LogDebug("OK"); 
-       
-       Try
-       {
-               if(JSStringIsEqualToUTF8CString(propertyName, DEVICE_MAJOR)) 
-               {
-                       if(!m_deviceMajor)
-                               m_deviceMajor = JSBluetoothClassDeviceMajor::createJSObject(context);
-                       return m_deviceMajor;
-               }
-               else if(JSStringIsEqualToUTF8CString(propertyName, DEVICE_MINOR)) 
-               {
-                       if(!m_deviceMinor)
-                               m_deviceMinor = JSBluetoothClassDeviceMinor::createJSObject(context);
-                       return m_deviceMinor;
-               }
-               else if(JSStringIsEqualToUTF8CString(propertyName, DEVICE_SERVICE)) 
-               {
-                       if(!m_deviceService)
-                               m_deviceService = JSBluetoothClassDeviceService::createJSObject(context);
-                       return m_deviceService;
-               }
-
-       }
-       Catch (Exception)
-       {
-               LogWarning("Exception "<<_rethrown_exception.GetMessage());
-       }
-
-       return NULL;
-}
-
-
-
 const JSClassDefinition* JSBluetoothManager::getClassInfo() 
 {
        return &m_classInfo;
@@ -209,6 +155,8 @@ void JSBluetoothManager::initialize(JSContextRef context, JSObjectRef object)
                        delete priv;
                }
        }
+
+       setAttributesIntoJSObject(context, object);
 }
 
 void JSBluetoothManager::finalize(JSObjectRef object) 
@@ -229,6 +177,22 @@ bool JSBluetoothManager::hasInstance(JSContextRef context, JSObjectRef construct
 {
        return JSValueIsObjectOfClass(context, possibleInstance, getClassRef());
 }
+
+void JSBluetoothManager::setAttributesIntoJSObject(JSContextRef context, JSObjectRef object)
+{
+       // deviceMajor
+       JSUtil::setProperty(context, object, DEVICE_MAJOR,
+                       JSBluetoothClassDeviceMajor::createJSObject(context), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete);
+
+       // deviceMinor
+       JSUtil::setProperty(context, object, DEVICE_MINOR,
+                       JSBluetoothClassDeviceMinor::createJSObject(context), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete);
+
+       // deviceService
+       JSUtil::setProperty(context, object, DEVICE_SERVICE,
+                       JSBluetoothClassDeviceService::createJSObject(context), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete);
+}
+
 }
 }
 
index 180bd50..9cc2690 100644 (file)
@@ -39,17 +39,19 @@ private:
        static void initialize(JSContextRef context, JSObjectRef object);
        static void finalize(JSObjectRef object);
        static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception);
+       
+       /**
+        * Sets attributes into JS object.
+        */
+       static void setAttributesIntoJSObject(JSContextRef context,
+                       JSObjectRef object);
        static JSValueRef getDefaultAdapter(JSContextRef context, JSObjectRef object, 
                JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
                JSValueRef* exception) ;
-       static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);
        static JSClassDefinition m_classInfo;
        static JSStaticFunction m_function[];
        static JSStaticValue m_properties[];
        static JSClassRef m_jsClassRef;
-       static JSObjectRef m_deviceMajor;
-       static JSObjectRef m_deviceMinor;
-       static JSObjectRef m_deviceService;
 };
 }
 } 
index e11a8b3..ed4f80a 100644 (file)
@@ -34,6 +34,7 @@
 #include "BluetoothConverter.h"
 #include <bluetooth.h>
 #include "plugin_config.h"
+#include "JSUtil.h"
 
 using namespace std;
 using namespace DPL;
@@ -70,7 +71,6 @@ JSStaticValue JSBluetoothSocket::m_properties[] =
        {"uuid", getProperty, NULL, kJSPropertyAttributeReadOnly},
 //     {"protocol", getProperty, NULL, kJSPropertyAttributeReadOnly},
        {"state", getProperty, NULL, kJSPropertyAttributeReadOnly},
-       {"peer", getProperty, NULL, kJSPropertyAttributeReadOnly},
        {"onerror", getCallback, setProperty, kJSPropertyAttributeNone},
        {"onmessage", getCallback, setProperty, kJSPropertyAttributeNone},
        {"onclose", getCallback, setProperty, kJSPropertyAttributeNone},
@@ -102,8 +102,6 @@ const JSClassDefinition* JSBluetoothSocket::getClassInfo()
 
 JSClassRef JSBluetoothSocket::m_jsClassRef = JSClassCreate(JSBluetoothSocket::getClassInfo());
 
-JSObjectRef JSBluetoothSocket::m_peer = NULL;
-
 bool JSBluetoothSocket::setProperty(JSContextRef context, 
                                        JSObjectRef object,
                                        JSStringRef propertyName,
@@ -174,7 +172,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context,
 void JSBluetoothSocket::initialize(JSContextRef context, JSObjectRef object) 
 {
        LogDebug("JSBluetoothSocket::initialize ");
-       
+       setAttributesIntoJSObject(context, object);     
 }
 
 void JSBluetoothSocket::finalize(JSObjectRef object) 
@@ -242,7 +240,7 @@ JSObjectRef JSBluetoothSocket::createJSObject(JSContextRef context, BluetoothSoc
                        return JSTizenExceptionFactory::makeErrorObject(context,
                                JSTizenException::UNKNOWN_ERROR, "Unkown error");
                }
-       }               
+       }
 
        
 }
@@ -266,9 +264,6 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
        
        Try
        {
-               if(JSStringIsEqualToUTF8CString(propertyName, "peer") && m_peer != NULL)
-                       return m_peer;
-
                JSBluetoothSocketPriv *priv = static_cast<JSBluetoothSocketPriv*>(JSObjectGetPrivate(object));
                if (priv == NULL)
                {
@@ -292,12 +287,6 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context,
                        unsigned short int state = BluetoothSocketManager->getState();
                        return converter.toBluetoothStateJSValue(state);
                }
-               else
-               {
-                       BluetoothDeviceData device = BluetoothSocketManager->getPeer();
-                       m_peer = JSBluetoothDevice::createJSObject(priv->getContext(), device);
-                       return m_peer;
-               }
        }
        Catch(WrtDeviceApis::Commons::Exception)
        {
@@ -579,6 +568,34 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context, JSObjectRef object,
        }               
 }
 
+void JSBluetoothSocket::setAttributesIntoJSObject(JSContextRef context, JSObjectRef object)
+{
+       // peer
+       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");
+               }
+               
+               BluetoothDeviceData device = BluetoothSocketManager->getPeer();
+               JSUtil::setProperty(context, object, "peer",
+                               JSBluetoothDevice::createJSObject(priv->getContext(), device), kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete);
+       }
+       Catch(WrtDeviceApis::Commons::Exception)
+       {
+               LogWarning("Exception"<<_rethrown_exception.GetMessage());              
+       }
+}
+
 
 }
 }
index bcc65eb..799323d 100644 (file)
@@ -84,12 +84,17 @@ private:
                                JSStringRef propertyName,
                                JSValueRef* exception);
 
+       /**
+        * Sets attributes into JS object.
+        */
+       static void setAttributesIntoJSObject(JSContextRef context,
+                       JSObjectRef object);    
+
        static JSClassDefinition m_classInfo;
        static JSStaticFunction m_function[];
        static JSStaticValue m_properties[];
 
        static JSClassRef m_jsClassRef;
-       static JSObjectRef m_peer;
        
 };
 
index f661033..ac9b70c 100755 (executable)
@@ -32,9 +32,6 @@ SET(SRCS_IMPL
        JSCalendarAttendee.cpp
        JSCalendarRecurrenceRule.cpp
        JSCalendarAlarm.cpp
-       JSStringArray.cpp
-       JSNumberArray.cpp
-       JSTZDateArray.cpp
        CalendarAsyncCallbackManager.cpp
        CalendarListenerManager.cpp
        Calendar.cpp
index 82f139e..f10593f 100755 (executable)
@@ -1144,11 +1144,11 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event)
                        et.type = CALENDAR_TIME_LOCALTIME;
                        et.time.date = CalendarUtility::LLIToCalTime(calEvent->getTimeZone().c_str(), endDate).time.date;
                } else {
-        st.type = CALENDAR_TIME_UTIME;
-        st.time.utime = startDate;
+               st.type = CALENDAR_TIME_UTIME;
+               st.time.utime = startDate;
 
-        et.type = CALENDAR_TIME_UTIME;
-        et.time.utime = endDate;
+               et.type = CALENDAR_TIME_UTIME;
+               et.time.utime = endDate;
                }
 
         if( true==isAllDay ) {
@@ -1264,7 +1264,9 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event)
                 LogDebug("Found a valid event instance with rid: "<<recurringEventWrapper->getAbstractEvent()->getRecurrenceId());
 
                 event->addExpandedEvent(recurringEventWrapper->getAbstractEvent());
-            }
+                       } else {
+                               LogDebug("Skip unmatched instance with event_id: "<<currentRecordIndex<<" and parent id: "<<calEvent->getId());
+                       }
 
             calendar_list_next(list);
         }
index db94119..8401e88 100755 (executable)
@@ -29,9 +29,6 @@
 #include "JSCalendarAttendee.h"
 #include "JSCalendarRecurrenceRule.h"
 #include "JSCalendarAlarm.h"
-#include "JSStringArray.h"
-#include "JSNumberArray.h"
-#include "JSTZDateArray.h"
 
 #include <TimeUtilConverter.h>
 #include <DurationProperties.h>
@@ -90,30 +87,72 @@ JSValueRef CalendarConverter::toJSValueRef(const std::vector<ICalendarPtr> &arg)
     return toJSValueRef_(arg, &CalendarConverter::toJSValueRefCalendar, this);
 }
 
-JSValueRef CalendarConverter::toJSValueRef(const StringArrayPtr &arg)
+JSValueRef CalendarConverter::toJSValueRefStringArray(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 an 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 an object to array.");
+               }
+       }
+
+       return resultObject;
 }
 
 JSValueRef CalendarConverter::toJSValueRefNumberArray(const NumberArrayPtr &arg)
 {
-       return JSNumberArray::createArray(m_context, arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject) {
+               ThrowMsg(ConversionException, "Can not create an 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 an object to array.");
+               }
+       }
+
+       return resultObject;
 }
 
-JSValueRef CalendarConverter::toJSValueRefTZDateArray(const NumberArrayPtr &arg)
+JSValueRef CalendarConverter::toJSValueRefTZDateArray(const NumberArrayPtr &arg, const std::string &timeZone)
 {
-       return JSTZDateArray::createArray(m_context, arg);
+       int size = arg->size();
+
+       JSObjectRef resultObject = JSCreateArrayObject(m_context, 0, NULL);
+       if (!resultObject) {
+               ThrowMsg(ConversionException, "Can not create an array object.");
+       }
+
+    TimeUtilConverter timeConverter(m_context);
+       for(int i = 0; i < size; i++) {
+               JSValueRef jsvalue = timeConverter.toJSValueRefTZDate((double)((arg->at(i))*1000.0), timeZone);
+               if (!JSSetArrayElement(m_context, resultObject, i, jsvalue)) {
+                       ThrowMsg(ConversionException, "Can not add an object to array.");
+               }
+       }
+
+       return resultObject;
 }
 
 StringArrayPtr CalendarConverter::toStringArray(const JSValueRef &jsValue)
 {
-       if(JSStringArray::isObjectOfClass(m_context, jsValue))
-               return JSStringArray::getStringArray(m_context, jsValue);
-
-       if(!JSIsArrayValue(m_context, jsValue))
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "StringArray is not array.");
-
        StringArrayPtr result = StringArrayPtr(new StringArray());
+       if(!JSIsArrayValue(m_context, jsValue)) {
+               LogWarning("StringArray is not an array. Skip this.");
+               return result;
+       }
+
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
@@ -124,33 +163,30 @@ StringArrayPtr CalendarConverter::toStringArray(const JSValueRef &jsValue)
 
 NumberArrayPtr CalendarConverter::toNumberArray(const JSValueRef &jsValue)
 {
-       if(JSNumberArray::isObjectOfClass(m_context, jsValue))
-               return JSNumberArray::getNumberArray(m_context, jsValue);
-
-       if(!JSIsArrayValue(m_context, jsValue))
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "NumberArray is not array.");
-
        NumberArrayPtr result = NumberArrayPtr(new NumberArray());
+       if(!JSIsArrayValue(m_context, jsValue)) {
+               LogWarning("NumberArray is not an array. Skip this.");
+               return result;
+       }
+
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
         result->push_back((long long int) (toLongLong(element)));
     }
-    LogDebug("First number: "<<result->at(0));
     return result;
 }
 
 NumberArrayPtr CalendarConverter::toTZDateArray(const JSValueRef &jsValue)
 {
-       if(JSNumberArray::isObjectOfClass(m_context, jsValue))
-               return JSNumberArray::getNumberArray(m_context, jsValue);
-
-       if(!JSIsArrayValue(m_context, jsValue))
-               ThrowMsg(WrtDeviceApis::Commons::ConversionException, "NumberArray is not array.");
+       NumberArrayPtr result = NumberArrayPtr(new NumberArray());
+       if(!JSIsArrayValue(m_context, jsValue)) {
+               LogWarning("TZDateArray is not an array. Skip this.");
+               return result;
+       }
 
     TimeUtilConverter timeConverter(m_context);
 
-       NumberArrayPtr result = NumberArrayPtr(new NumberArray());
        JSObjectRef jsObject = toJSObjectRef(jsValue);
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, jsObject); ++i) {
         JSValueRef element = JSGetArrayElement(m_context, jsObject, i);
@@ -273,6 +309,7 @@ std::string CalendarConverter::toTizenValue(
 EventRecurrenceRulePtr CalendarConverter::toEventRecurrenceRule(JSValueRef rrule)
 {
     EventRecurrenceRulePtr result(new EventRecurrenceRule());
+
     const ScopedJSStringRef frequencyStr(JSStringCreateWithUTF8CString(TIZEN_RECURRENCE_RULE_FREQUENCY));
     const ScopedJSStringRef intervalStr(JSStringCreateWithUTF8CString(TIZEN_RECURRENCE_RULE_INTERVAL));
     const ScopedJSStringRef untilDateStr(JSStringCreateWithUTF8CString(TIZEN_RECURRENCE_RULE_UNTIL_DATE));
@@ -620,15 +657,13 @@ EventAttendeeListPtr CalendarConverter::toVectorOfAttendeesFromDictionary(JSValu
 {
     EventAttendeeListPtr result(new EventAttendeeList());
 
-    std::vector<EventAttendeePtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(attendees);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        resultVector.push_back(toAttendee(element));
+        result->push_back(toAttendee(element));
     }
 
-    *result = resultVector;
     return result;
 }
 
@@ -636,15 +671,18 @@ EventAttendeeListPtr CalendarConverter::toVectorOfAttendeesFromReference(JSValue
 {
     EventAttendeeListPtr result(new EventAttendeeList());
 
-    std::vector<EventAttendeePtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(attendees);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        resultVector.push_back(JSCalendarAttendee::getPrivateObject(JSValueToObject(m_context, element, NULL)));
+               if (JSValueIsObjectOfClass(m_context, element, JSCalendarAttendee::getClassRef())) {
+               result->push_back(JSCalendarAttendee::getPrivateObject(JSValueToObject(m_context, element, NULL)));
+               } else {
+                       LogDebug("Invalid attendee type. Skip this with index: "<<i);
+                       continue;
+               }
     }
 
-    *result = resultVector;
     return result;
 }
 
@@ -685,15 +723,13 @@ EventAlarmListPtr CalendarConverter::toVectorOfEventAlarmsFromDictionary(JSValue
 {
     EventAlarmListPtr result(new EventAlarmList());
 
-    std::vector<EventAlarmPtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(alarms);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        resultVector.push_back(toEventAlarm(element));
+        result->push_back(toEventAlarm(element));
     }
 
-    *result = resultVector;
     return result;
 }
 
@@ -701,21 +737,35 @@ EventAlarmListPtr CalendarConverter::toVectorOfEventAlarmsFromReference(JSValueR
 {
     EventAlarmListPtr result(new EventAlarmList());
 
-    std::vector<EventAlarmPtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(alarms);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        resultVector.push_back(JSCalendarAlarm::getPrivateObject(JSValueToObject(m_context, element, NULL)));
+               if (JSValueIsObjectOfClass(m_context, element, JSCalendarAlarm::getClassRef())) {
+               result->push_back(JSCalendarAlarm::getPrivateObject(JSValueToObject(m_context, element, NULL)));
+               } else {
+                       LogDebug("Invalid alarm type. Skip this with index: "<<i);
+                       continue;
+               }
     }
 
-    *result = resultVector;
     return result;
 }
 
-CalendarEventPtr CalendarConverter::toEvent(const JSValueRef event)
+CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMode)
 {
-    CalendarEventPtr result(new CalendarEvent());
+       CalendarEventPtr result;
+       JSObjectRef arg = toJSObjectRef(value);
+
+       if(updateMode) {
+               LogDebug("Update mode.");
+        result = JSCalendarEvent::getPrivateObject(arg);
+       } else {
+               LogDebug("Constructor mode.");
+           CalendarEventPtr resultPtr(new CalendarEvent());
+               result = resultPtr;
+       }
+
     const ScopedJSStringRef descriptionStr(JSStringCreateWithUTF8CString(TIZEN_CALENDAR_ITEM_DESCRIPTION));
     const ScopedJSStringRef summaryStr(JSStringCreateWithUTF8CString(TIZEN_CALENDAR_ITEM_SUMMARY));
     const ScopedJSStringRef startTimeStr(JSStringCreateWithUTF8CString(TIZEN_CALENDAR_ITEM_START_DATE));
@@ -737,8 +787,6 @@ CalendarEventPtr CalendarConverter::toEvent(const JSValueRef event)
     const ScopedJSStringRef completedDateStr(JSStringCreateWithUTF8CString(TIZEN_CALENDAR_TASK_COMPLETED_DATE));
     const ScopedJSStringRef progressStr(JSStringCreateWithUTF8CString(TIZEN_CALENDAR_TASK_PROGRESS));
 
-    JSObjectRef arg = toJSObjectRef(event);
-
     JSValueRef descriptionData = JSObjectGetProperty(m_context, arg, descriptionStr.get(), NULL);
     JSValueRef summaryData = JSObjectGetProperty(m_context, arg, summaryStr.get(), NULL);
     JSValueRef startTimeData = JSObjectGetProperty(m_context, arg, startTimeStr.get(), NULL);
@@ -782,15 +830,17 @@ CalendarEventPtr CalendarConverter::toEvent(const JSValueRef event)
             //result->setStartTime(std::time(NULL));
         }
     }
-    
+
     if (!JSValueIsUndefined(m_context, durationData)) {
         long length = timeUtilConverter.getDurationLength(durationData);
         int unit = timeUtilConverter.getDurationUnit(durationData);
-        LogInfo("duration length: "<<length<<", unit "<<unit);
+        LogDebug("duration length: "<<length<<", unit "<<unit);
         if (length < 0) {
             ThrowMsg(ConversionException, "Wrong duration length.");
         }
-        if( SECONDS_UNIT==unit ) {
+        if( MSECS_UNIT==unit ) {
+                   result->setEndTime(result->getStartTime() + length/1000);
+               } else if( SECONDS_UNIT==unit ) {
             result->setEndTime(result->getStartTime() + length);
         } else if ( MINUTES_UNIT==unit ) {
             result->setEndTime(result->getStartTime() + length*60);
@@ -843,7 +893,11 @@ CalendarEventPtr CalendarConverter::toEvent(const JSValueRef event)
         result->setAvailability(toEventAvailability(toString(availabilityData)));
     }
     if (!JSValueIsUndefined(m_context, recurrenceRuleData)) {
-        result->setRecurrenceRule(JSCalendarRecurrenceRule::getPrivateObject(JSValueToObject(m_context, recurrenceRuleData, NULL)));
+               if(updateMode) {
+                       result->setRecurrenceRule(toEventRecurrenceRule(recurrenceRuleData));
+               } else {
+               result->setRecurrenceRule(JSCalendarRecurrenceRule::getPrivateObject(JSValueToObject(m_context, recurrenceRuleData, NULL)));
+               }
     }
     if (!JSValueIsUndefined(m_context, priorityData)) {
         result->setPriority(toTaskPriority(toString(priorityData)));
@@ -874,35 +928,39 @@ CalendarEventPtr CalendarConverter::toEvent(const JSValueRef event)
     return result;
 }
 
-CalendarEventListPtr CalendarConverter::toVectorOfEvents(JSValueRef events)
+CalendarEventListPtr CalendarConverter::toVectorOfItems(JSValueRef events)
 {
     CalendarEventListPtr result(new CalendarEventList());
 
-    std::vector<CalendarEventPtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(events);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        JSObjectRef arg = JSValueToObject(m_context, element, NULL);
-        resultVector.push_back(JSCalendarEvent::getPrivateObject(arg));
+               if (JSValueIsObjectOfClass(m_context, element, JSCalendarEvent::getClassRef())) {
+               JSObjectRef arg = JSValueToObject(m_context, element, NULL);
+           result->push_back(JSCalendarEvent::getPrivateObject(arg));
+               } else if (JSValueIsObjectOfClass(m_context, element, JSCalendarTask::getClassRef())) {
+               JSObjectRef arg = JSValueToObject(m_context, element, NULL);
+           result->push_back(JSCalendarTask::getPrivateObject(arg));
+               } else {
+                       LogDebug("Invalid item type. Skip this with index: "<<i);
+                       continue;
+               }
     }
 
-    *result = resultVector;
     return result;
 }
 
-CalendarEventListPtr CalendarConverter::toVectorOfEventsFromProperty(JSValueRef events)
+CalendarEventListPtr CalendarConverter::toVectorOfItemsFromDictionary(JSValueRef events)
 {
     CalendarEventListPtr result(new CalendarEventList());
 
-    std::vector<CalendarEventPtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(events);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
-        resultVector.push_back(toEvent(JSGetArrayElement(m_context, objArg, i)));
+        result->push_back(toItem(JSGetArrayElement(m_context, objArg, i), true));
     }
 
-    *result = resultVector;
     return result;
 }
 
@@ -931,17 +989,21 @@ EventIdListPtr CalendarConverter::toVectorOfEventIds(JSValueRef eventIds)
 {
     EventIdListPtr result(new EventIdList());
 
-    std::vector<EventIdPtr> resultVector;
     JSObjectRef objArg = toJSObjectRef(eventIds);
     LogDebug("array length "<<JSGetArrayLength(m_context, objArg));
     for (std::size_t i = 0; i < JSGetArrayLength(m_context, objArg); i++) {
         JSValueRef element = JSGetArrayElement(m_context, objArg, i);
-        EventIdPtr idPtr = JSCalendarEventId::getPrivateObject(JSValueToObject(m_context, element, NULL));
-        idPtr->setCalendarType(CalendarEvent::EVENT_TYPE);
-        resultVector.push_back(idPtr);
+
+               if (JSValueIsObjectOfClass(m_context, element, JSCalendarEventId::getClassRef())) {
+                       EventIdPtr idPtr = JSCalendarEventId::getPrivateObject(JSValueToObject(m_context, element, NULL));
+                   idPtr->setCalendarType(CalendarEvent::EVENT_TYPE);
+                       result->push_back(idPtr);
+               } else {
+                       LogDebug("Invalid event id type. Skip this index: "<<i);
+                       continue;
+               }
     }
 
-    *result = resultVector;
     return result;
 }
 
index d835b4c..ebdc6b8 100755 (executable)
@@ -38,9 +38,9 @@ class CalendarConverter : public WrtDeviceApis::CommonsJavaScript::Converter
     explicit CalendarConverter(JSContextRef context, CalendarEvent::CalendarType calendarType=CalendarEvent::EVENT_TYPE);
     virtual ~CalendarConverter();
 
-    CalendarEventPtr toEvent(const JSValueRef event);
-    CalendarEventListPtr toVectorOfEvents(JSValueRef events);
-    CalendarEventListPtr toVectorOfEventsFromProperty(JSValueRef events);
+    CalendarEventPtr toItem(const JSValueRef value, bool updateMode=false);
+    CalendarEventListPtr toVectorOfItems(JSValueRef events);
+    CalendarEventListPtr toVectorOfItemsFromDictionary(JSValueRef events);
     StringArrayPtr toCategories(JSValueRef categories);
     EventAttendeePtr toAttendee(JSValueRef attendee);
     EventAttendeeListPtr toVectorOfAttendeesFromDictionary(JSValueRef attendees);
@@ -73,9 +73,9 @@ class CalendarConverter : public WrtDeviceApis::CommonsJavaScript::Converter
     JSValueRef toJSValueRefTaskArray(const CalendarEventListPtr &arg);
     JSValueRef toJSValueRefCalendar(const ICalendarPtr& arg);
     JSValueRef toJSValueRef(const std::vector<ICalendarPtr> &arg);
-    JSValueRef toJSValueRef(const StringArrayPtr &arg);
+    JSValueRef toJSValueRefStringArray(const StringArrayPtr &arg);
     JSValueRef toJSValueRefNumberArray(const NumberArrayPtr &arg);
-    JSValueRef toJSValueRefTZDateArray(const NumberArrayPtr &arg);
+    JSValueRef toJSValueRefTZDateArray(const NumberArrayPtr &arg, const std::string &timeZone);
     StringArrayPtr toStringArray(const JSValueRef &jsValue);
     NumberArrayPtr toNumberArray(const JSValueRef &jsValue);
     NumberArrayPtr toTZDateArray(const JSValueRef &jsValue);
index 5ff2037..fd2e9b3 100755 (executable)
@@ -33,6 +33,7 @@ CalendarEvent::CalendarEvent():
     m_status(UNDEFINED_STATUS),
     m_alarms(new EventAlarmList()),
     m_categories(new StringArray()),
+    m_categoriesJSRef(NULL),
     m_isAllDay(false),
     m_lastModifiedDate(UNDEFINED_TIME),
     m_visibility(PUBLIC_VISIBILITY),
@@ -49,7 +50,8 @@ CalendarEvent::CalendarEvent():
     m_createdDate(UNDEFINED_TIME),
     m_completedDate(UNDEFINED_TIME),
     m_progress(0),
-    m_calendarType(EVENT_TYPE)
+    m_calendarType(EVENT_TYPE),
+    m_context(NULL)
 {
 }
 
@@ -74,10 +76,13 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
     m_recurrence->setOccurrenceCount(original.getRecurrenceRule()->getOccurrenceCount());
     m_recurrence->setDaysOfTheMonth(original.getRecurrenceRule()->getDaysOfTheMonth());
     m_recurrence->setDaysOfTheWeek(original.getRecurrenceRule()->getDaysOfTheWeek());
+       m_recurrence->setDaysOfTheWeekJSRef(NULL);
     m_recurrence->setDaysOfTheYear(original.getRecurrenceRule()->getDaysOfTheYear());
     m_recurrence->setWeeksOfTheYear(original.getRecurrenceRule()->getWeeksOfTheYear());
     m_recurrence->setSetPositions(original.getRecurrenceRule()->getSetPositions());
+    m_recurrence->setSetPositionsJSRef(NULL);
     m_recurrence->setExceptions(original.getRecurrenceRule()->getExceptions());
+    m_recurrence->setExceptionsJSRef(NULL);
     m_recurrence->setTimeZone(original.getRecurrenceRule()->getTimeZone());
 
     m_status = original.getStatus();
@@ -98,6 +103,7 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
     StringArrayPtr categoriesPtr( new StringArray() );
     m_categories = categoriesPtr;
     *m_categories = *(original.getCategories());
+       m_categoriesJSRef = NULL;
 
     m_isAllDay = original.getIsAllDay();
     m_organizer = original.getOrganizer();
@@ -147,6 +153,10 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
 
 CalendarEvent::~CalendarEvent()
 {
+       if(m_categoriesJSRef) {
+               LogDebug("Unprotect JS categories.");
+               JSValueUnprotect(m_context, m_categoriesJSRef);
+       }
 }
 
 int CalendarEvent::getId() const
@@ -284,6 +294,15 @@ void CalendarEvent::setCategories(const StringArrayPtr value)
     m_categories = value;
 }
 
+JSObjectRef CalendarEvent::getCategoriesJSRef() const
+{
+    return m_categoriesJSRef;
+}
+void CalendarEvent::setCategoriesJSRef(const JSObjectRef value)
+{
+    m_categoriesJSRef = value;
+}
+
 void CalendarEvent::display() const
 {
     LogDebug("m_id " << m_id);
@@ -499,5 +518,15 @@ void CalendarEvent::setCalendarType(CalendarType type)
     m_calendarType = type;
 }
 
+JSContextRef CalendarEvent::getContext() const
+{
+       return m_context;
+}
+
+void CalendarEvent::setContext(const JSContextRef contextRef)
+{
+       m_context = contextRef;
+}
+
 }
 }
index b593444..6373b20 100755 (executable)
@@ -28,6 +28,8 @@
 #include "EventAttendee.h"
 #include "EventRecurrenceRule.h"
 
+#include <JavaScriptCore/JavaScript.h>
+
 namespace DeviceAPI {
 namespace Calendar {
 
@@ -135,6 +137,8 @@ class CalendarEvent
 
     StringArrayPtr getCategories() const;
     void setCategories(const StringArrayPtr value);
+    JSObjectRef getCategoriesJSRef() const;
+    void setCategoriesJSRef(const JSObjectRef value);
 
     void display() const;
     bool validate() const;
@@ -193,6 +197,9 @@ class CalendarEvent
     CalendarType getCalendarType() const;
     void setCalendarType(CalendarType type);
 
+       JSContextRef getContext() const;
+       void setContext(const JSContextRef contextRef);
+
   protected:
     int m_id;
     int m_parentId; // the parent id if it's detached.
@@ -206,6 +213,7 @@ class CalendarEvent
     EventStatus m_status;
     EventAlarmListPtr m_alarms;
     StringArrayPtr m_categories;
+       JSObjectRef m_categoriesJSRef;
     bool m_isAllDay;
     std::string m_organizer;
     long long int m_lastModifiedDate;
@@ -224,6 +232,8 @@ class CalendarEvent
     long long int m_completedDate;
     int m_progress;
     CalendarType m_calendarType;
+
+       JSContextRef m_context;
 };
 
 typedef DPL::SharedPtr<CalendarEvent> CalendarEventPtr;
index 31a78e9..751da02 100755 (executable)
@@ -31,15 +31,31 @@ EventRecurrenceRule::EventRecurrenceRule()
     m_occurrenceCount = -1;
     StringArrayPtr stringArrayPtr(new StringArray());
     m_daysOfTheWeek = stringArrayPtr;
+    m_daysOfTheWeekJSRef = NULL;
     NumberArrayPtr numberArraySetPositionsPtr(new NumberArray());
     m_setPositions = numberArraySetPositionsPtr;
+       m_setPositionsJSRef = NULL;
     NumberArrayPtr numberArrayExceptionsPtr(new NumberArray());
     m_exceptions = numberArrayExceptionsPtr;
+       m_exceptionsJSRef = NULL;
     m_timeZone = DEFAULT_TIMEZONE;
+    m_context = NULL;
 }
 
 EventRecurrenceRule::~EventRecurrenceRule()
 {
+       if(m_daysOfTheWeekJSRef) {
+               LogDebug("Unprotect JS daysOfTheWeek.");
+               JSValueUnprotect(m_context, m_daysOfTheWeekJSRef);
+       }
+       if(m_daysOfTheWeekJSRef) {
+               LogDebug("Unprotect JS setPositions.");
+               JSValueUnprotect(m_context, m_setPositionsJSRef);
+       }
+       if(m_exceptionsJSRef) {
+               LogDebug("Unprotect JS exceptions.");
+               JSValueUnprotect(m_context, m_exceptionsJSRef);
+       }
 }
 
 EventRecurrenceRule::EventRecurrence EventRecurrenceRule::getFrequency() const
@@ -101,6 +117,15 @@ void EventRecurrenceRule::setDaysOfTheWeek(StringArrayPtr value)
     m_daysOfTheWeek = value;
 }
 
+JSObjectRef EventRecurrenceRule::getDaysOfTheWeekJSRef() const
+{
+    return m_daysOfTheWeekJSRef;
+}
+void EventRecurrenceRule::setDaysOfTheWeekJSRef(const JSObjectRef value)
+{
+    m_daysOfTheWeekJSRef = value;
+}
+
 std::vector<int> EventRecurrenceRule::getDaysOfTheYear() const
 {
     return m_daysOfTheYear;
@@ -131,6 +156,16 @@ void EventRecurrenceRule::setSetPositions(NumberArrayPtr value)
     m_setPositions = value;
 }
 
+JSObjectRef EventRecurrenceRule::getSetPositionsJSRef() const
+{
+    return m_setPositionsJSRef;
+}
+
+void EventRecurrenceRule::setSetPositionsJSRef(const JSObjectRef value)
+{
+    m_setPositionsJSRef = value;
+}
+
 NumberArrayPtr EventRecurrenceRule::getExceptions() const
 {
     return m_exceptions;
@@ -141,6 +176,16 @@ void EventRecurrenceRule::setExceptions(NumberArrayPtr value)
     m_exceptions = value;
 }
 
+JSObjectRef EventRecurrenceRule::getExceptionsJSRef() const
+{
+    return m_exceptionsJSRef;
+}
+
+void EventRecurrenceRule::setExceptionsJSRef(const JSObjectRef value)
+{
+    m_exceptionsJSRef = value;
+}
+
 std::string EventRecurrenceRule::getTimeZone() const
 {
     return m_timeZone;
@@ -151,5 +196,15 @@ void EventRecurrenceRule::setTimeZone(std::string value)
     m_timeZone = value;
 }
 
+JSContextRef EventRecurrenceRule::getContext() const
+{
+       return m_context;
+}
+
+void EventRecurrenceRule::setContext(const JSContextRef contextRef)
+{
+       m_context = contextRef;
+}
+
 }
 }
index b8693c0..f859e0b 100755 (executable)
@@ -24,6 +24,8 @@
 #include <ctime>
 #include <dpl/shared_ptr.h>
 
+#include <JavaScriptCore/JavaScript.h>
+
 namespace DeviceAPI {
 namespace Calendar {
 
@@ -71,6 +73,8 @@ class EventRecurrenceRule
 
     StringArrayPtr getDaysOfTheWeek() const;
     void setDaysOfTheWeek(StringArrayPtr value);
+    JSObjectRef getDaysOfTheWeekJSRef() const;
+    void setDaysOfTheWeekJSRef(const JSObjectRef value);
 
     std::vector<int> getDaysOfTheYear() const;
     void setDaysOfTheYear(std::vector<int> value);
@@ -80,13 +84,20 @@ class EventRecurrenceRule
 
     NumberArrayPtr getSetPositions() const;
     void setSetPositions(NumberArrayPtr value);
+    JSObjectRef getSetPositionsJSRef() const;
+    void setSetPositionsJSRef(const JSObjectRef value);
 
     NumberArrayPtr getExceptions() const;
     void setExceptions(NumberArrayPtr value);
+    JSObjectRef getExceptionsJSRef() const;
+    void setExceptionsJSRef(const JSObjectRef value);
 
     std::string getTimeZone() const;
     void setTimeZone(std::string value);
 
+       JSContextRef getContext() const;
+       void setContext(const JSContextRef contextRef);
+
   protected:
     EventRecurrence m_frequency;
     int m_interval;
@@ -94,11 +105,16 @@ class EventRecurrenceRule
     long m_occurrenceCount;
     std::vector<int> m_daysOfTheMonth;
     StringArrayPtr m_daysOfTheWeek;
+       JSObjectRef m_daysOfTheWeekJSRef;
     std::vector<int> m_daysOfTheYear;
     std::vector<int> m_weeksOfTheYear;
     NumberArrayPtr m_setPositions;
+       JSObjectRef m_setPositionsJSRef;
     NumberArrayPtr m_exceptions;
+       JSObjectRef m_exceptionsJSRef;
     std::string m_timeZone;
+
+       JSContextRef m_context;
 };
 
 typedef DPL::SharedPtr<EventRecurrenceRule> EventRecurrenceRulePtr;
index 13b346c..133dc72 100755 (executable)
@@ -251,7 +251,7 @@ JSValueRef JSCalendar::addBatch(JSContextRef context,
         if (!JSIsArrayValue(context, arguments[0])) {
             ThrowMsg(ConversionException, "Wrong first parameter type.");
         }
-        events = converter.toVectorOfEvents(arguments[0]);
+        events = converter.toVectorOfItems(arguments[0]);
         if (!events) {
             ThrowMsg(ConversionException, "First parameter conversion failed.");
         }
@@ -338,8 +338,7 @@ JSValueRef JSCalendar::update(JSContextRef context,
 
         CalendarConverter converter(context);
 
-        JSObjectRef arg = JSValueToObject(context, arguments[0], exception);
-        CalendarEventPtr item = JSCalendarEvent::getPrivateObject(arg);
+        CalendarEventPtr item = converter.toItem(arguments[0], true);
         if (!item) {
             ThrowMsg(ConversionException, "Parameter conversion failed.");
         }
@@ -421,9 +420,9 @@ JSValueRef JSCalendar::updateBatch(JSContextRef context,
         } else {
             ThrowMsg(ConversionException, "Wrong parameter type.");
         }
-        CalendarEventListPtr events;
-        events = converter.toVectorOfEvents(arguments[0]);
-        if (!events) {
+        CalendarEventListPtr items;
+        items = converter.toVectorOfItemsFromDictionary(arguments[0]);
+        if (!items) {
             ThrowMsg(ConversionException, "Third parameter conversion failed.");
         }
 
@@ -447,7 +446,7 @@ JSValueRef JSCalendar::updateBatch(JSContextRef context,
         LogDebug("Proceed the event to the platform.");
 
         IEventUpdateEventsPtr dplEvent(new IEventUpdateEvents());
-        dplEvent->setEvents(events);
+        dplEvent->setEvents(items);
         dplEvent->setUpdateAllInstances(updateAllInstances);
         dplEvent->setPrivateData(DPL::StaticPointerCast<IEventPrivateData>(cbm));
         dplEvent->setForAsynchronousCall(&CalendarResponseDispatcher::getInstance());
@@ -623,7 +622,9 @@ JSValueRef JSCalendar::removeBatch(JSContextRef context,
             itemIds = converter.toVectorOfEventIds(arguments[0]);
             if (!itemIds) {
                 ThrowMsg(ConversionException, "Parameter conversion failed.");
-            }
+            } else {
+               LogDebug("Array length: "<<itemIds->size());
+               }
         } else if (JSValueIsString(context, element)) {
             std::vector<std::string> idStrings = converter.toVectorOfStrings(arguments[0]);
             EventIdListPtr result(new EventIdList());
index 30a145d..aa126fd 100755 (executable)
@@ -29,6 +29,7 @@
 #include "JSCalendarItemProperties.h"
 #include "CalendarConverter.h"
 #include "JSCalendarEventId.h"
+#include "JSCalendarRecurrenceRule.h"
 #include "plugin_config.h"
 #include "CalendarResponseDispatcher.h"
 #include <TimeUtilConverter.h>
@@ -38,7 +39,7 @@
 #include <SecurityExceptions.h>
 
 #include "CalendarAsyncCallbackManager.h"
-
+#include <GlobalContextManager.h>
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -71,6 +72,7 @@ JSClassDefinition JSCalendarEvent::m_classInfo = {
 JSStaticValue JSCalendarEvent::m_property[] = {
     { TIZEN_CALENDAR_EVENT_ID, getPropertyId, NULL, kJSPropertyAttributeReadOnly },
     { TIZEN_CALENDAR_EVENT_IS_DETACHED, getPropertyIsDetached, NULL, kJSPropertyAttributeReadOnly },
+    { TIZEN_CALENDAR_EVENT_RECURRENCE_RULE, getPropertyRecurrenceRule, setPropertyRecurrenceRule, kJSPropertyAttributeNone },
 
     { 0, 0, 0, 0 }
 };
@@ -122,8 +124,7 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context,
 {
     Try
     {
-               CalendarEventPrivObject* privateObject = static_cast<CalendarEventPrivObject*>(JSObjectGetPrivate(constructor));
-               JSContextRef globalContext = privateObject->getContext();
+               JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
 
         CalendarConverter converter(globalContext);
         CalendarEventPtr event;
@@ -137,7 +138,7 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context,
                 CalendarEventPtr result(new CalendarEvent());
                 event = result;
             } else if (JSValueIsObject(context, arguments[0])) {
-                event = converter.toEvent(arguments[0]);
+                event = converter.toItem(arguments[0]);
                 if (!event) {
                     ThrowMsg(ConversionException, "Parameter conversion failed.");
                 }
@@ -358,17 +359,16 @@ JSValueRef JSCalendarEvent::getPropertyId(JSContextRef context,
 {
     Try
     {
-        CalendarEventPrivObject *privateObject =
-            static_cast<CalendarEventPrivObject*>(JSObjectGetPrivate(object));
+        CalendarEventPrivObject *privateObject = static_cast<CalendarEventPrivObject*>(JSObjectGetPrivate(object));
         CalendarEventPtr event = privateObject->getObject();
 
         EventIdPtr eventId( new EventId() );
 
-                   if (UNDEFINED_ITEM_ID==event->getId()) {
-                return JSValueMakeNull(context);
-                   } else {
-               eventId->setUId(event->getUId());
-                   }
+           if (UNDEFINED_ITEM_ID==event->getId()) {
+            return JSValueMakeNull(context);
+           } else {
+               eventId->setUId(event->getUId());
+           }
 
         std::stringstream ss;
         std::time_t rid = event->getRecurrenceId();
@@ -405,20 +405,72 @@ JSValueRef JSCalendarEvent::getPropertyIsDetached(JSContextRef context,
     return JSValueMakeUndefined(context);
 }
 
-bool JSCalendarEvent::validate(JSContextRef ctx,
-        const JSObjectRef object,
+JSValueRef JSCalendarEvent::getPropertyRecurrenceRule(JSContextRef context,
+        JSObjectRef object,
+        JSStringRef propertyName,
         JSValueRef* exception)
 {
-    CalendarEventPrivObject *priv =
-        static_cast<CalendarEventPrivObject*>(JSObjectGetPrivate(object));
-    if (priv == NULL) {
-        return false;
+    Try
+    {
+        CalendarItemPropertiesPrivObject *priv = static_cast<CalendarItemPropertiesPrivObject*>(JSObjectGetPrivate(object));
+
+        CalendarEventPtr event = getPrivateObject(object);
+        EventRecurrenceRulePtr rrule;
+        if (event->getIsDetached()) {
+            LogDebug("This is a detached event.");
+            return JSValueMakeUndefined(context);
+        } else {
+            rrule = event->getRecurrenceRule();
+        }
+
+               if (NULL==rrule) {
+                       return JSValueMakeNull(context);
+               } else if (EventRecurrenceRule::NO_RECURRENCE==rrule->getFrequency()) {
+            return JSValueMakeUndefined(context);
+        } else {
+            return JSCalendarRecurrenceRule::createJSCalendarRecurrenceRule(priv->getContext(), rrule);
+        }
     }
-    CalendarEventPtr event = priv->getObject();
-    if (!event) {
-        return false;
+    Catch(Exception)
+    {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+    }
+    return JSValueMakeUndefined(context);
+}
+
+bool JSCalendarEvent::setPropertyRecurrenceRule(JSContextRef context,
+        JSObjectRef object,
+        JSStringRef propertyName,
+        JSValueRef value,
+        JSValueRef* exception)
+{
+    CalendarEventPtr event(NULL);
+    Try
+    {
+        event = getPrivateObject(object);
+        if (event->getIsDetached()) {
+            LogWarning("Can't set the recurrenceRule of a detached event!");
+            DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::NOT_SUPPORTED_ERROR);
+        }
+
+               if (JSValueIsNull(context, value)) {
+                       EventRecurrenceRulePtr rrule(NULL);
+                       event->setRecurrenceRule(rrule);
+               } else if (JSValueIsUndefined(context, value)) {
+                       EventRecurrenceRulePtr rrule( new EventRecurrenceRule() );
+                       event->setRecurrenceRule(rrule);
+               } else {
+               event->setRecurrenceRule(JSCalendarRecurrenceRule::getPrivateObject(JSValueToObject(context, value, NULL)));
+               }
+        return true;
     }
-    return event->validate();
+    Catch(Exception)
+    {
+               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
+        DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
+    }
+
+    return false;
 }
 
 }
index cdbd0c4..cf740f7 100755 (executable)
@@ -31,8 +31,10 @@ namespace Calendar {
 #define TIZEN_INTERFACE_CALENDAR_EVENT "CalendarEvent"
 
 #define TIZEN_CALENDAR_EVENT_ID "id"
-#define TIZEN_CALENDAR_EVENT_LAST_MODIFICATION_DATE "lastModificationDate"
 #define TIZEN_CALENDAR_EVENT_IS_DETACHED "isDetached"
+#define TIZEN_CALENDAR_EVENT_END_DATE  "endDate"
+#define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
+#define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
        WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarEventPrivObject;
@@ -51,10 +53,6 @@ class JSCalendarEvent
             JSContextRef ctx,
             const JSObjectRef object);
 
-    static bool validate(JSContextRef ctx,
-            const JSObjectRef object,
-            JSValueRef* exception);
-
        static JSObjectRef createJSCalendarEvent(JSContextRef context, CalendarEventPtr event);
 
   private:
@@ -124,6 +122,15 @@ class JSCalendarEvent
             JSObjectRef object,
             JSStringRef propertyName,
             JSValueRef* exception);
+       static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName,
+                       JSValueRef* exception);
+       static bool setPropertyRecurrenceRule(JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName,
+                       JSValueRef value,
+                       JSValueRef* exception);
 };
 
 }
index 5035cc6..ae7591c 100755 (executable)
 #include "CalendarConverter.h"
 #include "JSCalendarEventId.h"
 #include "JSCalendarAlarm.h"
-#include "JSCalendarRecurrenceRule.h"
 #include "JSCalendarAttendee.h"
 #include "JSCalendarEvent.h"
 #include "JSCalendarTask.h"
 #include "plugin_config.h"
 
+#include <GlobalContextManager.h>
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -88,7 +88,6 @@ JSStaticValue JSCalendarItemProperties::m_property[] = {
     { TIZEN_CALENDAR_ITEM_DURATION, getPropertyDuration, setPropertyDuration, kJSPropertyAttributeNone },
     { TIZEN_CALENDAR_ITEM_IS_ALL_DAY, getPropertyIsAllDay, setPropertyIsAllDay, kJSPropertyAttributeNone },
     { TIZEN_CALENDAR_ITEM_ATTENDEES, getPropertyAttendees, setPropertyAttendees, kJSPropertyAttributeNone },
-    { TIZEN_CALENDAR_EVENT_RECURRENCE_RULE, getPropertyRecurrenceRule, setPropertyRecurrenceRule, kJSPropertyAttributeNone },
     { TIZEN_CALENDAR_EVENT_AVAILABILITY, getPropertyAvailability, setPropertyAvailability, kJSPropertyAttributeNone },
     { TIZEN_CALENDAR_TASK_DUE_DATE, getPropertyDueDate, setPropertyDueDate, kJSPropertyAttributeNone },
     { TIZEN_CALENDAR_TASK_COMPLETED_DATE, getPropertyCompletedDate, setPropertyCompletedDate, kJSPropertyAttributeNone },
@@ -524,12 +523,23 @@ JSValueRef JSCalendarItemProperties::getPropertyCategories(JSContextRef context,
 {
     Try
     {
-        CalendarConverter converter(context);
-        CalendarEventPtr event = getPrivateObject(object);
-        StringArrayPtr categories = event->getCategories();
-        if (categories) {
-            return converter.toJSValueRef(categories);
-        }
+           CalendarEventPtr item = getPrivateObject(object);
+               JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+
+        CalendarConverter converter(globalContext);
+
+               if(item->getCategoriesJSRef()) {
+                       return item->getCategoriesJSRef();
+               } else {
+                       LogDebug("Create a JS object for categories.");
+               StringArrayPtr categories = item->getCategories();
+                       JSValueRef jsCategories = converter.toJSValueRefStringArray(categories);
+                       item->setCategoriesJSRef(converter.toJSObjectRef(jsCategories));
+
+                       JSValueProtect(globalContext, jsCategories);
+                       item->setContext(globalContext);
+            return jsCategories;
+               }
     }
     Catch(Exception)
     {
@@ -750,8 +760,7 @@ JSValueRef JSCalendarItemProperties::getPropertyGeolocation(JSContextRef context
     Try
     {
         CalendarEventPtr event = getPrivateObject(object);
-        DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation(
-            new DeviceAPI::Tizen::SimpleCoordinates(event->getLatitude(), event->getLongitude()) );
+        DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation( new DeviceAPI::Tizen::SimpleCoordinates(event->getLatitude(), event->getLongitude()) );
 
         return DeviceAPI::Tizen::JSSimpleCoordinates::createJSObject(context, geoLocation);
     }
@@ -772,11 +781,16 @@ bool JSCalendarItemProperties::setPropertyGeolocation(JSContextRef context,
     Try
     {
         CalendarEventPtr event = getPrivateObject(object);
-        DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation =
-            DeviceAPI::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
 
-        event->setLatitude(geoLocation->getLatitude());
-        event->setLongitude(geoLocation->getLongitude());
+               if (JSValueIsNull(context, value) || JSValueIsUndefined(context, value)) {
+               event->setLatitude(UNDEFINED_GEO);
+               event->setLongitude(UNDEFINED_GEO);
+               } else {
+               DeviceAPI::Tizen::SimpleCoordinatesPtr geoLocation = DeviceAPI::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
+
+               event->setLatitude(geoLocation->getLatitude());
+               event->setLongitude(geoLocation->getLongitude());
+               }
         return true;
     }
     Catch(Exception)
@@ -851,64 +865,6 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context,
     return false;
 }
 
-JSValueRef JSCalendarItemProperties::getPropertyRecurrenceRule(JSContextRef context,
-        JSObjectRef object,
-        JSStringRef propertyName,
-        JSValueRef* exception)
-{
-    Try
-    {
-        CalendarItemPropertiesPrivObject *priv =
-            static_cast<CalendarItemPropertiesPrivObject*>(JSObjectGetPrivate(object));
-
-        CalendarEventPtr event = getPrivateObject(object);
-        EventRecurrenceRulePtr rrule;
-        if (event->getIsDetached()) {
-            LogDebug("This is a detached event.");
-            return JSValueMakeUndefined(context);
-        } else {
-            rrule = event->getRecurrenceRule();
-        }
-
-        if (EventRecurrenceRule::NO_RECURRENCE==rrule->getFrequency()) {
-            return JSValueMakeUndefined(context);
-        } else {
-            return JSCalendarRecurrenceRule::createJSCalendarRecurrenceRule(priv->getContext(), rrule);
-        }
-    }
-    Catch(Exception)
-    {
-               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
-    }
-    return JSValueMakeUndefined(context);
-}
-
-bool JSCalendarItemProperties::setPropertyRecurrenceRule(JSContextRef context,
-        JSObjectRef object,
-        JSStringRef propertyName,
-        JSValueRef value,
-        JSValueRef* exception)
-{
-    CalendarEventPtr event(NULL);
-    Try
-    {
-        event = getPrivateObject(object);
-        if (event->getIsDetached()) {
-            LogWarning("Can't set the recurrenceRule of a detached event!");
-            DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::NOT_SUPPORTED_ERROR);
-        }
-        event->setRecurrenceRule(JSCalendarRecurrenceRule::getPrivateObject(JSValueToObject(context, value, NULL)));
-        return true;
-    }
-    Catch(Exception)
-    {
-               LogWarning("Exception: "<<_rethrown_exception.GetMessage());
-        DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR);
-    }
-
-    return false;
-}
-
 JSValueRef JSCalendarItemProperties::getPropertyIsAllDay(JSContextRef context,
         JSObjectRef object,
         JSStringRef propertyName,
@@ -1402,21 +1358,5 @@ JSValueRef JSCalendarItemProperties::getPropertyCalendarId(JSContextRef context,
     return JSValueMakeUndefined(context);
 }
 
-bool JSCalendarItemProperties::validate(JSContextRef ctx,
-        const JSObjectRef object,
-        JSValueRef* exception)
-{
-    CalendarItemPropertiesPrivObject *priv =
-        static_cast<CalendarItemPropertiesPrivObject*>(JSObjectGetPrivate(object));
-    if (priv == NULL) {
-        return false;
-    }
-    CalendarEventPtr event = priv->getObject();
-    if (!event) {
-        return false;
-    }
-    return event->validate();
-}
-
 }
 }
index aeb107c..6b9279e 100755 (executable)
@@ -42,16 +42,7 @@ namespace Calendar {
 #define TIZEN_CALENDAR_ITEM_CATEGORIES "categories"
 #define TIZEN_CALENDAR_ITEM_ATTENDEES "attendees"
 #define TIZEN_CALENDAR_ITEM_CALENDAR_ID "calendarId"
-
-// CalendarTaskProperties
-#define TIZEN_CALENDAR_TASK_DUE_DATE  "dueDate"
-#define TIZEN_CALENDAR_TASK_COMPLETED_DATE  "completedDate"
-#define TIZEN_CALENDAR_TASK_PROGRESS "progress"
-
-// CalendarEventProperties
-#define TIZEN_CALENDAR_EVENT_END_DATE  "endDate"
-#define TIZEN_CALENDAR_EVENT_AVAILABILITY "availability"
-#define TIZEN_CALENDAR_EVENT_RECURRENCE_RULE "recurrenceRule"
+#define TIZEN_CALENDAR_EVENT_LAST_MODIFICATION_DATE "lastModificationDate"
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr, 
        WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarItemPropertiesPrivObject;
@@ -72,10 +63,6 @@ class JSCalendarItemProperties
 
        static JSObjectRef createJSCalendarItemProperties(JSContextRef context, CalendarEventPtr geo);
 
-    static bool validate(JSContextRef ctx,
-            const JSObjectRef object,
-            JSValueRef* exception);
-
   private:
     /**
      * This member variable contains the values which has to be passed when
@@ -257,15 +244,6 @@ class JSCalendarItemProperties
             JSStringRef propertyName,
             JSValueRef value,
             JSValueRef* exception);
-    static JSValueRef getPropertyRecurrenceRule(JSContextRef context,
-            JSObjectRef object,
-            JSStringRef propertyName,
-            JSValueRef* exception);
-    static bool setPropertyRecurrenceRule(JSContextRef context,
-            JSObjectRef object,
-            JSStringRef propertyName,
-            JSValueRef value,
-            JSValueRef* exception);
     static JSValueRef getPropertyDueDate(JSContextRef context,
             JSObjectRef object,
             JSStringRef propertyName,
index ae2d298..30a727e 100755 (executable)
@@ -25,6 +25,7 @@
 #include <TimeUtilConverter.h>
 #include <JSTZDate.h>
 
+#include <GlobalContextManager.h>
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -156,7 +157,8 @@ JSObjectRef JSCalendarRecurrenceRule::constructor(JSContextRef context,
 {
     Try
     {
-        CalendarConverter converter(context);
+               JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+        CalendarConverter converter(globalContext);
         EventRecurrenceRulePtr rrule;
 
         if (argumentCount==0) {
@@ -214,19 +216,13 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context,
         JSStringRef propertyName,
         JSValueRef* exception)
 {
-    CalendarConverter converter(context);
-    TimeUtilConverter timeConverter(context);
     Try
     {
-        RecurrenceRulePrivateObject* priv =
-            static_cast<RecurrenceRulePrivateObject*>(JSObjectGetPrivate(object));
-        if (!priv) {
-            ThrowMsg(NullPointerException, "Private object is NULL.");
-        }
-        EventRecurrenceRulePtr rrule = priv->getObject();
-        if (!rrule) {
-            ThrowMsg(NullPointerException, "recurrenceRule is NULL.");
-        }
+        EventRecurrenceRulePtr rrule = getPrivateObject(object);
+               JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+
+           CalendarConverter converter(globalContext);
+           TimeUtilConverter timeConverter(globalContext);
 
         if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_FREQUENCY)) {
             return converter.toJSValueRef(converter.toTizenValue(rrule->getFrequency()));
@@ -243,15 +239,48 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context,
         //} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_DAYS_OF_THE_MONTH)) {
             //return converter.toJSValueRef(rrule->getDaysOfTheMonth());
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_DAYS_OF_THE_WEEK)) {
-           return converter.toJSValueRef(rrule->getDaysOfTheWeek());
+                       if(rrule->getDaysOfTheWeekJSRef()) {
+                               return rrule->getDaysOfTheWeekJSRef();
+                       } else {
+                               LogDebug("Create a JS object for daysOfTheWeek.");
+                       StringArrayPtr daysOfTheWeek = rrule->getDaysOfTheWeek();
+                               JSValueRef jsDaysOfTheWeek = converter.toJSValueRefStringArray(daysOfTheWeek);
+                               rrule->setDaysOfTheWeekJSRef(converter.toJSObjectRef(jsDaysOfTheWeek));
+
+                               JSValueProtect(globalContext, jsDaysOfTheWeek);
+                               rrule->setContext(globalContext);
+                   return jsDaysOfTheWeek;
+                       }
         //} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_DAYS_OF_THE_YEAR)) {
             //return converter.toJSValueRef(rrule->getDaysOfTheYear());
         //} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_WEEKS_OF_THE_YEAR)) {
             //return converter.toJSValueRef(rrule->getWeeksOfTheYear());
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_SET_POSITIONS)) {
-            return converter.toJSValueRefNumberArray(rrule->getSetPositions());
+                       if(rrule->getSetPositionsJSRef()) {
+                               return rrule->getSetPositionsJSRef();
+                       } else {
+                               LogDebug("Create a JS object for setPositions.");
+                               NumberArrayPtr setPositions = rrule->getSetPositions();
+                               JSValueRef jsSetPositions = converter.toJSValueRefNumberArray(setPositions);
+                               rrule->setSetPositionsJSRef(converter.toJSObjectRef(jsSetPositions));
+
+                               JSValueProtect(globalContext, jsSetPositions);
+                               rrule->setContext(globalContext);
+                               return jsSetPositions;
+                       }
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_EXCEPTIONS)) {
-            return converter.toJSValueRefTZDateArray(rrule->getExceptions());
+                       if(rrule->getExceptionsJSRef()) {
+                               return rrule->getExceptionsJSRef();
+                       } else {
+                               LogDebug("Create a JS object for exceptions with time zone: "<<rrule->getTimeZone());
+                               NumberArrayPtr exceptions = rrule->getExceptions();
+                               JSValueRef jsExceptions = converter.toJSValueRefTZDateArray(exceptions, rrule->getTimeZone());
+                               rrule->setExceptionsJSRef(converter.toJSObjectRef(jsExceptions));
+
+                               JSValueProtect(globalContext, jsExceptions);
+                               rrule->setContext(globalContext);
+                               return jsExceptions;
+                       }
         }
     }
     Catch(Exception)
index acb0db0..3fbcc81 100755 (executable)
@@ -34,6 +34,7 @@
 #include <JSTizenException.h>
 #include <JSTizenExceptionFactory.h>
 
+#include <GlobalContextManager.h>
 
 using namespace WrtDeviceApis::Commons;
 using namespace WrtDeviceApis::CommonsJavaScript;
@@ -111,7 +112,8 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context,
 {
     Try
     {
-        CalendarConverter converter(context);
+               JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+        CalendarConverter converter(globalContext);
         CalendarEventPtr task;
 
         if (argumentCount==0) {
@@ -123,7 +125,7 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context,
                 CalendarEventPtr result(new CalendarEvent());
                 task = result;
             } else if (JSValueIsObject(context, arguments[0])) {
-                task = converter.toEvent(arguments[0]);
+                task = converter.toItem(arguments[0]);
                 if (!task) {
                     ThrowMsg(ConversionException, "Parameter conversion failed.");
                 }
@@ -260,21 +262,5 @@ JSValueRef JSCalendarTask::getPropertyId(JSContextRef context,
     return JSValueMakeUndefined(context);
 }
 
-bool JSCalendarTask::validate(JSContextRef ctx,
-        const JSObjectRef object,
-        JSValueRef* exception)
-{
-    CalendarTaskPrivObject *priv =
-        static_cast<CalendarTaskPrivObject*>(JSObjectGetPrivate(object));
-    if (priv == NULL) {
-        return false;
-    }
-    CalendarEventPtr event = priv->getObject();
-    if (!event) {
-        return false;
-    }
-    return event->validate();
-}
-
 }
 }
index edffa6f..9815149 100755 (executable)
@@ -29,7 +29,9 @@ namespace Calendar {
 #define TIZEN_INTERFACE_CALENDAR_TASK "CalendarTask"
 
 #define TIZEN_CALENDAR_TASK_ID "id"
-#define TIZEN_CALENDAR_TASK_LAST_MODIFICATION_DATE "lastModificationDate"
+#define TIZEN_CALENDAR_TASK_DUE_DATE  "dueDate"
+#define TIZEN_CALENDAR_TASK_COMPLETED_DATE  "completedDate"
+#define TIZEN_CALENDAR_TASK_PROGRESS "progress"
 
 typedef WrtDeviceApis::CommonsJavaScript::PrivateObject<CalendarEventPtr,
        WrtDeviceApis::CommonsJavaScript::NoOwnership> CalendarTaskPrivObject;
@@ -48,10 +50,6 @@ class JSCalendarTask
             JSContextRef ctx,
             const JSObjectRef object);
 
-    static bool validate(JSContextRef ctx,
-            const JSObjectRef object,
-            JSValueRef* exception);
-
        static JSObjectRef createJSCalendarTask(JSContextRef context, CalendarEventPtr task);
 
   private:
diff --git a/src/Calendar/JSNumberArray.cpp b/src/Calendar/JSNumberArray.cpp
deleted file mode 100755 (executable)
index f1eb3a4..0000000
+++ /dev/null
@@ -1,600 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#include <algorithm>
-#include <sstream>
-#include <dpl/log/log.h>
-#include <CommonsJavaScript/Converter.h>
-#include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
-#include <CommonsJavaScript/Converter.h>
-#include "JSNumberArray.h"
-
-#define FUNCTION_CONCAT "concat"
-#define FUNCTION_JOIN "join"
-#define FUNCTION_POP "pop"
-#define FUNCTION_PUSH "push"
-#define FUNCTION_REVERSE "reverse"
-#define FUNCTION_SHIFT "shift"
-#define FUNCTION_SLICE "slice"
-#define FUNCTION_SORT "sort"
-#define FUNCTION_SPLICE "splice"
-#define FUNCTION_TOSTRING "toString"
-#define FUNCTION_UNSHIFT "unshift"
-#define FUNCTION_VALUEOF "valueOf"
-#define ARRAY "Array"
-#define ATTRIBUTE_LENGTH "length"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-
-using namespace DeviceAPI::Common;
-using namespace WrtDeviceApis::CommonsJavaScript;
-
-JSClassDefinition JSNumberArray::m_classInfo = {
-       0,
-       kJSClassAttributeNone,
-       ARRAY,
-       0,
-       m_property,
-       m_function,
-       initialize,
-       finalize,
-       hasProperty,
-       getProperty,
-       setProperty,
-       NULL, //deleteProperty,
-       getPropertyNames,
-       NULL, //callAsFunction,
-       NULL, //callAsConstructor,
-       NULL, //hasInstance,
-       NULL, //convertToType,
-};
-
-JSStaticValue JSNumberArray::m_property[] = {
-       { ATTRIBUTE_LENGTH, getLength, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSNumberArray::m_function[] = {
-       { FUNCTION_CONCAT, concat, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_JOIN, join, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_POP, pop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_PUSH, push, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_REVERSE, reverse, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SHIFT, shift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SLICE, slice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SORT, sort, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SPLICE, splice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_TOSTRING, toString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_UNSHIFT, unshift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_VALUEOF, valueOf, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0 }
-};
-
-JSClassRef JSNumberArray::m_jsClassRef = JSClassCreate(
-               JSNumberArray::getClassInfo());
-
-JSValueRef JSNumberArray::getLength(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       Try
-       {
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (numbers) {
-                       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-                       return converter->toJSValueRef(numbers->size());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid conversion");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSObjectRef JSNumberArray::createArray(JSContextRef context,
-               const NumberArrayPtr &numbers)
-{
-       JSNumberArrayPriv *priv = new JSNumberArrayPriv(context, numbers);
-       return JSObjectMake(context, getClassRef(), priv);
-}
-
-const JSClassDefinition* JSNumberArray::getClassInfo()
-{
-       return &(m_classInfo);
-}
-
-JSClassRef JSNumberArray::getClassRef()
-{
-       if (!m_jsClassRef) {
-               m_jsClassRef = JSClassCreate(&m_classInfo);
-       }
-       return m_jsClassRef;
-}
-
-bool JSNumberArray::isObjectOfClass(JSContextRef context, JSValueRef value)
-{
-       return JSValueIsObjectOfClass(context, value, getClassRef());
-}
-
-NumberArrayPtr JSNumberArray::getNumberArray(JSContextRef context, JSValueRef value)
-{
-       if (!isObjectOfClass(context, value)) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSObjectRef object = JSValueToObject(context, value, NULL);
-       if (!object) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSNumberArrayPriv* priv = static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               Throw(WrtDeviceApis::Commons::NullPointerException);
-       }
-       return priv->getObject();
-}
-
-void JSNumberArray::initialize(JSContextRef context,
-               JSObjectRef object)
-{
-}
-
-void JSNumberArray::finalize(JSObjectRef object)
-{
-       JSNumberArrayPriv* priv =
-               static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-       delete priv;
-       JSObjectSetPrivate(object, NULL);
-}
-
-bool JSNumberArray::hasProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (index < numbers->size()) {
-                       return true;
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               //not reporting error is intended
-       }
-       return false;
-}
-
-JSValueRef JSNumberArray::getProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (index < numbers->size()) {
-                       long long int result = numbers->at(index);
-            LogInfo("index: "<<index<<", result: "<<result);
-            return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-bool JSNumberArray::setProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef value,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               long long int number = 0;
-               if (!JSValueIsUndefined(context, value)) {
-                       number = converter->toLongLong(value);
-               }
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (!numbers) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               if (numbers->size() <= index) {
-                       numbers->resize(index + 1);
-               }
-               (*numbers)[index] = number;
-               return true;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-               JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-       }
-       return false;
-}
-
-void JSNumberArray::getPropertyNames(JSContextRef context,
-               JSObjectRef object,
-               JSPropertyNameAccumulatorRef propertyNames)
-{
-    Converter converter(context);
-
-       Try
-       {
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-
-               int count = numbers->size();
-
-               for(int i=0; i < count; i++)
-               {
-                       ScopedJSStringRef name(converter.toJSStringRef(converter.toString(i)));
-                       JSPropertyNameAccumulatorAddName(propertyNames, name.get());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-}
-
-JSValueRef JSNumberArray::concat(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               NumberArrayPtr numbers = NumberArrayPtr(new NumberArray());
-               JSNumberArrayPriv *newPrivateObject = new JSNumberArrayPriv(
-                               context,
-                               numbers);
-               JSValueRef result = JSObjectMake(context,
-                                                                                getClassRef(), newPrivateObject);
-
-               //copy current numbers
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               for (size_t i = 0; i < currentNumbers->size(); ++i) {
-                       numbers->push_back(currentNumbers->at(i));
-               }
-
-               //copy submitted arrays
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       if (!JSIsArrayValue(context, arguments[i])) {
-                               Throw(WrtDeviceApis::Commons::ConversionException);
-                       }
-                       // process array of numbers
-                       JSObjectRef arrayObj = converter->toJSObjectRef(arguments[i]);
-                       unsigned int len = JSGetArrayLength(context, arrayObj);
-                       for (unsigned int e = 0; e < len; ++e) {
-                               JSValueRef att = JSGetArrayElement(context, arrayObj, e);
-                               numbers->push_back(converter->toLong(att));
-                       }
-               }
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSNumberArray::join(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               std::string result;
-               std::string separator(",");
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv = static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (argumentCount > 0 && JSValueIsString(context, arguments[0])) {
-                       separator = converter->toString(arguments[0]);
-                       LogDebug("Separator: "<<separator);
-               }
-               for (size_t i = 0; i < currentNumbers->size(); ++i) {
-                       if (i != 0) {
-                               result += separator;
-                       }
-                       std::stringstream ss;
-                       ss<<currentNumbers->at(i);
-                       result += ss.str();
-               }
-               LogDebug("Resulting string: "<<result);
-               return converter->toJSValueRef(result);
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSNumberArray::pop(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (currentNumbers->size() > 0) {
-                       long long int result = currentNumbers->at(
-                                       currentNumbers->size() - 1);
-                       currentNumbers->pop_back();
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::push(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       currentNumbers->push_back(converter->toLong(arguments[i]));
-               }
-               return converter->toJSValueRef(currentNumbers->size());
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSNumberArray::reverse(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::reverse(currentNumbers->begin(), currentNumbers->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::shift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (currentNumbers->size() > 0) {
-                       long long int result = currentNumbers->at(0);
-                       currentNumbers->erase(currentNumbers->begin());
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::slice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               if (argumentCount < 1) {
-                       return JSValueMakeUndefined(context);
-               }
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               NumberArrayPtr numbers = NumberArrayPtr(new NumberArray());
-               JSNumberArrayPriv *newPrivateObject = new JSNumberArrayPriv(
-                               context,
-                               numbers);
-               JSValueRef result = JSObjectMake(context,
-                                                                                getClassRef(), newPrivateObject);
-
-               //copy current numbers
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::size_t first = converter->toSizeT(arguments[0]);
-               std::size_t last = currentNumbers->size() - 1;
-               if (argumentCount > 1) {
-                       last = converter->toSizeT(arguments[1]);
-                       if (last >= currentNumbers->size()) {
-                               last = currentNumbers->size() - 1;
-                       }
-               }
-               for (size_t i = first; i <= last; ++i) {
-                       numbers->push_back(currentNumbers->at(i));
-               }
-
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSNumberArray::sort(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSNumberArrayPriv* priv =
-                       static_cast<JSNumberArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::sort(currentNumbers->begin(), currentNumbers->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::splice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::toString(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return join(context, function, thisObject, 0, arguments, exception);
-}
-
-JSValueRef JSNumberArray::unshift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNumberArray::valueOf(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-} // Calendar
-} // DeviceAPI
diff --git a/src/Calendar/JSNumberArray.h b/src/Calendar/JSNumberArray.h
deleted file mode 100755 (executable)
index 676279b..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _TIZEN_CALENDAR_JS_NUMBER_ARRAY_H_
-#define _TIZEN_CALENDAR_JS_NUMBER_ARRAY_H_
-
-#include <vector>
-#include <JavaScriptCore/JavaScript.h>
-#include <CommonsJavaScript/PrivateObject.h>
-#include "CalendarEvent.h"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<NumberArrayPtr>::Type JSNumberArrayPriv;
-
-class JSNumberArray
-{
-public:
-
-       static const JSClassDefinition* getClassInfo();
-
-       static JSClassRef getClassRef();
-
-       static JSObjectRef createArray(JSContextRef context,
-                       const NumberArrayPtr &Numbers);
-
-       static bool isObjectOfClass(JSContextRef context, JSValueRef value);
-
-       static NumberArrayPtr getNumberArray(JSContextRef context, JSValueRef value);
-
-private:
-
-       /**
-        * The callback invoked when an object is first created.
-        */
-       static void initialize(JSContextRef context,
-                       JSObjectRef object);
-
-       /**
-        * The callback invoked when an object is finalized.
-        */
-       static void finalize(JSObjectRef object);
-
-       static JSValueRef getLength(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool hasProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName);
-
-       static JSValueRef getProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool setProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef value,
-                       JSValueRef* exception);
-
-       static void getPropertyNames(JSContextRef context,
-                       JSObjectRef object,
-                       JSPropertyNameAccumulatorRef propertyNames);
-
-       static JSValueRef concat(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef join(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static JSValueRef pop(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef push(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef reverse(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef shift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef slice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef sort(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef splice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef toString(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef unshift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef valueOf(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static bool checkValue(const long long int &value);
-
-       static JSClassRef m_jsClassRef;
-       /**
-        * This structure describes a statically declared function property.
-        */
-       static JSStaticFunction m_function[];
-
-       /**
-        * This structure contains properties and callbacks that define a type of object.
-        */
-       static JSClassDefinition m_classInfo;
-
-       /**
-        * This member variable contains the initialization values for the static properties of this class.
-        * The values are given according to the data structure JSPropertySpec
-        */
-       static JSStaticValue m_property[];
-};
-
-} // Calendar
-} // DeviceAPI
-
-#endif // _TIZEN_CALENDAR_JS_NUMBER_ARRAY_H_
diff --git a/src/Calendar/JSStringArray.cpp b/src/Calendar/JSStringArray.cpp
deleted file mode 100755 (executable)
index 6f18ea6..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#include <algorithm>
-#include <dpl/log/log.h>
-#include <CommonsJavaScript/Converter.h>
-#include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
-#include "CalendarConverter.h"
-#include "JSStringArray.h"
-
-#define FUNCTION_CONCAT "concat"
-#define FUNCTION_JOIN "join"
-#define FUNCTION_POP "pop"
-#define FUNCTION_PUSH "push"
-#define FUNCTION_REVERSE "reverse"
-#define FUNCTION_SHIFT "shift"
-#define FUNCTION_SLICE "slice"
-#define FUNCTION_SORT "sort"
-#define FUNCTION_SPLICE "splice"
-#define FUNCTION_TOSTRING "toString"
-#define FUNCTION_UNSHIFT "unshift"
-#define FUNCTION_VALUEOF "valueOf"
-#define ARRAY "Array"
-#define ATTRIBUTE_LENGTH "length"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-
-using namespace DeviceAPI::Common;
-using namespace WrtDeviceApis::CommonsJavaScript;
-
-JSClassDefinition JSStringArray::m_classInfo = {
-       0,
-       kJSClassAttributeNone,
-       ARRAY,
-       0,
-       m_property,
-       m_function,
-       initialize,
-       finalize,
-       hasProperty,
-       getProperty,
-       setProperty,
-       NULL, //deleteProperty,
-       getPropertyNames,
-       NULL, //callAsFunction,
-       NULL, //callAsConstructor,
-       NULL, //hasInstance,
-       NULL, //convertToType,
-};
-
-JSStaticValue JSStringArray::m_property[] = {
-       { ATTRIBUTE_LENGTH, getLength, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSStringArray::m_function[] = {
-       { FUNCTION_CONCAT, concat, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_JOIN, join, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_POP, pop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_PUSH, push, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_REVERSE, reverse, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SHIFT, shift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SLICE, slice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SORT, sort, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SPLICE, splice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_TOSTRING, toString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_UNSHIFT, unshift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_VALUEOF, valueOf, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0 }
-};
-
-JSClassRef JSStringArray::m_jsClassRef = JSClassCreate(
-               JSStringArray::getClassInfo());
-
-JSValueRef JSStringArray::getLength(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       Try
-       {
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               StringArrayPtr strs = priv->getObject();
-               if (strs) {
-                       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-                       return converter->toJSValueRef(strs->size());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid conversion");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSObjectRef JSStringArray::createArray(JSContextRef context,
-               const StringArrayPtr &strs)
-{
-       JSStringArrayPriv *priv = new JSStringArrayPriv(context, strs);
-       return JSObjectMake(context, getClassRef(), priv);
-}
-
-const JSClassDefinition* JSStringArray::getClassInfo()
-{
-       return &(m_classInfo);
-}
-
-JSClassRef JSStringArray::getClassRef()
-{
-       if (!m_jsClassRef) {
-               m_jsClassRef = JSClassCreate(&m_classInfo);
-       }
-       return m_jsClassRef;
-}
-
-bool JSStringArray::isObjectOfClass(JSContextRef context, JSValueRef value)
-{
-       return JSValueIsObjectOfClass(context, value, getClassRef());
-}
-
-StringArrayPtr JSStringArray::getStringArray(JSContextRef context, JSValueRef value)
-{
-       if (!isObjectOfClass(context, value)) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSObjectRef object = JSValueToObject(context, value, NULL);
-       if (!object) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSStringArrayPriv* priv = static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               Throw(WrtDeviceApis::Commons::NullPointerException);
-       }
-       return priv->getObject();
-}
-
-void JSStringArray::initialize(JSContextRef context,
-               JSObjectRef object)
-{
-}
-
-void JSStringArray::finalize(JSObjectRef object)
-{
-       JSStringArrayPriv* priv =
-               static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-       delete priv;
-       JSObjectSetPrivate(object, NULL);
-}
-
-bool JSStringArray::hasProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               StringArrayPtr strs = priv->getObject();
-               if (index < strs->size()) {
-                       return true;
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               //not reporting error is intended
-       }
-       return false;
-}
-
-JSValueRef JSStringArray::getProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               StringArrayPtr strs = priv->getObject();
-               if (index < strs->size()) {
-                       std::string result = strs->at(index);
-                       if (!result.empty()) {
-                               return converter->toJSValueRef(result);
-                       }
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-bool JSStringArray::setProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef value,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               std::string str;
-               if (!JSValueIsUndefined(context, value)) {
-                       str = converter->toString(value);
-               }
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               StringArrayPtr strs = priv->getObject();
-               if (!strs) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               if (strs->size() <= index) {
-                       strs->resize(index + 1);
-               }
-               (*strs)[index] = str;
-               return true;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-               JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-       }
-       return false;
-}
-
-void JSStringArray::getPropertyNames(JSContextRef context,
-               JSObjectRef object,
-               JSPropertyNameAccumulatorRef propertyNames)
-{
-    CalendarConverter converter(context);
-
-       Try
-       {
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               StringArrayPtr strings = priv->getObject();
-
-               int count = strings->size();
-
-               for(int i=0; i < count; i++)
-               {
-                       ScopedJSStringRef name(converter.toJSStringRef(converter.toString(i)));
-                       JSPropertyNameAccumulatorAddName(propertyNames, name.get());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-}
-
-JSValueRef JSStringArray::concat(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               StringArrayPtr strs = StringArrayPtr(new StringArray());
-               JSStringArrayPriv *newPrivateObject = new JSStringArrayPriv(
-                               context,
-                               strs);
-               JSValueRef result = JSObjectMake(context,
-                                                                                getClassRef(), newPrivateObject);
-
-               //copy current strs
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               for (size_t i = 0; i < currentStrings->size(); ++i) {
-                       strs->push_back(currentStrings->at(i));
-               }
-
-               //copy submitted arrays
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       if (!JSIsArrayValue(context, arguments[i])) {
-                               Throw(WrtDeviceApis::Commons::ConversionException);
-                       }
-                       // process array of strings
-                       JSObjectRef arrayObj = converter->toJSObjectRef(arguments[i]);
-                       unsigned int len = JSGetArrayLength(context, arrayObj);
-                       for (unsigned int e = 0; e < len; ++e) {
-                               JSValueRef att = JSGetArrayElement(context, arrayObj, e);
-                               strs->push_back(converter->toString(att));
-                       }
-               }
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSStringArray::join(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               std::string result;
-               std::string separator(",");
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               if (argumentCount > 0 && JSValueIsString(context, arguments[0])) {
-                       separator = converter->toString(arguments[0]);
-               }
-               for (size_t i = 0; i < currentStrings->size(); ++i) {
-                       if (i != 0) {
-                               result += separator;
-                       }
-                       result += currentStrings->at(i);
-               }
-               return converter->toJSValueRef(result);
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSStringArray::pop(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               if (currentStrings->size() > 0) {
-                       std::string result = currentStrings->at(
-                                       currentStrings->size() - 1);
-                       currentStrings->pop_back();
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::push(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       currentStrings->push_back(converter->toString(arguments[i]));
-               }
-               return converter->toJSValueRef(currentStrings->size());
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSStringArray::reverse(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               std::reverse(currentStrings->begin(), currentStrings->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::shift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               if (currentStrings->size() > 0) {
-                       std::string result = currentStrings->at(0);
-                       currentStrings->erase(currentStrings->begin());
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::slice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               if (argumentCount < 1) {
-                       return JSValueMakeUndefined(context);
-               }
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               StringArrayPtr strs = StringArrayPtr(new StringArray());
-               JSStringArrayPriv *newPrivateObject = new JSStringArrayPriv(
-                               context,
-                               strs);
-               JSValueRef result = JSObjectMake(context,
-                                                                                getClassRef(), newPrivateObject);
-
-               //copy current strs
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               std::size_t first = converter->toSizeT(arguments[0]);
-               std::size_t last = currentStrings->size() - 1;
-               if (argumentCount > 1) {
-                       last = converter->toSizeT(arguments[1]);
-                       if (last >= currentStrings->size()) {
-                               last = currentStrings->size() - 1;
-                       }
-               }
-               for (size_t i = first; i <= last; ++i) {
-                       strs->push_back(currentStrings->at(i));
-               }
-
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSStringArray::sort(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSStringArrayPriv* priv =
-                       static_cast<JSStringArrayPriv*>(JSObjectGetPrivate(thisObject));
-               StringArrayPtr currentStrings = priv->getObject();
-               std::sort(currentStrings->begin(), currentStrings->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::splice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::toString(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return join(context, function, thisObject, 0, arguments, exception);
-}
-
-JSValueRef JSStringArray::unshift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSStringArray::valueOf(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-} // Calendar
-} // DeviceAPI
diff --git a/src/Calendar/JSStringArray.h b/src/Calendar/JSStringArray.h
deleted file mode 100755 (executable)
index 4a4825c..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _TIZEN_CALENDAR_JS_STRING_ARRAY_H_
-#define _TIZEN_CALENDAR_JS_STRING_ARRAY_H_
-
-#include <vector>
-#include <JavaScriptCore/JavaScript.h>
-#include <CommonsJavaScript/PrivateObject.h>
-#include "CalendarEvent.h"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<StringArrayPtr>::Type JSStringArrayPriv;
-
-class JSStringArray
-{
-public:
-
-       static const JSClassDefinition* getClassInfo();
-
-       static JSClassRef getClassRef();
-
-       static JSObjectRef createArray(JSContextRef context,
-                       const StringArrayPtr &Strings);
-
-       static bool isObjectOfClass(JSContextRef context, JSValueRef value);
-
-       static StringArrayPtr getStringArray(JSContextRef context, JSValueRef value);
-
-private:
-
-       /**
-        * The callback invoked when an object is first created.
-        */
-       static void initialize(JSContextRef context,
-                       JSObjectRef object);
-
-       /**
-        * The callback invoked when an object is finalized.
-        */
-       static void finalize(JSObjectRef object);
-
-       static JSValueRef getLength(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool hasProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName);
-
-       static JSValueRef getProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool setProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef value,
-                       JSValueRef* exception);
-
-       static void getPropertyNames(JSContextRef context,
-                       JSObjectRef object,
-                       JSPropertyNameAccumulatorRef propertyNames);
-
-       static JSValueRef concat(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef join(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef pop(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef push(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef reverse(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef shift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef slice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef sort(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef splice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef toString(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef unshift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef valueOf(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static bool checkValue(const std::string &value);
-
-       static JSClassRef m_jsClassRef;
-       /**
-        * This structure describes a statically declared function property.
-        */
-       static JSStaticFunction m_function[];
-
-       /**
-        * This structure contains properties and callbacks that define a type of object.
-        */
-       static JSClassDefinition m_classInfo;
-
-       /**
-        * This member variable contains the initialization values for the static properties of this class.
-        * The values are given according to the data structure JSPropertySpec
-        */
-       static JSStaticValue m_property[];
-};
-
-} // Calendar
-} // DeviceAPI
-
-#endif // _TIZEN_CALENDAR_JS_STRING_ARRAY_H_
\ No newline at end of file
diff --git a/src/Calendar/JSTZDateArray.cpp b/src/Calendar/JSTZDateArray.cpp
deleted file mode 100755 (executable)
index 200d89f..0000000
+++ /dev/null
@@ -1,611 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#include <algorithm>
-#include <sstream>
-#include <dpl/log/log.h>
-#include <CommonsJavaScript/Converter.h>
-#include <CommonsJavaScript/ScopedJSStringRef.h>
-#include <JSTizenExceptionFactory.h>
-#include <JSTizenException.h>
-#include <CommonsJavaScript/Converter.h>
-#include "JSTZDateArray.h"
-#include <TimeUtilConverter.h>
-
-#define FUNCTION_CONCAT "concat"
-#define FUNCTION_JOIN "join"
-#define FUNCTION_POP "pop"
-#define FUNCTION_PUSH "push"
-#define FUNCTION_REVERSE "reverse"
-#define FUNCTION_SHIFT "shift"
-#define FUNCTION_SLICE "slice"
-#define FUNCTION_SORT "sort"
-#define FUNCTION_SPLICE "splice"
-#define FUNCTION_TOSTRING "toString"
-#define FUNCTION_UNSHIFT "unshift"
-#define FUNCTION_VALUEOF "valueOf"
-#define ARRAY "Array"
-#define ATTRIBUTE_LENGTH "length"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-
-using namespace DeviceAPI::Common;
-using namespace DeviceAPI::Time;
-using namespace WrtDeviceApis::CommonsJavaScript;
-
-JSClassDefinition JSTZDateArray::m_classInfo = {
-       0,
-       kJSClassAttributeNone,
-       ARRAY,
-       0,
-       m_property,
-       m_function,
-       initialize,
-       finalize,
-       hasProperty,
-       getProperty,
-       setProperty,
-       NULL, //deleteProperty,
-       getPropertyNames,
-       NULL, //callAsFunction,
-       NULL, //callAsConstructor,
-       NULL, //hasInstance,
-       NULL, //convertToType,
-};
-
-JSStaticValue JSTZDateArray::m_property[] = {
-       { ATTRIBUTE_LENGTH, getLength, NULL, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0, 0 }
-};
-
-JSStaticFunction JSTZDateArray::m_function[] = {
-       { FUNCTION_CONCAT, concat, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_JOIN, join, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_POP, pop, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_PUSH, push, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_REVERSE, reverse, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SHIFT, shift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SLICE, slice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SORT, sort, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_SPLICE, splice, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_TOSTRING, toString, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_UNSHIFT, unshift, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { FUNCTION_VALUEOF, valueOf, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete },
-       { 0, 0, 0 }
-};
-
-JSClassRef JSTZDateArray::m_jsClassRef = JSClassCreate(
-               JSTZDateArray::getClassInfo());
-
-JSValueRef JSTZDateArray::getLength(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       Try
-       {
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (numbers) {
-                       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-                       return converter->toJSValueRef(numbers->size());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid conversion");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSObjectRef JSTZDateArray::createArray(JSContextRef context,
-               const NumberArrayPtr &numbers)
-{
-       JSTZDateArrayPriv *priv = new JSTZDateArrayPriv(context, numbers);
-       return JSObjectMake(context, getClassRef(), priv);
-}
-
-const JSClassDefinition* JSTZDateArray::getClassInfo()
-{
-       return &(m_classInfo);
-}
-
-JSClassRef JSTZDateArray::getClassRef()
-{
-       if (!m_jsClassRef) {
-               m_jsClassRef = JSClassCreate(&m_classInfo);
-       }
-       return m_jsClassRef;
-}
-
-bool JSTZDateArray::isObjectOfClass(JSContextRef context, JSValueRef value)
-{
-       return JSValueIsObjectOfClass(context, value, getClassRef());
-}
-
-NumberArrayPtr JSTZDateArray::getTZDateArray(JSContextRef context, JSValueRef value)
-{
-       if (!isObjectOfClass(context, value)) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSObjectRef object = JSValueToObject(context, value, NULL);
-       if (!object) {
-               Throw(WrtDeviceApis::Commons::InvalidArgumentException);
-       }
-       JSTZDateArrayPriv* priv = static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-       if (!priv) {
-               Throw(WrtDeviceApis::Commons::NullPointerException);
-       }
-       return priv->getObject();
-}
-
-void JSTZDateArray::initialize(JSContextRef context,
-               JSObjectRef object)
-{
-}
-
-void JSTZDateArray::finalize(JSObjectRef object)
-{
-       JSTZDateArrayPriv* priv =
-               static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-       delete priv;
-       JSObjectSetPrivate(object, NULL);
-}
-
-bool JSTZDateArray::hasProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (index < numbers->size()) {
-                       return true;
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               //not reporting error is intended
-       }
-       return false;
-}
-
-JSValueRef JSTZDateArray::getProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-    TimeUtilConverter timeConverter(context);
-
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (index < numbers->size()) {
-                       long long int result = numbers->at(index);
-            LogInfo("index: "<<index<<", result: "<<result);
-            return timeConverter.toJSValueRefTZDate((double)(result*1000.0), "");
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-bool JSTZDateArray::setProperty(JSContextRef context,
-               JSObjectRef object,
-               JSStringRef propertyName,
-               JSValueRef value,
-               JSValueRef* exception)
-{
-       WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                       WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-    TimeUtilConverter timeConverter(context);
-
-       Try
-       {
-               size_t index = converter->toSizeT(propertyName);
-               long long int number = 0;
-               if (!JSValueIsUndefined(context, value)) {
-                       number = timeConverter.getTimeInMilliseconds(value)/1000;
-               }
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-               if (!numbers) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               if (numbers->size() <= index) {
-                       numbers->resize(index + 1);
-               }
-               (*numbers)[index] = number;
-               return true;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-               JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-       }
-       return false;
-}
-
-void JSTZDateArray::getPropertyNames(JSContextRef context,
-               JSObjectRef object,
-               JSPropertyNameAccumulatorRef propertyNames)
-{
-    Converter converter(context);
-
-       Try
-       {
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(object));
-               if (!priv) {
-                       Throw(WrtDeviceApis::Commons::NullPointerException);
-               }
-               NumberArrayPtr numbers = priv->getObject();
-
-               int count = numbers->size();
-
-               for(int i=0; i < count; i++)
-               {
-                       ScopedJSStringRef name(converter.toJSStringRef(converter.toString(i)));
-                       JSPropertyNameAccumulatorAddName(propertyNames, name.get());
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("invalid property");
-       }
-}
-
-JSValueRef JSTZDateArray::concat(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               NumberArrayPtr numbers = NumberArrayPtr(new NumberArray());
-               JSTZDateArrayPriv *newPrivateObject = new JSTZDateArrayPriv(
-                               context,
-                               numbers);
-               JSValueRef result = JSObjectMake(context, getClassRef(), newPrivateObject);
-
-               //copy current numbers
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               for (size_t i = 0; i < currentNumbers->size(); ++i) {
-                       numbers->push_back(currentNumbers->at(i));
-               }
-
-               //copy submitted arrays
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-           TimeUtilConverter timeConverter(context);
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       if (!JSIsArrayValue(context, arguments[i])) {
-                               Throw(WrtDeviceApis::Commons::ConversionException);
-                       }
-                       // process array of numbers
-                       JSObjectRef arrayObj = converter->toJSObjectRef(arguments[i]);
-                       unsigned int len = JSGetArrayLength(context, arrayObj);
-                       for (unsigned int e = 0; e < len; ++e) {
-                               JSValueRef att = JSGetArrayElement(context, arrayObj, e);
-
-                               long long int number = 0;
-                               if (!JSValueIsUndefined(context, att)) {
-                                       number = timeConverter.getTimeInMilliseconds(att)/1000;
-                               }
-                               LogDebug("Concatenating a number: "<<number);
-                               numbers->push_back(number);
-                       }
-               }
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSTZDateArray::join(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               std::string result;
-               std::string separator(",");
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSTZDateArrayPriv* priv = static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-           TimeUtilConverter timeConverter(context);
-
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (argumentCount > 0 && JSValueIsString(context, arguments[0])) {
-                       separator = converter->toString(arguments[0]);
-                       LogDebug("Separator: "<<separator);
-               }
-               for (size_t i = 0; i < currentNumbers->size(); ++i) {
-                       if (i != 0) {
-                               result += separator;
-                       }
-                       std::stringstream ss;
-                       ss<<currentNumbers->at(i);
-                       result += ss.str();
-               }
-               LogDebug("Resulting string: "<<result);
-               return converter->toJSValueRef(result);
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSTZDateArray::pop(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-           TimeUtilConverter timeConverter(context);
-
-               JSTZDateArrayPriv* priv = static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (currentNumbers->size() > 0) {
-                       long long int result = currentNumbers->at(currentNumbers->size() - 1);
-                       currentNumbers->pop_back();
-                       return timeConverter.toJSValueRefTZDate((double)(result*1000.0), "");
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::push(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-           TimeUtilConverter timeConverter(context);
-
-               JSTZDateArrayPriv* priv = static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               for (size_t i = 0; i < argumentCount; ++i) {
-                       long long int number = 0;
-                       if (!JSValueIsUndefined(context, arguments[i])) {
-                               number = timeConverter.getTimeInMilliseconds(arguments[i])/1000;
-                       }
-                       LogDebug("Pushing a TZDate number: "<<number<<" for index: "<<i);
-                       currentNumbers->push_back(number);
-               }
-               return timeConverter.toJSValueRef(currentNumbers->size());
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSTZDateArray::reverse(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::reverse(currentNumbers->begin(), currentNumbers->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::shift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               if (currentNumbers->size() > 0) {
-                       long long int result = currentNumbers->at(0);
-                       currentNumbers->erase(currentNumbers->begin());
-                       return converter->toJSValueRef(result);
-               }
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::slice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               if (argumentCount < 1) {
-                       return JSValueMakeUndefined(context);
-               }
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               NumberArrayPtr numbers = NumberArrayPtr(new NumberArray());
-               JSTZDateArrayPriv *newPrivateObject = new JSTZDateArrayPriv(context, numbers);
-               JSValueRef result = JSObjectMake(context, getClassRef(), newPrivateObject);
-
-               //copy current numbers
-               JSTZDateArrayPriv* priv = static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::size_t first = converter->toSizeT(arguments[0]);
-               std::size_t last = currentNumbers->size() - 1;
-               if (argumentCount > 1) {
-                       last = converter->toSizeT(arguments[1]);
-                       if (last >= currentNumbers->size()) {
-                               last = currentNumbers->size() - 1;
-                       }
-               }
-
-               for (size_t i = first; i <= last; ++i) {
-                       numbers->push_back(currentNumbers->at(i));
-               }
-
-               return result;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch");
-}
-
-JSValueRef JSTZDateArray::sort(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       Try
-       {
-               WrtDeviceApis::CommonsJavaScript::BasicConverter converter =
-                               WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context);
-               JSTZDateArrayPriv* priv =
-                       static_cast<JSTZDateArrayPriv*>(JSObjectGetPrivate(thisObject));
-               NumberArrayPtr currentNumbers = priv->getObject();
-               std::sort(currentNumbers->begin(), currentNumbers->end());
-               return thisObject;
-       }
-       Catch(WrtDeviceApis::Commons::Exception)
-       {
-               LogError("error occured");
-       }
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::splice(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::toString(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return join(context, function, thisObject, 0, arguments, exception);
-}
-
-JSValueRef JSTZDateArray::unshift(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSTZDateArray::valueOf(JSContextRef context,
-               JSObjectRef function,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception)
-{
-       return JSValueMakeUndefined(context);
-}
-
-} // Calendar
-} // DeviceAPI
diff --git a/src/Calendar/JSTZDateArray.h b/src/Calendar/JSTZDateArray.h
deleted file mode 100755 (executable)
index added2e..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-//
-// Tizen Web Device API
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-
-#ifndef _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_
-#define _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_
-
-#include <vector>
-#include <JavaScriptCore/JavaScript.h>
-#include <CommonsJavaScript/PrivateObject.h>
-#include "CalendarEvent.h"
-
-namespace DeviceAPI {
-namespace Calendar {
-
-typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT<NumberArrayPtr>::Type JSTZDateArrayPriv;
-
-class JSTZDateArray
-{
-public:
-
-       static const JSClassDefinition* getClassInfo();
-
-       static JSClassRef getClassRef();
-
-       static JSObjectRef createArray(JSContextRef context,
-                       const NumberArrayPtr &Numbers);
-
-       static bool isObjectOfClass(JSContextRef context, JSValueRef value);
-
-       static NumberArrayPtr getTZDateArray(JSContextRef context, JSValueRef value);
-
-private:
-
-       /**
-        * The callback invoked when an object is first created.
-        */
-       static void initialize(JSContextRef context,
-                       JSObjectRef object);
-
-       /**
-        * The callback invoked when an object is finalized.
-        */
-       static void finalize(JSObjectRef object);
-
-       static JSValueRef getLength(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool hasProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName);
-
-       static JSValueRef getProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef* exception);
-
-       static bool setProperty(JSContextRef context,
-                       JSObjectRef object,
-                       JSStringRef propertyName,
-                       JSValueRef value,
-                       JSValueRef* exception);
-
-       static void getPropertyNames(JSContextRef context,
-                       JSObjectRef object,
-                       JSPropertyNameAccumulatorRef propertyNames);
-
-       static JSValueRef concat(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef join(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static JSValueRef pop(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef push(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef reverse(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef shift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef slice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef sort(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef splice(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef toString(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef unshift(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-       static JSValueRef valueOf(JSContextRef context,
-                       JSObjectRef function,
-                       JSObjectRef thisObject,
-                       size_t argumentCount,
-                       const JSValueRef arguments[],
-                       JSValueRef* exception);
-
-       static bool checkValue(const long long int &value);
-
-       static JSClassRef m_jsClassRef;
-       /**
-        * This structure describes a statically declared function property.
-        */
-       static JSStaticFunction m_function[];
-
-       /**
-        * This structure contains properties and callbacks that define a type of object.
-        */
-       static JSClassDefinition m_classInfo;
-
-       /**
-        * This member variable contains the initialization values for the static properties of this class.
-        * The values are given according to the data structure JSPropertySpec
-        */
-       static JSStaticValue m_property[];
-};
-
-} // Calendar
-} // DeviceAPI
-
-#endif // _TIZEN_CALENDAR_JS_TZDATE_ARRAY_H_
\ No newline at end of file
index c037436..0d10388 100755 (executable)
@@ -32,6 +32,8 @@
 #include "CalendarAsyncCallbackManager.h"
 #include "CalendarListenerManager.h"
 
+#include <GlobalContextManager.h>
+
 namespace DeviceAPI {
 namespace Calendar {
 
@@ -63,6 +65,7 @@ void on_widget_stop_callback(int widgetId)
 void on_frame_load_callback(const void * context)
 {
     LogDebug("[Tizen\\Calendar] on_frame_load_callback (" << context << ")");
+       DeviceAPI::Common::GlobalContextManager::getInstance()->addGlobalContext(static_cast<JSContextRef>(context));
 }
 
 void on_frame_unload_callback(const void * context)
@@ -71,6 +74,7 @@ void on_frame_unload_callback(const void * context)
 
        CalendarAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
        CalendarListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
+       DeviceAPI::Common::GlobalContextManager::getInstance()->removeGlobalContext(static_cast<JSContextRef>(context));
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
index af445e8..bebb11c 100755 (executable)
@@ -25,7 +25,8 @@
 #include <Commons/Exception.h>
 #include <CommonsJavaScript/JSCallbackManager.h>
 #include <dpl/shared_ptr.h>
-#include <dpl/log/log.h>
+#include <Logger.h>
+
 #include <IFilter.h>
 #include <IFilterVisitor.h>
 #include "CallHistoryDefine.h"
@@ -73,7 +74,8 @@ CallHistory::~CallHistory()
 
        if (m_watchers.size() > 0) {
                for (;it < CallHistory::m_watchers.end();) {
-                       ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
+                       //ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
+                       ret = contacts_db_remove_changed_cb_with_info(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
 
                        if (ret != CONTACTS_ERROR_NONE) {
                                LogDebug("callhistory remove listener error [" << ret << "]");
@@ -90,12 +92,11 @@ CallHistory::~CallHistory()
        EventRequestReceiver<EventCallHistory>::PostRequest(event);
 }
 
-void CallHistory::callhistoryListenerCB(const char* view_uri, void* user_data)
+void CallHistory::callhistoryListenerCB(const char* view_uri, char *changes, void* user_data)
 {
-       LogDebug("enter");
+       
        if (user_data != NULL) {
-               ((CallHistory::Watcher*)user_data)->addedListenerCB();
-               ((CallHistory::Watcher*)user_data)->changedListenerCB();
+               ((CallHistory::Watcher*)user_data)->ListenerCB(changes);
        }
 }
 
@@ -269,39 +270,7 @@ long CallHistory::addListener(const EventCallHistoryListenerEmitterPtr& emitter)
 
        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());
-
-               if (ret == CONTACTS_ERROR_NONE) {
-                       CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList());
-
-                       contacts_query_h query = NULL;
-                       contacts_filter_h filter = NULL;
-                       contacts_list_h recordList = NULL;
-
-                       contacts_query_create(_contacts_phone_log._uri, &query);
-                       contacts_filter_create(_contacts_phone_log._uri, &filter);
-                       contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_BLOCKED);
-
-                       contacts_query_set_filter(query, filter);
-                       contacts_query_set_sort(query, _contacts_phone_log.id, false);
-                       ret = contacts_db_get_records_with_query(query, 0, 1, &recordList);
-
-                       if (ret != CONTACTS_ERROR_NONE) {
-                               LogDebug("callhistory query error [" << ret << "]");
-                       }
-
-                       if (parseRecord(&recordList, callHistoryListPtr)) {
-                               if (callHistoryListPtr->size() > 0) {
-                                       watcher->setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
-                               }
-                       }
-                       contacts_list_destroy(recordList, true);
-                       contacts_query_destroy(query);
-                       contacts_filter_destroy(filter);
-
-                       MissedCallListPtr missedCallList(updateCurrentMissedCall());
-                       watcher->setMissedCallList(missedCallList);
-               }
+               ret = contacts_db_add_changed_cb_with_info(_contacts_phone_log._uri, callhistoryListenerCB, watcher.Get());
 
                watcher->setHandle(static_cast<long>(emitter->getId()));
                CallHistory::m_watchers.push_back(watcher);
@@ -324,7 +293,7 @@ void CallHistory::removeListener(const long id)
 
                if (id == (*it)->getHandle()) {
                        flag = true;
-                       ret = contacts_db_remove_changed_cb(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
+                       ret = contacts_db_remove_changed_cb_with_info(_contacts_phone_log._uri, callhistoryListenerCB, it->Get());
 
                        if (ret != CONTACTS_ERROR_NONE) {
                                LogDebug("callhistory remove listener error [" << ret << "]");
@@ -334,9 +303,7 @@ void CallHistory::removeListener(const long id)
                        continue;
                }
                ++it;
-
        }
-       LogDebug("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")");
 
        if (!flag) {
                ThrowMsg(Commons::InvalidArgumentException, "Invalid values error : handle");
@@ -354,8 +321,6 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP
 
        contacts_list_get_count(*recordList, &total);
 
-       LogDebug("total [" << total << "]");
-
        for (int i = 0; i < total; i++) {
                ret = contacts_list_get_current_record_p(*recordList, &record);
 
@@ -412,47 +377,6 @@ unsigned int CallHistory::convertAttrName(std::string &name)
        }
 }
 
-MissedCallListPtr CallHistory::updateCurrentMissedCall()
-{
-       CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList());
-       MissedCallListPtr missedCallList(new MissedCallList());
-       int ret = CONTACTS_ERROR_NONE;
-
-       contacts_query_h query = NULL;
-       contacts_filter_h filter = NULL;
-       contacts_list_h recordList = NULL;
-
-       contacts_query_create(_contacts_phone_log._uri, &query);
-       contacts_filter_create(_contacts_phone_log._uri, &filter);
-       contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_EQUAL, CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN);
-       contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
-       contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN);
-
-       contacts_query_set_filter(query, filter);
-       contacts_query_set_sort(query, _contacts_phone_log.log_time, false);
-       ret = contacts_db_get_records_with_query(query, 0, 0, &recordList);
-
-       if (ret != CONTACTS_ERROR_NONE) {
-               LogDebug("callhistory query error [" << ret << "]");
-       }
-
-       if (parseRecord(&recordList, callHistoryListPtr)) {
-               LogDebug("result counter [" << callHistoryListPtr->size() << "]");
-               CallHistoryEntryList::iterator it = callHistoryListPtr->begin();
-
-               for (;it != callHistoryListPtr->end(); ++it) {
-                       missedCallList->push_back((*it)->getEntryId());
-               }
-               LogDebug("missed Call size (" << missedCallList->size() << ")");
-       }
-
-       contacts_list_destroy(recordList, true);
-       contacts_query_destroy(query);
-       contacts_filter_destroy(filter);
-
-       return missedCallList;
-}
-
 void CallHistory::OnRequestReceived(const EventCallHistoryPtr& event)
 {
        try {
@@ -747,135 +671,116 @@ void CallHistory::Watcher::stateHasChanged(CallHistoryEntryListPtr &entryList, E
        if (entryList == NULL)
                return;
 
+       LogDebug("enter");
+
        EventCallHistoryListenerPtr event(new EventCallHistoryListener());
        event->setResultState(state);
        event->setResult(entryList);
        m_emitter->emit(event);
 }
 
-bool CallHistory::Watcher::parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &entryList)
+void CallHistory::Watcher::stateHasRemoved(StringArrayPtr &entryList, EventCallHistoryListener::ResultStates state)
 {
-       CallHistory* callHistory = (CallHistory *) this;
-       if (callHistory != NULL) {
-               return callHistory->parseRecord(recordList, entryList);
-       }
-       return false;
-}
+       if (entryList == NULL)
+               return;
 
-bool CallHistory::Watcher::addMissedCall(CallHistoryEntryListPtr &entryList)
-{
-       if (entryList != NULL) {
-               CallHistoryEntryList::iterator it = entryList->begin();
-               for (; it != entryList->end(); it++) {
-                       if ((*it)->getDirection().compare(STR_MISSED_NEW) == 0) {
-                               m_missedCallList->push_back((*it)->getEntryId());
-                       }
-               }
-               return true;
-       }
-       return false;
+       LogDebug("enter");
+
+       EventCallHistoryListenerPtr event(new EventCallHistoryListener());
+       event->setResultState(state);
+       event->setRemoveResult(entryList);
+       m_emitter->emit(event);
 }
 
-bool CallHistory::Watcher::updateCurrentMissedCall()
+
+bool CallHistory::Watcher::parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &entryList)
 {
        CallHistory* callHistory = (CallHistory *) this;
        if (callHistory != NULL) {
-               setMissedCallList(callHistory->updateCurrentMissedCall());
-               return true;
+               return callHistory->parseRecord(recordList, entryList);
        }
        return false;
 }
 
-void CallHistory::Watcher::addedListenerCB()
+bool CallHistory::Watcher::parseRemoveRecord(char* record, StringArrayPtr &removeRecords)
 {
-       CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList());
-       int ret = CONTACTS_ERROR_NONE;
-
-       contacts_query_h query = NULL;
-       contacts_filter_h filter = NULL;
-       contacts_list_h recordList = NULL;
+       std::string recordStr(record);
+       removeRecords->push_back(recordStr);
 
-       contacts_query_create(_contacts_phone_log._uri, &query);
-       contacts_filter_create(_contacts_phone_log._uri, &filter);
-       contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_BLOCKED);
-       contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
-       contacts_filter_add_int(filter, _contacts_phone_log.id, CONTACTS_MATCH_GREATER_THAN,  static_cast<int>(getCurrentLogId()));
+       return true;
+}
 
-       contacts_query_set_filter(query, filter);
-       contacts_query_set_sort(query, _contacts_phone_log.id, false);
-       ret = contacts_db_get_records_with_query(query, 0, 0, &recordList);
+void CallHistory::Watcher::ListenerCB(char* changes)
+{
+       LogDebug("enter");
 
-       if (ret != CONTACTS_ERROR_NONE) {
-               LogDebug("callhistory query error [" << ret << "]");
-       }
+       char seps[] = ",:";
+       char* tokenType = NULL;
+       char* tokenId = NULL;
+       int changeType = 0;
+       int changeId = 0;
 
-       if (parseRecord(&recordList, callHistoryListPtr)) {
-               if (callHistoryListPtr->size() > 0) {
-                       setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
-                       stateHasChanged(callHistoryListPtr, EventCallHistoryListener::ADDED);
-                       addMissedCall(callHistoryListPtr);
-               }
-       }
+       CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList());
+       StringArrayPtr RemoveListPtr(new StringArray());
 
-       contacts_list_destroy(recordList, true);
-       contacts_query_destroy(query);
-       contacts_filter_destroy(filter);
-}
+       tokenType = strtok( changes, seps );
+       while( tokenType != NULL )
+       {
+       tokenId = strtok( NULL, seps );
+               LogDebug("[ %s / %s ]", tokenType , tokenId );
+               changeType = atoi((const char*)tokenType);
+               changeId = atoi((const char*)tokenId);
 
-void CallHistory::Watcher::changedListenerCB()
-{
-       MissedCallListPtr missedCallListPtr(getMissedCallList());
-       CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList());
-       int ret = CONTACTS_ERROR_NONE;
 
-       contacts_query_h query = NULL;
-       contacts_filter_h filter = NULL;
-       contacts_list_h recordList = NULL;
+               contacts_query_h query = NULL;
+               contacts_filter_h filter = NULL;
+               contacts_list_h recordList = NULL;
+               int ret = 0;
 
-       if (missedCallListPtr->size() > 0) {
                contacts_query_create(_contacts_phone_log._uri, &query);
                contacts_filter_create(_contacts_phone_log._uri, &filter);
-               contacts_filter_add_int(filter, _contacts_phone_log.log_type, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, CONTACTS_PLOG_TYPE_VIDEO_BLOCKED);
-               contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND);
-
-               MissedCallList::iterator itM = missedCallListPtr->begin();
-
-               do {
-                       if (itM != missedCallListPtr->begin()) {
-                               contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR);
-                       }
-                       contacts_filter_add_int(filter, _contacts_phone_log.id, CONTACTS_MATCH_EQUAL,  static_cast<int>(*itM));
-                       itM++;
-               } while(itM < missedCallListPtr->end());
+               contacts_filter_add_int(filter, _contacts_phone_log.id, CONTACTS_MATCH_EQUAL, changeId  );
 
                contacts_query_set_filter(query, filter);
                contacts_query_set_sort(query, _contacts_phone_log.id, false);
-               ret = contacts_db_get_records_with_query(query, 0, 0, &recordList);
+               ret = contacts_db_get_records_with_query(query, 0, 1, &recordList);
 
                if (ret != CONTACTS_ERROR_NONE) {
                        LogDebug("callhistory query error [" << ret << "]");
+                       return;
                }
 
-               if (parseRecord(&recordList, callHistoryListPtr)) {
-                       CallHistoryEntryList::iterator itC = callHistoryListPtr->begin();
-
-                       for (;itC != callHistoryListPtr->end();) {
-                               if ((*itC)->getDirection().compare(STR_MISSED) != 0) {
-                                       itC = callHistoryListPtr->erase(itC);
-                                       continue;
+               if((changeType == CONTACTS_CHANGE_INSERTED)||(changeType == CONTACTS_CHANGE_UPDATED)){
+                       if (parseRecord(&recordList, callHistoryListPtr)) {
+                               if (callHistoryListPtr->size() > 0) {
+                                       setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
                                }
-                               ++itC;
-                       }
-
-                       if (callHistoryListPtr->size() > 0) {
-                               updateCurrentMissedCall();
-                               stateHasChanged(callHistoryListPtr, EventCallHistoryListener::CHANGED);
                        }
+               }else if(changeType == CONTACTS_CHANGE_DELETED){
+                       parseRemoveRecord(tokenId, RemoveListPtr);
                }
 
                contacts_list_destroy(recordList, true);
                contacts_query_destroy(query);
                contacts_filter_destroy(filter);
+
+               tokenType = strtok( NULL, seps );
+       }
+
+       
+       if((changeType == CONTACTS_CHANGE_INSERTED)||(changeType == CONTACTS_CHANGE_UPDATED)){
+               if (callHistoryListPtr->size() > 0) {
+                       setCurrentLogId((*callHistoryListPtr)[0]->getEntryId());
+
+                       if(changeType == CONTACTS_CHANGE_INSERTED){
+                               stateHasChanged(callHistoryListPtr, EventCallHistoryListener::ADDED);
+                       }else if(changeType == CONTACTS_CHANGE_UPDATED){
+                               stateHasChanged(callHistoryListPtr, EventCallHistoryListener::CHANGED);
+                       }
+                               
+               }
+       }else if(changeType == CONTACTS_CHANGE_DELETED){
+               stateHasRemoved(RemoveListPtr, EventCallHistoryListener::REMOVED);
        }
 
 }
index ed81e4d..ef34e74 100755 (executable)
@@ -60,10 +60,9 @@ public:
        CallHistory();
        ~CallHistory();
 
-       static void callhistoryListenerCB(const char* view_uri, void* user_data);
+       static void  callhistoryListenerCB(const char* view_uri, char *changes, void* user_data);
        static void removeBatchCB(int error, void *user_data);
        static void removeAllCB(int error, void *user_data);
-
        void find(const EventFindCallHistoryPtr& event);
        bool remove(const unsigned long entryId);
        void removeBatch(const EventRemoveBatchPtr& event);
@@ -85,21 +84,17 @@ public:
 
                void setHandle(long handle)
                {
-                       LogDebug("setHandle : handle ["<<handle<<"]");
                        m_handle = handle;
                }
 
                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()
@@ -107,16 +102,6 @@ public:
                        return m_currentLogId;
                }
 
-               void setMissedCallList(const MissedCallListPtr &missedCallList)
-               {
-                       m_missedCallList = missedCallList;
-               }
-
-               MissedCallListPtr getMissedCallList()
-               {
-                       return m_missedCallList;
-               }
-
                EventCallHistoryListenerEmitterPtr getEmitter()
                {
                        return m_emitter;
@@ -128,11 +113,12 @@ public:
                }
 
                void stateHasChanged(CallHistoryEntryListPtr &entryList, EventCallHistoryListener::ResultStates state);
+               void stateHasRemoved(StringArrayPtr &entryList, EventCallHistoryListener::ResultStates state);
+
                bool parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &entryList);
-               bool addMissedCall(CallHistoryEntryListPtr &entryList);
-               bool updateCurrentMissedCall();
-               void addedListenerCB();
-               void changedListenerCB();
+               bool parseRemoveRecord(char* record, StringArrayPtr &removeRecords);
+
+               void ListenerCB(char* changes);
        };
        typedef DPL::SharedPtr<Watcher> WatcherPtr;
 
@@ -140,7 +126,6 @@ private:
        bool convertCallHistory(callhistory_query_s *query_log, CallHistoryEntryListPtr &callEntries);
        bool parseRecord(contacts_list_h *recordList, CallHistoryEntryListPtr &callEntries);
        unsigned int  convertAttrName(std::string &name);
-       MissedCallListPtr updateCurrentMissedCall();
 
        std::vector<EventRemoveBatchDataPtr> m_removeBatchEvent;
        std::vector<EventRemoveAllDataPtr> m_removeAllEvent;
index d5ad8f3..7cd7935 100755 (executable)
@@ -22,8 +22,8 @@ namespace DeviceAPI {
 namespace CallHistory {
 
 EventCallHistoryListenerPrivateData::EventCallHistoryListenerPrivateData(
-                       const JSCallbackManagerPtr& onAdded, const JSCallbackManagerPtr& onChanged) :
-                       m_onAdded(onAdded), m_onChanged(onChanged)
+                       const JSCallbackManagerPtr& onAdded, const JSCallbackManagerPtr& onChanged, const JSCallbackManagerPtr& onRemoved) :
+                       m_onAdded(onAdded), m_onChanged(onChanged), m_onRemoved(onRemoved)
 {
 }
 
@@ -37,6 +37,12 @@ JSCallbackManagerPtr EventCallHistoryListenerPrivateData::getOnChanged() const
        return m_onChanged;
 }
 
+JSCallbackManagerPtr EventCallHistoryListenerPrivateData::getOnRemoved() const
+{
+       return m_onRemoved;
+}
+
+
 }
 }
 
index a4a3780..fdeebc3 100755 (executable)
@@ -32,10 +32,12 @@ struct CallHistoryChangeCB
 {
        JSValueRef onAdded;
        JSValueRef onChanged;
+       JSValueRef onRemoved;
 
        CallHistoryChangeCB() :
                onAdded(NULL),
-               onChanged(NULL)
+               onChanged(NULL),
+               onRemoved(NULL)
        { }
 };
 
@@ -43,14 +45,16 @@ class EventCallHistoryListenerPrivateData : public WrtDeviceApis::Commons::IEven
 {
 public:
        EventCallHistoryListenerPrivateData(const JSCallbackManagerPtr& onAdded,
-                       const JSCallbackManagerPtr& onChanged);
+                       const JSCallbackManagerPtr& onChanged, const JSCallbackManagerPtr& onRemoved);
 
        JSCallbackManagerPtr getOnAdded() const;
        JSCallbackManagerPtr getOnChanged() const;
+       JSCallbackManagerPtr getOnRemoved() const;
 
 private:
        JSCallbackManagerPtr m_onAdded;
        JSCallbackManagerPtr m_onChanged;
+       JSCallbackManagerPtr m_onRemoved;
 };
 
 typedef DPL::SharedPtr<EventCallHistoryListenerPrivateData> EventCallHistoryListenerPrivateDataPtr;
index bb31144..d95250c 100755 (executable)
@@ -59,16 +59,26 @@ void CallHistoryStaticController::onAnswerReceived(const EventCallHistoryListene
        JSContextRef context = defaultCbm->getContext();
        Converter converter(context);
 
-       try {
-               JSValueRef result = converter.toJSValueRef(event->getResult(), context);
-               
+       try {           
                switch (event->getResultState()) {
                case EventCallHistoryListener::ADDED :
-                       multiCallbacks->getOnAdded()->callOnSuccess(result);
-                       break;
+                       {
+                               JSValueRef result = converter.toJSValueRef(event->getResult(), context);
+                               multiCallbacks->getOnAdded()->callOnSuccess(result);
+                               break;
+                       }
                case EventCallHistoryListener::CHANGED :
-                       multiCallbacks->getOnChanged()->callOnSuccess(result);
-                       break;                  
+                       {
+                               JSValueRef result = converter.toJSValueRef(event->getResult(), context);
+                               multiCallbacks->getOnChanged()->callOnSuccess(result);
+                               break;                  
+                       }
+               case EventCallHistoryListener::REMOVED :
+                       {
+                               JSValueRef result = converter.toJSValueRef(event->getRemoveResult(), context);
+                               multiCallbacks->getOnRemoved()->callOnSuccess(result);
+                               break;
+                       }
                }
        } catch(ConversionException) {
                LogError("Conversion exception while processing EventCallHistoryListener");
index 433ccef..447b4fc 100755 (executable)
@@ -143,6 +143,9 @@ CallHistoryEntryPropertiesPtr Converter::toCallHistoryEntryProperties(const JSVa
 EventCallHistoryListenerPrivateDataPtr 
        Converter::toEventCallHistoryListenerPrivateData(const JSValueRef &jsValue, JSContextRef context)
 {
+
+       LogDebug("enter");
+
        if (JSValueIsNull(m_context, jsValue) || JSValueIsUndefined(m_context, jsValue)) {
                ThrowMsg(Commons::ConversionException, "Type missmatch error : Listener callback is null or undefined");
        }
@@ -155,9 +158,11 @@ EventCallHistoryListenerPrivateDataPtr
 
        result.onAdded = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, "onadded");
        result.onChanged = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, "onchanged");
+       result.onRemoved = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, "onremoved");
 
        JSCallbackManagerPtr onAddedCbm = JSCallbackManager::createObject(context);
        JSCallbackManagerPtr onChangedCbm = JSCallbackManager::createObject(context);
+       JSCallbackManagerPtr onRemovedCbm = JSCallbackManager::createObject(context);
 
        if (!JSValueIsNull(m_context, result.onAdded) && !JSValueIsUndefined(m_context, result.onAdded)) {
                if (JSObjectIsFunction(m_context, toJSObjectRef(result.onAdded))) {
@@ -175,7 +180,18 @@ EventCallHistoryListenerPrivateDataPtr
                }
        }
 
-       return EventCallHistoryListenerPrivateDataPtr(new EventCallHistoryListenerPrivateData(onAddedCbm, onChangedCbm));
+       if (!JSValueIsNull(m_context, result.onRemoved) && !JSValueIsUndefined(m_context, result.onRemoved)) {
+               if (JSObjectIsFunction(m_context, toJSObjectRef(result.onRemoved))) {
+                       onRemovedCbm->setOnSuccess(result.onRemoved);
+                       LogDebug("onRemoved register");
+               } else {
+                       
+                       ThrowMsg(Commons::ConversionException, "Type missmatch error : onremoved callback");
+               }
+       }
+
+
+       return EventCallHistoryListenerPrivateDataPtr(new EventCallHistoryListenerPrivateData(onAddedCbm, onChangedCbm, onRemovedCbm));
 }
 
 JSValueRef Converter::toJSValueRef(const CallHistoryEntryListPtr& arg, JSContextRef context)
index 22ec3f0..92613a6 100755 (executable)
@@ -34,6 +34,11 @@ void EventCallHistoryListener::setResult (const CallHistoryEntryListPtr &entryLi
        m_entryList = entryList;
 }
 
+void EventCallHistoryListener::setRemoveResult (const StringArrayPtr &entryList) 
+{
+       m_removeList = entryList;
+}
+
 EventCallHistoryListener::ResultStates EventCallHistoryListener::getResultState() const
 {
        return m_resultState;
@@ -44,5 +49,10 @@ CallHistoryEntryListPtr EventCallHistoryListener::getResult() const
        return m_entryList;
 }
 
+StringArrayPtr EventCallHistoryListener::getRemoveResult() const 
+{
+       return m_removeList;
+}
+
 }
 }
index f62f2cb..59fdb34 100755 (executable)
@@ -33,18 +33,23 @@ class EventCallHistoryListener : public WrtDeviceApis::Commons::ListenerEvent<Ev
 public:
        typedef enum {
                ADDED,
-               CHANGED
+               CHANGED,
+               REMOVED
        } ResultStates;
 
 private:
        ResultStates m_resultState;
        CallHistoryEntryListPtr m_entryList;
+       StringArrayPtr m_removeList;
 
 public:
        void setResultState(const ResultStates state);
        void setResult(const CallHistoryEntryListPtr &entryList);
+       void setRemoveResult (const StringArrayPtr &entryList); 
        ResultStates getResultState() const;
        CallHistoryEntryListPtr getResult() const;
+       StringArrayPtr getRemoveResult() const;
+
 
        EventCallHistoryListener();
 };
@@ -56,4 +61,4 @@ typedef DPL::SharedPtr<EventCallHistoryListenerEmitter> EventCallHistoryListener
 }
 }
 
-#endif
\ No newline at end of file
+#endif
index 15e5dcf..5d4308d 100755 (executable)
@@ -41,7 +41,7 @@ ArgumentValidator::ArgumentValidator(JSContextRef ctx, int argc, const JSValueRe
 ArgumentValidator::~ArgumentValidator(){
 }
 
-JSValueRef ArgumentValidator::getArgument(int index, bool nullable){
+JSValueRef ArgumentValidator::getArgument(int index, bool nullable) const{
     if( index < mArgc ){
         return mArgv[index];
     }
@@ -54,7 +54,7 @@ JSValueRef ArgumentValidator::getArgument(int index, bool nullable){
     return value;
 }
 
-double ArgumentValidator::toNumber(int index, bool nullable, double defaultvalue){
+double ArgumentValidator::toNumber(int index, bool nullable, double defaultvalue) const{
     JSValueRef value = getArgument(index, nullable);
     JSValueRef exception = NULL;
     if( JSValueIsNull(mContext, value) && nullable){
@@ -67,24 +67,24 @@ double ArgumentValidator::toNumber(int index, bool nullable, double defaultvalue
     return numberValue;
 }
 
-long ArgumentValidator::toLong(int index, bool nullable, long defaultvalue){
+long ArgumentValidator::toLong(int index, bool nullable, long defaultvalue) const{
     return static_cast<long>(toLongLong(index,nullable,defaultvalue));
 }
 
-unsigned long ArgumentValidator::toULong(int index, bool nullable, long defaultvalue){
+unsigned long ArgumentValidator::toULong(int index, bool nullable, long defaultvalue) const{
     return static_cast<unsigned long>(toULongLong(index,nullable,defaultvalue));
 }
 
-long long ArgumentValidator::toLongLong(int index, bool nullable, long long defaultvalue){
+long long ArgumentValidator::toLongLong(int index, bool nullable, long long defaultvalue) const{
     return static_cast<long long>(toNumber(index,nullable,defaultvalue));
 }
 
-unsigned long long ArgumentValidator::toULongLong(int index, bool nullable, long long defaultvalue){
+unsigned long long ArgumentValidator::toULongLong(int index, bool nullable, long long defaultvalue) const{
     return static_cast<unsigned long long>(toNumber(index,nullable,defaultvalue));
 }
 
 
-double ArgumentValidator::toDouble(int index, bool nullable, double defaultvalue){
+double ArgumentValidator::toDouble(int index, bool nullable, double defaultvalue) const{
     double doublevalue = toNumber(index,nullable,defaultvalue);
     if( isnan(doublevalue)){
         throw TypeMismatchException("Value is not number");
@@ -92,7 +92,7 @@ double ArgumentValidator::toDouble(int index, bool nullable, double defaultvalue
     return doublevalue;
 }
 
-std::string ArgumentValidator::toString(int index, bool nullable, const  string & defaultvalue){
+std::string ArgumentValidator::toString(int index, bool nullable, const  string & defaultvalue) const{
     JSValueRef value = getArgument(index, nullable);
     if( JSValueIsNull(mContext, value) && nullable){
         return defaultvalue;
@@ -115,7 +115,7 @@ std::string ArgumentValidator::toString(int index, bool nullable, const  string
     return result;
 }
 
-bool ArgumentValidator::toBool(int index, bool nullable, bool defaultvalue){
+bool ArgumentValidator::toBool(int index, bool nullable, bool defaultvalue) const{
     JSValueRef value = getArgument(index, nullable);
     if( JSValueIsNull(mContext, value) && nullable){
         return defaultvalue;
@@ -124,7 +124,7 @@ bool ArgumentValidator::toBool(int index, bool nullable, bool defaultvalue){
     return boolvalue;
 }
 
-time_t ArgumentValidator::toTimeT(int index, bool nullable, time_t defaultvalue){
+time_t ArgumentValidator::toTimeT(int index, bool nullable, time_t defaultvalue) const{
     JSValueRef value = getArgument(index, nullable);
     if( JSValueIsNull(mContext, value) && nullable){
         return defaultvalue;
@@ -132,7 +132,7 @@ time_t ArgumentValidator::toTimeT(int index, bool nullable, time_t defaultvalue)
     return JSUtil::JSValueToTimeT(mContext, value);
 }
 
-JSObjectRef ArgumentValidator::toObject(int index, bool nullable){
+JSObjectRef ArgumentValidator::toObject(int index, bool nullable) const{
     JSValueRef value = getArgument(index, nullable);
     if( JSValueIsNull(mContext, value) && nullable){
         return NULL;
@@ -149,7 +149,7 @@ JSObjectRef ArgumentValidator::toObject(int index, bool nullable){
     return object;
 }
 
-JSObjectRef ArgumentValidator::toObject(int index, JSClassRef info, bool nullable){
+JSObjectRef ArgumentValidator::toObject(int index, JSClassRef info, bool nullable) const{
     JSObjectRef obj = toObject(index, nullable);
     if( obj == NULL )
         return NULL;
@@ -159,11 +159,11 @@ JSObjectRef ArgumentValidator::toObject(int index, JSClassRef info, bool nullabl
     return obj;
 }
 
-JSValueRef ArgumentValidator::toJSValueRef(int index, bool nullable){
+JSValueRef ArgumentValidator::toJSValueRef(int index, bool nullable) const{
     return getArgument(index, nullable);
 }
 
-JSObjectRef ArgumentValidator::toFunction(int index, bool nullable){
+JSObjectRef ArgumentValidator::toFunction(int index, bool nullable) const{
     JSObjectRef obj = toObject(index, nullable);
     if( obj == NULL && nullable){
         return NULL;
@@ -174,18 +174,16 @@ JSObjectRef ArgumentValidator::toFunction(int index, bool nullable){
     return obj;
 }
 
-JSObjectRef ArgumentValidator::toArrayObject(int index, bool nullable){
+JSObjectRef ArgumentValidator::toArrayObject(int index, bool nullable) const{
     JSValueRef value = getArgument(index, nullable);
     if( JSValueIsNull(mContext, value) && nullable){
         return NULL;
     }
 
     if( !JSIsArrayValue(mContext, value)){
-        JSObjectRef jsArray = JSCreateArrayObject(mContext, 0, NULL);
-        if( !JSValueIsNull(mContext,value) && !JSValueIsUndefined(mContext,value) )
-            JSSetArrayElement(mContext, jsArray, 0, value);
-        return jsArray;
+        throw TypeMismatchException("Type is not Array");
     }
+
     JSValueRef exception = NULL;
     JSObjectRef obj = JSValueToObject(mContext, value, &exception);
     if( exception != NULL )
@@ -194,7 +192,7 @@ JSObjectRef ArgumentValidator::toArrayObject(int index, bool nullable){
 }
 
 
-std::vector<std::string> ArgumentValidator::toStringVector(int index, bool nullable){
+std::vector<std::string> ArgumentValidator::toStringVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<std::string>();
@@ -202,7 +200,7 @@ std::vector<std::string> ArgumentValidator::toStringVector(int index, bool nulla
     return JSUtil::JSArrayToStringVector(mContext, value);
 }
 
-std::vector<long> ArgumentValidator::toLongVector(int index, bool nullable){
+std::vector<long> ArgumentValidator::toLongVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<long>();
@@ -211,7 +209,7 @@ std::vector<long> ArgumentValidator::toLongVector(int index, bool nullable){
 }
 
 
-std::vector<double> ArgumentValidator::toDoubleVector(int index, bool nullable){
+std::vector<double> ArgumentValidator::toDoubleVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<double>();
@@ -219,7 +217,7 @@ std::vector<double> ArgumentValidator::toDoubleVector(int index, bool nullable){
     return JSUtil::JSArrayToDoubleVector(mContext, value);
 }
 
-std::vector<time_t> ArgumentValidator::toTimeTVector(int index, bool nullable){
+std::vector<time_t> ArgumentValidator::toTimeTVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<time_t>();
@@ -227,7 +225,7 @@ std::vector<time_t> ArgumentValidator::toTimeTVector(int index, bool nullable){
     return JSUtil::JSArrayToTimeTVector(mContext, value);
 }
 
-std::vector<bool> ArgumentValidator::toBoolVector(int index, bool nullable){
+std::vector<bool> ArgumentValidator::toBoolVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<bool>();
@@ -235,7 +233,7 @@ std::vector<bool> ArgumentValidator::toBoolVector(int index, bool nullable){
     return JSUtil::JSArrayToBoolVector(mContext, value);
 }
 
-std::vector<JSValueRef> ArgumentValidator::toJSValueRefVector(int index, bool nullable){
+std::vector<JSValueRef> ArgumentValidator::toJSValueRefVector(int index, bool nullable) const{
     JSObjectRef value = toArrayObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::vector<JSValueRef>();
@@ -249,7 +247,7 @@ std::vector<JSValueRef> ArgumentValidator::toJSValueRefVector(int index, bool nu
     return result;
 }
 
-std::map<std::string, std::string> ArgumentValidator::toStringMap(int index, bool nullable){
+std::map<std::string, std::string> ArgumentValidator::toStringMap(int index, bool nullable) const{
     JSObjectRef value = toObject(index, nullable);
     if( value == NULL || JSValueIsNull(mContext, value) ){
         return std::map<std::string, std::string>();
index 1ccd497..32fa109 100755 (executable)
@@ -32,32 +32,32 @@ public:
     ArgumentValidator(JSContextRef ctx, int argc, const JSValueRef* argv);
     ~ArgumentValidator();
 
-    double toNumber(int index, bool nullable = false, double defaultvalue = 0);
-    long toLong(int index, bool nullable = false, long defaultvalue = 0);
-    unsigned long toULong(int index, bool nullable = false, long defaultvalue = 0);
-    long long toLongLong(int index, bool nullable = false, long long defaultvalue = 0);
-    unsigned long long toULongLong(int index, bool nullable = false, long long defaultvalue = 0);
-    double toDouble(int index, bool nullable = false, double defaultvalue = 0);
-    std::string toString(int index, bool nullable = false, const std::string& defaultvalue = "");
-    bool toBool(int index, bool nullable = false, bool defaultvalue = false);
-    time_t toTimeT(int index, bool nullable = false, time_t defaultvalue = 0);
-    JSObjectRef toObject(int index, bool nullable = false);
-    JSObjectRef toObject(int index, JSClassRef info, bool nullable = false);
-    JSObjectRef toFunction(int index, bool nullable = false);
-    JSObjectRef toArrayObject(int index, bool nullable = false);
-    JSValueRef toJSValueRef(int index, bool nullable = false);
+    double toNumber(int index, bool nullable = false, double defaultvalue = 0) const;
+    long toLong(int index, bool nullable = false, long defaultvalue = 0) const;
+    unsigned long toULong(int index, bool nullable = false, long defaultvalue = 0) const;
+    long long toLongLong(int index, bool nullable = false, long long defaultvalue = 0) const;
+    unsigned long long toULongLong(int index, bool nullable = false, long long defaultvalue = 0) const;
+    double toDouble(int index, bool nullable = false, double defaultvalue = 0) const;
+    std::string toString(int index, bool nullable = false, const std::string& defaultvalue = "") const;
+    bool toBool(int index, bool nullable = false, bool defaultvalue = false) const;
+    time_t toTimeT(int index, bool nullable = false, time_t defaultvalue = 0) const;
+    JSObjectRef toObject(int index, bool nullable = false) const;
+    JSObjectRef toObject(int index, JSClassRef info, bool nullable = false) const;
+    JSObjectRef toFunction(int index, bool nullable = false) const;
+    JSObjectRef toArrayObject(int index, bool nullable = false) const;
+    JSValueRef toJSValueRef(int index, bool nullable = false) const;
 
-    std::vector<std::string> toStringVector(int index, bool nullable = false);
-    std::vector<long> toLongVector(int index, bool nullable = false);
-    std::vector<double> toDoubleVector(int index, bool nullable = false);
-    std::vector<time_t> toTimeTVector(int index, bool nullable = false);
-    std::vector<bool> toBoolVector(int index, bool nullable = false);
-    std::vector<JSValueRef> toJSValueRefVector(int index, bool nullable= false);
+    std::vector<std::string> toStringVector(int index, bool nullable = false) const;
+    std::vector<long> toLongVector(int index, bool nullable = false) const;
+    std::vector<double> toDoubleVector(int index, bool nullable = false) const;
+    std::vector<time_t> toTimeTVector(int index, bool nullable = false) const;
+    std::vector<bool> toBoolVector(int index, bool nullable = false) const;
+    std::vector<JSValueRef> toJSValueRefVector(int index, bool nullable= false) const;
 
-    std::map<std::string, std::string> toStringMap(int index, bool nullable = false);
+    std::map<std::string, std::string> toStringMap(int index, bool nullable = false) const;
 
 private:
-    JSValueRef getArgument(int index, bool nullable);
+    JSValueRef getArgument(int index, bool nullable) const;
     JSContextRef mContext;
     int mArgc;
     const JSValueRef* mArgv;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index ca21527..5a8e32c 100755 (executable)
@@ -435,8 +435,6 @@ public:
     static JSObjectRef makeDateObject(JSContextRef ctx, const time_t value);
 
 
-protected:
-
     template<class T>
     static std::vector<T> JSArrayToType_(JSContextRef ctx, JSValueRef value, T (*convert)(JSContextRef, JSValueRef)){
         std::vector<T> result;
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index ac545af..5584039 100755 (executable)
@@ -817,7 +817,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e
        Try
        {
                int *ids = new int[contactIds->size()];
-               int *tmpIds = new int[contactIds->size()];
+//             int *tmpIds = new int[contactIds->size()];
                int count = 0;
 
                if(errorCode != CONTACTS_ERROR_NONE)
@@ -855,7 +855,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e
                                }
 
                                ids[count] = contactId;
-                               tmpIds[count] = contactId;
+//                             tmpIds[count] = contactId;
                                count++;
                        }
                        Catch(Exception)
@@ -865,7 +865,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e
 //                             continue;
                        }
                }
-
+/*
                contacts_filter_h filter = NULL;
                contacts_query_h query = NULL;
 
@@ -904,7 +904,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e
 
                if(contactIds->size() != (unsigned int)record_count)
                        ThrowMsg(InvalidArgumentException, "Ids' db count  : " << record_count << " (" << __FUNCTION__ << ")");
-
+*/
                KeySharePtrPair *keyPair = new KeySharePtrPair();
                keyPair->key = m_eventMapAcc;
                keyPair->addressBook = this;
@@ -913,10 +913,12 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e
                {
                        delete [] ids;
                }
+/*
                if(tmpIds != NULL)
                {
                        delete [] tmpIds;
                }
+*/
                if(errorCode != CONTACTS_ERROR_NONE)
                {
                        delete keyPair;
index d5951a8..eabf02f 100755 (executable)
@@ -834,11 +834,7 @@ void ContactObjectA2PConverter::importNumberList()
                        else if(type == CONTACT_PHONE_NUMBER_TYPE_PCS)
                                ctsIntType = ctsIntType | CONTACTS_NUMBER_TYPE_PCS;
                        else
-                       {
-                               // TODO Will be added after type changed to string
-                               // ctsIntType = ctsIntType | CONTACTS_NUMBER_TYPE_CUSTOM;
-                               // ctsStrCustomType = ...;
-                       }
+                               ctsIntType = ctsIntType | CONTACTS_NUMBER_TYPE_VOICE;
                }
 
                child_record = NULL;
@@ -951,12 +947,8 @@ void ContactObjectA2PConverter::importEmailList()
                                ctsIntType = ctsIntType | CONTACTS_EMAIL_TYPE_HOME;
                        else if(type == CONTACT_EMAIL_TYPE_WORK)
                                ctsIntType = ctsIntType | CONTACTS_EMAIL_TYPE_WORK;
-                       //else
-                       //{
-                       //      //TODO Will be added after type changed to string
-                       //      //ctsIntType = ctsIntType | CONTACTS_EMAIL_TYPE_CUSTOM;
-                       //      // ctsStrCustomType = ...;
-                       //}
+                       else
+                               ctsIntType = ctsIntType | CONTACTS_EMAIL_TYPE_HOME;
                }
 
                child_record = NULL;
@@ -1305,12 +1297,8 @@ void ContactObjectA2PConverter::importPostalList()
                                ctsIntType = ctsIntType | CONTACTS_ADDRESS_TYPE_HOME;
                        else if(type == CONTACT_ADDRESS_TYPE_WORK)
                                ctsIntType = ctsIntType | CONTACTS_ADDRESS_TYPE_WORK;
-                       //else
-                       //{
-                       //      // TODO Will be added after type changed to string
-                       //      // ctsIntType = ctsIntType | CTS_POSTAL_TYPE_CUSTOM;
-                       //      // ctsStrCustomType = ...;
-                       //}
+                       else
+                               ctsIntType = ctsIntType | CONTACTS_ADDRESS_TYPE_HOME;
                }
 
                child_record = NULL;
@@ -1482,11 +1470,7 @@ void ContactObjectA2PConverter::importWebAddrList()
                else if(type == WEBSITE_TYPE_BLOG)
                        ctsIntType = CONTACTS_URL_TYPE_WORK;
                else
-               {
-                       // TODO Will be added after type changed to string
-                       // ctsIntType = CONTACTS_URL_TYPE_CUSTOM;
-                       // ctsStrCustomType = ...;
-               }
+                       ctsIntType = CONTACTS_URL_TYPE_HOME;
 
                child_record = NULL;
 
index c49e53c..04c1c6b 100755 (executable)
@@ -486,6 +486,9 @@ void ContactObjectP2AConverter::exportNumberList()
                if(intValue & CONTACTS_NUMBER_TYPE_PCS)
                        phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_PCS);
 
+               if(phoneNumber->getTypes()->size() == 0)
+                       phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_VOICE);
+
                // TODO Will be added after type changed to string
 //             if(intValue & CONTACTS_NUMBER_TYPE_CUSTOM)
 //             {
@@ -551,6 +554,9 @@ void ContactObjectP2AConverter::exportEmailList()
                if(intValue & CONTACTS_EMAIL_TYPE_WORK)
                        email->addType(CONTACT_EMAIL_TYPE_WORK);
 
+               if(email->getTypes()->size() == 0)
+                       email->addType(CONTACT_EMAIL_TYPE_HOME);
+
                // TODO Will be added after type changed to string
 //             if(intValue & CONTACTS_EMAIL_TYPE_CUSTOM)
 //             {
@@ -657,6 +663,15 @@ void ContactObjectP2AConverter::exportEventList()
                                anniversary->setLabel(charValue);
 
                        anniversaries->push_back(anniversary);
+               }else{
+                       ContactAnniversaryPtr anniversary = ContactAnniversaryPtr(new ContactAnniversary());
+
+                       anniversary->setDate(tmDate);
+                       contacts_record_get_str_p(child_record, _contacts_event.label, &charValue);
+                       if(charValue)
+                               anniversary->setLabel(charValue);
+
+                       anniversaries->push_back(anniversary);
                }
        }
 }
@@ -730,6 +745,9 @@ void ContactObjectP2AConverter::exportPostalList()
                if(intValue & CONTACTS_ADDRESS_TYPE_WORK)
                        address->addType(CONTACT_ADDRESS_TYPE_WORK);
 
+               if(address->getTypes()->size() == 0)
+                       address->addType(CONTACT_ADDRESS_TYPE_HOME);
+
                // TODO Will be added after type changed to string
 //             if(intValue & CONTACTS_ADDRESS_TYPE_CUSTOM)
 //             {
@@ -782,9 +800,12 @@ void ContactObjectP2AConverter::exportWebAddrList()
                contacts_record_get_int(child_record, _contacts_url.type, &intValue);
                if(intValue == CONTACTS_URL_TYPE_HOME)
                        url->setType(WEBSITE_TYPE_HOMEPAGE);
-               else if(intValue == CONTACTS_URL_TYPE_WORK)
+               if(intValue == CONTACTS_URL_TYPE_WORK)
                        url->setType(WEBSITE_TYPE_BLOG);
 
+               if(url->getTypeIsSet() == false)
+                       url->setType(WEBSITE_TYPE_HOMEPAGE);
+
                // TODO Will be added after type changed to string
 //             if(intValue & CONTACTS_URL_TYPE_CUSTOM)
 //             {
index e76295f..7f9587c 100644 (file)
@@ -47,7 +47,8 @@ void ContactQueueManager::increaseQueueList()
 
 void ContactQueueManager::decreaseQueueList()
 {
-       count--;
+       if(count > 0)
+               count--;
        LogDebug("count : " << count);
 }
 
index 8967297..abb4387 100755 (executable)
@@ -191,8 +191,12 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult()
 
                        if(length != 0)
                        {
-                       sortContacts(property, ids, m_sortOrder, m_filteredContactIds);
-                       result = getContacts(ids);
+                               if(m_sortOrder == ASCENDING_SORT_ORDER)
+                                       sortContacts(property, ids, true, m_filteredContactIds);
+                               else
+                                       sortContacts(property, ids, false, m_filteredContactIds);
+
+                               result = getContacts(ids);
                        }else{
                                ContactArrayPtr contacts(new ContactArray());
                                result = contacts;
index 5f1b819..b0b8d8f 100755 (executable)
@@ -140,9 +140,11 @@ string ContactUtility::convertUriToPath(const string str)
 {
        string result;
 
-       if(validate("^file:///[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = str.substr(string("file://").size());
-       else if(validate("^/[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
+       std::string schema ("file://");
+       unsigned found = str.find(schema);
+       if(found != std::string::npos)
+               result = str.substr(schema.size());
+       else
                result = str;
 
        return result;
@@ -152,10 +154,12 @@ string ContactUtility::convertPathToUri(const string str)
 {
        string result;
 
-       if(validate("^/[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = "file://" + str;
-       else if(validate("^file:///[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
+       std::string schema ("file://");
+       unsigned found = str.find(schema);
+       if(found != std::string::npos)
                result = str;
+       else
+               result = schema + str;
 
        return result;
 }
index 8f9530b..bb3e0b9 100755 (executable)
@@ -26,12 +26,16 @@ namespace Content {
 
 MediacontentFolder::MediacontentFolder()
 {
+    m_modifiedDate = NULL;
 
 }
 
 MediacontentFolder::~MediacontentFolder()
 {
-
+    if(m_modifiedDate != NULL)
+    {
+        free(m_modifiedDate);
+    }
 }
 
 
@@ -78,7 +82,7 @@ void MediacontentFolder::setFolderStorageType(const string &value)
        m_storageType = value;
 
 }
-tm MediacontentFolder::getFolderModifiedDate() const
+tm* MediacontentFolder::getFolderModifiedDate() const
 {
        return m_modifiedDate;
 }
@@ -89,7 +93,7 @@ MediaIdListPtr MediacontentFolder::getMediaIdList() const
 }
 
 
-void MediacontentFolder::setFolderModifiedDate(const tm &value)
+void MediacontentFolder::setFolderModifiedDate(tm *value)
 {
        m_modifiedDate = value;
 
index 3fd54ec..8e0b07e 100755 (executable)
@@ -47,14 +47,14 @@ class MediacontentFolder
        string  getFolderPath() const;  
        string  getFolderName() const;
        string  getFolderStorageType();
-       tm      getFolderModifiedDate() const;
+       tm*     getFolderModifiedDate() const;
        MediaIdListPtr  getMediaIdList() const; 
 
        void setFolderUUID(const string &value);
        void setFolderPath(const string &value);        
        void setFolderName(const string &value);
        void setFolderStorageType(const string &value);         
-       void setFolderModifiedDate(const tm &value);
+       void setFolderModifiedDate(tm *value);
        void setMediaIdList(const MediaIdListPtr &value);
 
        void insertValue(string attr, string value);
@@ -68,7 +68,7 @@ class MediacontentFolder
        string  m_folderPath;   
        string  m_folderName;
        string  m_storageType;          
-       tm      m_modifiedDate;
+       tm*     m_modifiedDate;
        MediaIdListPtr m_mediaIdArrayPtr;
 
        map<string,string> m_folderValue;
index 27ca5b7..3c4a52a 100755 (executable)
@@ -98,11 +98,11 @@ void MediacontentManager::OnRequestReceived(const IEventGetMediacontentPtr &even
 }
 */
 
-tm MediacontentManager::toDateTm(time_t date)
+tm* MediacontentManager::toDateTm(time_t date)
 {
-       tm tm_date;
+       tm *tm_date = (struct tm *)calloc(1, sizeof(struct tm));
 
-       localtime_r(&date, &tm_date);
+       localtime_r(&date, tm_date);
 
        return tm_date;
 }
@@ -300,7 +300,10 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco
        //newImage->setReleasedDate(toDateTm(sqlite3_column_int(pStmt,7)));
        if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_modified_time (info, &tmpDate) )
        {
-               newMedia->setModifiedDate(toDateTm(tmpDate));
+           if(tmpDate)
+           {
+               newMedia->setModifiedDate(toDateTm(tmpDate));
+           }
        }
 
        if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_favorite (info, &tmpBool) )
@@ -344,8 +347,8 @@ void MediacontentManager::readImageFromMediaInfo( media_info_h info, Mediaconten
                        {       
                                if ( tmpStr )
                                {
-                                       struct tm result;
-                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", &result) == NULL) {
+                                       struct tm *result = (struct tm *)calloc(1, sizeof(struct tm));
+                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
                                                LogError( "Couldn't convert supplied date.");
                                        }
                                
@@ -459,8 +462,8 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten
                        {
                                if ( tmpStr )
                                {       
-                                       struct tm result;
-                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", &result) == NULL) {
+                                       struct tm *result=(struct tm *)calloc(1, sizeof(struct tm));
+                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
                                                LogError( "Couldn't convert supplied date.");
                                        }
                                        newVideo->setReleasedDate(result);
@@ -574,8 +577,8 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten
                        {
                                if ( tmpStr )
                                {       
-                                       struct tm result;
-                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", &result) == NULL) {
+                                       struct tm *result = (struct tm *)calloc(1, sizeof(struct tm));
+                                       if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
                                                LogError( "Couldn't convert supplied date.");
                                        }
                                        newAudio->setReleasedDate(result);
index ad1b854..31d3d80 100755 (executable)
@@ -68,7 +68,7 @@ class MediacontentManager : public IMediacontentManager
        static void convertToPlatformFolder(media_folder_h media_folder, MediacontentFolderPtr& newFolder);
        bool updateMediaToDB(MediacontentMediaPtr mediaPtr);    
        string makeQuerySortMode(SortModeArrayPtr attr, MediaSearchVisitor::QueryType value=MediaSearchVisitor::QUERY_FOLDER);
-       static tm toDateTm(time_t date);
+       static tm* toDateTm(time_t date);
        media_content_orientation_e convertToOrientation(string orientation);
 
        private:
index 73a8c5b..e712ec0 100755 (executable)
@@ -29,6 +29,9 @@ MediacontentMedia::MediacontentMedia()
 {
        m_isChangedFavorite = false;
        m_isChangedDisplayName = false;
+       m_createdDate = NULL;
+       m_releasedDate = NULL;
+       m_modifiedDate = NULL;
 
        m_size = 0;
        m_rating = 0;
@@ -40,7 +43,19 @@ MediacontentMedia::MediacontentMedia()
 
 MediacontentMedia::~MediacontentMedia()
 {
-       m_editableAttrList.clear();
+    m_editableAttrList.clear();
+    if(m_createdDate != NULL)
+    {
+        free(m_createdDate);
+    }
+    if(m_releasedDate != NULL)
+    {
+        free(m_releasedDate);
+    }
+    if(m_modifiedDate != NULL)
+    {
+        free(m_modifiedDate);
+    }
 }
 
 string MediacontentMedia::getMediaUUID() const
@@ -104,12 +119,12 @@ string MediacontentMedia::getThumbnailPath() const
 }
 
 
-tm MediacontentMedia::getCreatedDate() const
+tm* MediacontentMedia::getCreatedDate() const
 {
        return m_createdDate;
 }
 
-tm MediacontentMedia::getReleasedDate() const
+tm* MediacontentMedia::getReleasedDate() const
 {
        return m_releasedDate;
 }
@@ -119,24 +134,24 @@ void MediacontentMedia::setThumbnailPath(const string &value)
        m_thumbnailPath = value;
 
 }
-tm MediacontentMedia::getModifiedDate() const
+tm* MediacontentMedia::getModifiedDate() const
 {
        return m_modifiedDate;
 }
 
-void MediacontentMedia::setCreatedDate(const tm &value)
+void MediacontentMedia::setCreatedDate(tm *value)
 {
        m_createdDate = value;
 
 }
 
-void MediacontentMedia::setReleasedDate(const tm &value)
+void MediacontentMedia::setReleasedDate(tm *value)
 {
        m_releasedDate = value;
 
 }
 
-void MediacontentMedia::setModifiedDate(const tm &value)
+void MediacontentMedia::setModifiedDate(tm *value)
 {
        m_modifiedDate = value;
 
index e164fa8..069d740 100755 (executable)
@@ -59,9 +59,9 @@ class MediacontentMedia
        virtual string getTitle() const;
        virtual string getFilePath() const;
        virtual string getThumbnailPath() const;
-       virtual tm getCreatedDate() const;
-       virtual tm getReleasedDate() const;
-       virtual tm getModifiedDate() const;
+       virtual tm* getCreatedDate() const;
+       virtual tm* getReleasedDate() const;
+       virtual tm* getModifiedDate() const;
        virtual string getDescription() const;  
        virtual bool getFavorite() const;
        virtual unsigned long long getSize() const;
@@ -79,9 +79,9 @@ class MediacontentMedia
        virtual void setTitle(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);  
+       virtual void setCreatedDate(tm *value);
+       virtual void setReleasedDate(tm *value);
+       virtual void setModifiedDate(tm *value);
        virtual void setFavorite( bool value);
        virtual void setDescription(const string &value, bool isChanged=false);
        virtual void setSize(unsigned long long value);
@@ -99,9 +99,9 @@ class MediacontentMedia
        string m_filePath;
        string m_thumbnailPath;
        string m_description;
-       tm m_createdDate;
-       tm m_releasedDate;
-       tm m_modifiedDate;
+       tm *m_createdDate;
+       tm *m_releasedDate;
+       tm *m_modifiedDate;
        unsigned long long m_size;
        int m_rating;
        bool m_favorite;  //unused.
index be08470..bd1552a 100755 (executable)
@@ -34,26 +34,57 @@ ContentUtility::~ContentUtility()
 
 string ContentUtility::convertUriToPath(const string str)
 {
-       string result;
+    string result;
+    std::string schema ("file://");
+    std::string _str = ContentUtility::ltrim(str);
 
-       if(validate("^file:///[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = str.substr(string("file://").size());
-       else if(validate("^/[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = str;
+    std::string _schema = _str.substr(0,schema.size());
 
-       return result;
+    if(_schema == schema)
+    {
+        result = _str.substr(schema.size());
+    }
+    else
+    {
+        result = _str;
+    }
+    return result;
 }
 
 string ContentUtility::convertPathToUri(const string str)
 {
-       string result;
+    string result;
+    std::string schema ("file://");
+    std::string _str = ContentUtility::ltrim(str);
 
-       if(validate("^/[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = "file://" + str;
-       else if(validate("^file:///[\x20-\x7E]+$", str, VALIDATE_MATCH_CASELESS))
-               result = str;
+    std::string _schema = _str.substr(0,schema.size());
 
-       return result;
+    if(_schema == schema)
+    {
+        result = _str;
+    }
+    else
+   {
+        result = schema + _str;
+    }
+    return result;
+}
+
+std::string ContentUtility::ltrim(const std::string s)
+{
+    std::string str = s;
+    std::string::iterator i;
+    for (i = str.begin(); i != str.end(); i++) {
+        if (!isspace(*i)) {
+            break;
+        }
+    }
+    if (i == str.end()) {
+        str.clear();
+    } else {
+        str.erase(str.begin(), i);
+    }
+    return str;
 }
 
 
index c0a8eab..faf0fdd 100755 (executable)
@@ -27,11 +27,14 @@ namespace Content {
 class ContentUtility
 {
 public:
-       ContentUtility();
-       virtual ~ContentUtility();
+    ContentUtility();
+    virtual ~ContentUtility();
 
-       static std::string convertUriToPath(const std::string str);
-       static std::string convertPathToUri(const std::string str);
+    static std::string convertUriToPath(const std::string str);
+    static std::string convertPathToUri(const std::string str);
+
+private:
+    static std::string ltrim(const std::string s);
 
 };
 
index 2e9267b..fcff7bd 100755 (executable)
@@ -323,7 +323,10 @@ JSValueRef JSMedia::getPropertyModifiedDate(
     {
         Converter converter(context);
         MediacontentMediaPtr media = getMediaObject(object);
-        return converter.toJSValueRef(media->getModifiedDate());
+        if(media->getModifiedDate() != NULL)
+        {
+            return converter.toJSValueRef(*(media->getModifiedDate()));
+        }
     }
     Catch(Exception)
     {
@@ -343,7 +346,10 @@ JSValueRef JSMedia::getPropertyReleasedDate(
     {
         Converter converter(context);
         MediacontentMediaPtr media = getMediaObject(object);
-        return converter.toJSValueRef(media->getReleasedDate());
+        if(media->getReleasedDate() != NULL)
+        {
+            return converter.toJSValueRef(*(media->getReleasedDate()));
+        }
     }
     Catch(Exception)
     {
index 653a052..a07de6e 100755 (executable)
@@ -237,7 +237,10 @@ JSValueRef JSFolder::getPropertyModifiedDate(
     {
         Converter converter(context);
         MediacontentFolderPtr folder = getFolderObject(object);
-        return converter.toJSValueRef(folder->getFolderModifiedDate());
+        if(folder->getFolderModifiedDate() != NULL)
+        {
+            return converter.toJSValueRef(*(folder->getFolderModifiedDate()));
+        }
     }
     Catch(Exception)
     {
index 4e4e435..dbb80b5 100755 (executable)
@@ -120,7 +120,7 @@ void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event)
                        moveOneRow();   
                }
 
-               buf = new char[memorizedSize];
+               buf = new char[memorizedSize + 1];
 
                if (buf == NULL)
                {
@@ -144,7 +144,7 @@ void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event)
                                        delete[] buf;
                                }
 
-                               buf = new char[memorizedSize];
+                               buf = new char[memorizedSize + 1];
                        }
 
                        if (buf == NULL)
@@ -152,7 +152,7 @@ void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event)
                                ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Out of memory");
                        }
                        
-                       memset(buf, 0, memorizedSize);
+                       memset(buf, 0, memorizedSize + 1);
 
                        switch (type)
                        {
index 5a2d76e..12cc2ab 100755 (executable)
@@ -83,7 +83,7 @@ SyncInfo::SyncType DataSyncConverter::toSyncType(std::string tizenValue) const
        } else if (!tizenValue.compare(TIZEN_DATA_SYNC_TYPE_ONE_WAY_FROM_SERVER)) {
                return SyncInfo::ONE_WAY_FROM_SERVER_TYPE;
        } else if (!tizenValue.compare(TIZEN_DATA_SYNC_TYPE_REFRESH_FROM_SERVER)) {
-               return SyncInfo::REFRESH_FROM_CLIENT_TYPE;
+               return SyncInfo::REFRESH_FROM_SERVER_TYPE;
        } else {
         ThrowMsg(ConversionException, "Invalid sync type.");
        }
@@ -129,7 +129,7 @@ SyncInfo::SyncInterval DataSyncConverter::toSyncInterval(std::string tizenValue)
        } else if (!tizenValue.compare(TIZEN_DATA_SYNC_INTERVAL_1_WEEK)) {
                return SyncInfo::INTERVAL_1_WEEK;
        } else if (!tizenValue.compare(TIZEN_DATA_SYNC_INTERVAL_1_MONTH)) {
-               return SyncInfo::INTERVAL_1_WEEK;
+               return SyncInfo::INTERVAL_1_MONTH;
        } else {
         ThrowMsg(ConversionException, "Invalid sync interval.");
        }
index 11774eb..804020f 100755 (executable)
@@ -78,11 +78,15 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use
                eventPtr->setProfileId(profileDirName);
                }
 
-               if(0==strcmp(error, "DONE")) {
-                       // Stoped and completed cases not distinguished yet.
+               if(NULL==progress) {
+                       LogWarning("Null status.");
+                       eventPtr->setSessionStatus(OnDataSyncStateChanged::UNDEFINED_STATUS);
+               } else if(0==strcmp(progress, "DONE")) {
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::COMPLETE_STATUS);
-               } else if(0==strcmp(error, "ERROR")) {
-                       // Error cases should be transferred.
+               } else if(0==strcmp(progress, "CANCEL")) {
+                       eventPtr->setSessionStatus(OnDataSyncStateChanged::STOP_STATUS);
+               } else if(0==strcmp(progress, "ERROR")) {
+                       // Error cases should be redefined and transferred based on the error value.
                        eventPtr->setSessionStatus(OnDataSyncStateChanged::FAIL_STATUS);
                } else {
                        LogWarning("Wrong status.");
@@ -128,7 +132,7 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
 
        char *profileDirName = NULL;
        int syncType = 0;
-       char *uri = NULL;
+       int uri;
        char *progressStatus = NULL;
        char *operationType = NULL;
 
@@ -162,9 +166,9 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
 
                eventPtr->setSessionStatus(OnDataSyncStateChanged::PROGRESS_STATUS);
 
-               if(0==strcmp(uri, "Contacts")) {
+               if(SYNC_AGENT_SRC_URI_CONTACT==uri) {
                eventPtr->setServiceType(SyncServiceInfo::CONTACT_SERVICE_TYPE);
-               } else if(0==strcmp(uri, "Organizer")) {
+               } else if(SYNC_AGENT_SRC_URI_CALENDAR==uri) {
                eventPtr->setServiceType(SyncServiceInfo::EVENT_SERVICE_TYPE);
                } else {
                        LogWarning("Wrong service type.");
@@ -191,9 +195,6 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat
        if(profileDirName) {
                g_free(profileDirName);
        }
-       if(uri) {
-               g_free(uri);
-       }
        if(progressStatus) {
                g_free(progressStatus);
        }
@@ -967,7 +968,7 @@ void DataSyncManager::OnRequestReceived(const IEventStartSyncPtr &event)
 
         if(event->getEmitter()) {
             LogDebug("Attaching the emitter with profileId: "<<event->getProfileId());
-            m_changeEmitters[event->getProfileId()] = event->getEmitter();
+            m_changeEmitters[std::string("Sync") + event->getProfileId()] = event->getEmitter();
         }
 
         event->setResult(true);
index 873a30f..a1b0677 100755 (executable)
@@ -685,6 +685,7 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context,
                        emitter->setListener(&DataSyncResponseDispatcher::getInstance());
                        emitter->setEventPrivateData(DPL::StaticPointerCast<IEventPrivateData>(privData));
 
+                               LogDebug("Set the emitter.");
                                dplEvent->setEmitter(emitter);
                        } else  if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1]) ) {
                                LogDebug("Null or undefined listener.");
index 8542b43..fff964e 100644 (file)
@@ -184,6 +184,11 @@ static gboolean downloadEventCB(void *data) {
                                        throw UnknownException(("Platform error while getting downloaded full path. " + _get_download_error(ret)).c_str());
                                }
 
+                               ret = download_destroy(downloadId);
+                               if (ret != DOWNLOAD_ERROR_NONE) {
+                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                               }
+
                                std::string virtualPath;
                                try {
                                        virtualPath = DeviceAPI::Filesystem::Utils::toVirtualPath(NULL, fullPath);
@@ -219,6 +224,11 @@ static gboolean downloadEventCB(void *data) {
                                        errMessage = _get_download_error(err);
                                }
 
+                               ret = download_destroy(downloadId);
+                               if (ret != DOWNLOAD_ERROR_NONE) {
+                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                               }
+
                                UnknownException error(errMessage.c_str());
                                callback->onfailed(downloadId, error);
                                thisObj->removeCallbackFromMap(downloadId);
@@ -236,6 +246,11 @@ static gboolean downloadEventCB(void *data) {
                                        throw UnknownException(("Platform error while unsetting progress callback. " + _get_download_error(ret)).c_str());
                                }
 
+                               ret = download_destroy(downloadId);
+                               if (ret != DOWNLOAD_ERROR_NONE) {
+                                       LogWarning("Platform error while destroying download handle. downloadId=" << downloadId);
+                               }
+
                                callback->oncanceled(downloadId);
                                thisObj->removeCallbackFromMap(downloadId);
                                break;
index 7cbfd60..3b9e915 100755 (executable)
@@ -120,25 +120,25 @@ JSObjectRef JSDownloadRequest::constructor(JSContextRef context,
        try {
                priv->setDestination(validator.toString(1, true, ""));
        } catch (const BasePlatformException& err) {
-               LogWarning("url destination is failed. %s", err.getMessage().c_str());
+               LogWarning("destination convertion is failed. %s", err.getMessage().c_str());
        }
 
        try {
                priv->setFileName(validator.toString(2, true, ""));
        } catch (const BasePlatformException& err) {
-               LogWarning("url fileName is failed. %s", err.getMessage().c_str());
+               LogWarning("fileName convertion is failed. %s", err.getMessage().c_str());
        }
 
        try {
                priv->setNetworkType(validator.toString(3, true, ""));
        } catch (const BasePlatformException& err) {
-               LogWarning("url networkType is failed. %s", err.getMessage().c_str());
+               LogWarning("networkType convertion is failed. %s", err.getMessage().c_str());
        }
 
        try {
                priv->setHttpHeader(validator.toStringMap(4, true));
        } catch (const BasePlatformException& err) {
-               LogWarning("url networkType is failed. %s", err.getMessage().c_str());
+               LogWarning("httpHeader convertion is failed. %s", err.getMessage().c_str());
        }
 
        setPrivateObject(context, obj, priv);
index d12674b..eae82dc 100755 (executable)
@@ -81,6 +81,15 @@ IPathPtr fromVirtualPath(JSContextRef context,
 {
        LogDebug("arg:[" << arg << "]");
 
+       // uri path, strip file://
+       if (isUriPath(arg)) {
+               std::string stripPath = arg.substr(strlen("file://"));
+               LogDebug("uri absolute path" << stripPath);
+               IPathPtr result = IPath::create(stripPath);
+               
+               return result;
+       }
+       
        if (!isPathValid(arg)) {
                LogDebug("virtual path is invalid:[" << arg << "]");
                ThrowMsg(Commons::ConversionException, "Not found path component.");
@@ -104,9 +113,13 @@ IPathPtr fromVirtualPath(JSContextRef context,
        rootToPath["wgt-private"] = widgetDB->getWidgetPersistentStoragePath();
        rootToPath["wgt-private-tmp"] = widgetDB->getWidgetTemporaryStoragePath();
        RootToPathMapIterator it = rootToPath.find(root);
+
        if (it == rootToPath.end()) {
-               ThrowMsg(Commons::NotFoundException, "Location not found.");
+               //ThrowMsg(Commons::NotFoundException, "Location not found.");
+               LogDebug("Allow non virtual root path " << arg);
+               return IPath::create(arg);
        }
+       
        IPathPtr result = IPath::create(it->second);
 
        if (!tail.empty()) {
@@ -128,6 +141,7 @@ std::string toVirtualPath(JSContextRef context, const std::string& arg) {
        pathToRoot[widgetDB->getWidgetTemporaryStoragePath()] = "wgt-private-tmp";
 
        std::string path = arg;
+       
        std::string::size_type pos = path.size();
        while (std::string::npos != (pos = path.rfind(IPath::getSeparator(), pos))) {
                PathToRootMapIterator it = pathToRoot.find(path);
@@ -136,7 +150,21 @@ std::string toVirtualPath(JSContextRef context, const std::string& arg) {
                }
                path.erase(pos, path.size());
        }
-       ThrowMsg(Commons::ConversionException, "Path doesn't contain a valid location type.");
+       LogDebug("Allow non virtual root path");
+       
+       return arg;
+//     ThrowMsg(Commons::ConversionException, "Path doesn't contain a valid location type.");
+}
+
+bool isUriPath(const std::string& path) {
+               const char* uriPrefix = "file://";
+               const char* stringFromPath = path.c_str();
+
+               if (!strncmp(uriPrefix, stringFromPath, strlen(uriPrefix)) && path[strlen(uriPrefix)] == '/') {
+                       return true;
+               }
+               
+               return false;
 }
 
 bool isPathValid(const std::string& path) {
index eb50329..1e50a16 100755 (executable)
@@ -32,6 +32,8 @@ IPathPtr fromVirtualPath(JSContextRef context,
 std::string toVirtualPath(JSContextRef context, const std::string& arg);
 
 bool isPathValid(const std::string& path);
+bool isUriPath(const std::string& path);
+
 void toUTF8String(std::string fromEncoding, const char* from, const size_t fromLength, std::string &outputString);
 }
 }
index 2911152..122e3f6 100755 (executable)
@@ -1009,7 +1009,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                bool recursive = converter.toBool(reserveArguments[1]);
 
                if (*privateObject->getObject()->getNode()->getPath() != path->getPath()) {
-                       cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, "IO error"));
+                       cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_FOUND_ERROR, "not found error"));
                        return JSValueMakeUndefined(context);
                }
 
@@ -1018,8 +1018,11 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                if (eventResolve->setForSynchronousCall()) { 
                        IManager::getInstance().getNode(eventResolve);
                        if (!eventResolve->getResult() || (eventResolve->getExceptionCode() != WrtDeviceApis::Commons::ExceptionCodes::None)) {
-                               cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, "IO error"));
-                               return JSValueMakeUndefined(context);
+
+                               if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) 
+                                       ThrowMsg(NotFoundException, "Not found error");
+                               else 
+                                       ThrowMsg(PlatformException, "IO Error");
                        }
 
                        if (eventResolve->getResult()->getType() != NT_DIRECTORY) {
@@ -1048,7 +1051,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
        } catch(const WrtDeviceApis::Commons::InvalidArgumentException& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, ex.GetMessage()));
        } catch(const WrtDeviceApis::Commons::NotFoundException& ex) {
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, ex.GetMessage());
+               cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_FOUND_ERROR, ex.GetMessage()));
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage()));
        }
index 5ed2bb1..f340add 100755 (executable)
@@ -75,7 +75,12 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
                JSObjectRef object = JSUtils::makeObject(data->getCallbackManager()->getContext(), JSFile::getClassRef(), privData);
                data->getCallbackManager()->callOnSuccess(object);
        }  else {
-               JSObjectRef jsException =       JSTizenExceptionFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
+               JSObjectRef jsException;
+               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               } else {
+                       JSTizenExceptionFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSTizenException::UNKNOWN_ERROR, "Unknown error");
+               }
                data->getCallbackManager()->callOnError(jsException);
        }
 }
@@ -125,7 +130,14 @@ void ResponseDispatcher::OnAnswerReceived(const EventOpenPtr& event)
                JSObjectRef object = JSUtils::makeObject(data->getContext(), JSFilestream::getClassRef(), event->getResult());
                data->callOnSuccess(object);
        } else {
-               JSObjectRef jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
+               JSObjectRef jsException;
+
+               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               }
+               else {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
+               }
                data->callOnError(jsException);
        }
 }
@@ -150,7 +162,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event)
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::PERMISSION_DENIED_ERROR, "Permission denied error");
-               } else {
+               } 
+               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               }
+               else {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
                }
                data->callOnError(jsException);
@@ -178,7 +194,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event)
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::PERMISSION_DENIED_ERROR, "Permission denied error");
-               } else {
+               } 
+               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               }
+               else {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
                }
                data->callOnError(jsException);
@@ -200,7 +220,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemovePtr& event)
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() ==WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::PERMISSION_DENIED_ERROR, "Permission denied error");
-               } else {
+               } 
+               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               }
+               else {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
                }
                data->callOnError(jsException);
@@ -244,7 +268,11 @@ void ResponseDispatcher::OnAnswerReceived(const EventReadTextPtr& event)
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::PERMISSION_DENIED_ERROR, "Permission denied error");
-               } else {
+               } 
+               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+                       jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::NOT_FOUND_ERROR, "NotFoundError");
+               }
+               else {
                        jsException = JSTizenExceptionFactory::makeErrorObject(data->getContext(), JSTizenException::IO_ERROR, "IO error");
                }
                data->callOnError(jsException);
index 8fe18ed..6178de2 100755 (executable)
@@ -47,7 +47,7 @@ void Connection::open(DBusBusType bus)
 {
     if (m_connected) { return; }
 
-    m_connection = dbus_bus_get(bus, &m_error);
+    m_connection = dbus_bus_get_private(bus, &m_error);
     if (!m_connection || dbus_error_is_set(&m_error)) {
         std::string message = m_error.message;
         dbus_error_free(&m_error);
@@ -65,12 +65,13 @@ void Connection::open(DBusBusType bus)
     if (!dbus_connection_set_watch_functions(m_connection, addWatch,
                                              removeWatch, toggleWatch, this,
                                              NULL)) {
+        LogDebug("Couldn't set-up watch functions.");
         ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't set-up watch functions.");
     }
 
     if (!dbus_connection_add_filter(m_connection, filterMessage, this, NULL)) {
-        ThrowMsg(WrtDeviceApis::Commons::PlatformException,
-                 "Couldn't set signal handler callback.");
+        LogDebug("Couldn't set signal handler callback.");
+        ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't set signal handler callback.");
     }
 
     m_connected = true;
@@ -105,6 +106,7 @@ void Connection::close()
         removeFilterInternal(*it);
     }
 
+    dbus_connection_close(m_connection);
     dbus_connection_unref(m_connection);
 
     m_connected = false;
@@ -219,12 +221,12 @@ DBusHandlerResult Connection::filterMessage(DBusConnection* connection,
             LogError("DBus message not set, this should not happen!");
             return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
         }
-
         FilterSetIterator it = this_->m_filters.begin();
         for (; it != this_->m_filters.end(); ++it) {
             // TODO: extend following matching procedure to check not only
             // interface's name.
-            if ((*it).find(msg->getInterface()) != std::string::npos) {
+            if (!msg->getInterface().empty() && ((*it).find(msg->getInterface()) != std::string::npos))
+                       {
                 MessageEvent event(msg);
                 this_->EmitEvent(event);
             }
index 9ce7f80..98e77b5 100755 (executable)
@@ -103,6 +103,7 @@ public:
        virtual int getOpTypeFromOpId(int opId) = 0;
        virtual IMessagePtr getMessageFromOpId(int opId) = 0;
        virtual EventMessagingServicePtr getEventFromOpId(int opId) = 0;
+       virtual EventMessagingServicePtr getEventFromHandle(int handle) = 0;
        virtual void setHandleToOpId(int opId, int handle) = 0;
        virtual void setMessageToOpId(int opId, IMessagePtr& message) = 0;
        virtual void setEventToOpId(int opId, EventMessagingServicePtr &event) = 0;
old mode 100755 (executable)
new mode 100644 (file)
index 69d88de..ab27a08
@@ -592,6 +592,9 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context,
 
                        event->opId = opId;
                        imessagingService->setMessageToOpId(opId, event->m_message);
+                       imessagingService->setEventToOpId(event->opId, event);
+                       event->m_messagingService = imessagingService;
+                       
                        event->setEventType(MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_BODY);
                        event->setPrivateData(DPL::StaticPointerCast<WrtDeviceApis::Commons::IEventPrivateData>(privateData));
                        event->setForAsynchronousCall(&MessagingController::getInstance());
@@ -742,6 +745,8 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context,
 
                        event->opId = opId;
                        imessagingService->setMessageToOpId(opId, event->m_message);
+                       imessagingService->setEventToOpId(event->opId, event);
+                       event->m_messagingService = imessagingService;
 
                        //JSValueRef pendingOperation = WrtDeviceApis::CommonsJavaScript::makePendingOperation(globalContext, event);   //create pendingOperation.
                        ReqReceiverMessageSingleton::Instance().loadMessageAttachment(event);   //load message Body
index 7f4eb83..54ffbd6 100644 (file)
@@ -84,7 +84,7 @@ void MailSender::cancel(int handle)
 // TODO Copied from former solution, refactor it.
 void MailSender::OnEventReceived(const DBus::MessageEvent& event)
 {
-    LogDebug("HERE");
+    LogDebug("enter");
     NetworkStatusPtr msg(new NetworkStatus(event.GetArg0()));
     int mailId = msg->getMailId();
     LogDebug("status : " << msg->getStatus() << " mailId : " << mailId);
@@ -219,6 +219,7 @@ MailSender::MailSender() :
     m_dbusThread(new DPL::Thread()),
     m_dbus(new DBus::Connection())
 {
+    LogDebug("enter");
     m_dbusThread->Run();
 
     m_dbus->setWorkerThread(m_dbusThread.Get());
index 7ad82b4..248b40d 100644 (file)
@@ -245,8 +245,8 @@ int MailSync::syncAccount(const IMessagingServicePtr& messagingService, const in
                        const IMessagingServicePtr& messagingService = it->second.messagingService;
                        if (messagingService && messagingService->getAccountID() == accountId)
                        {
-                               ThrowMsg(WrtDeviceApis::Commons::PlatformException,
-                         "Sync: " << accountId << " already requested to be Sync Account.");
+                               LogDebug("accountId is sync requested already");
+//                             ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Sync: " << accountId << " already requested to be Sync Account.");
                        }
                }
                return syncAccountInternal(messagingService, limit);
@@ -294,7 +294,7 @@ int MailSync::syncAccountInternal( const IMessagingServicePtr& messagingService,
        else
        {
                LogDebug("Insert sync request");
-               SyncRequestData data = SyncRequestData(email_handle,    MESSAGING_SERVICE_SYNC_TYPE_SYNC, messagingService);
+               SyncRequestData data = SyncRequestData(email_handle, MESSAGING_SERVICE_SYNC_TYPE_SYNC, messagingService);
                m_SyncRequests.insert(std::make_pair(email_handle, data));
        }
 
@@ -344,8 +344,8 @@ int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int
                        if (messagingService && messagingService->getAccountID() == accountId 
                                && it->second.folderId == folder_id)
                        {
-                               ThrowMsg(WrtDeviceApis::Commons::PlatformException,
-                                         "Sync: " << accountId << " already requested to be Sync Account.");
+                               LogDebug("accountId is syncFolder requested already");
+//                             ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Sync: " << accountId << " already requested to be Sync Account.");
                        }
                }
                
@@ -469,6 +469,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
                                if ( mail && requestReceiver )
                                {
                                        EventMessagingServicePtr event = mail->getMessagingServiceEvent();
+//                                     EventMessagingServicePtr event = messagingService->getEventFromHandle(handle);
 
                                        if (status == NOTI_DOWNLOAD_ATTACH_FINISH)
                                        {
@@ -538,7 +539,8 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
 
                                if ( messagingService && requestReceiver)
                                {
-                                       EventMessagingServicePtr event = messagingService->getMessagingServiceEvent();
+                                       EventMessagingServicePtr event = messagingService->getEventFromHandle(handle);
+                                       // get event using handle from m_opRequests;
                                        if ( status == NOTI_DOWNLOAD_FINISH )
                                        {
                                                LogDebug("Sync Success");
@@ -567,7 +569,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
 
                                if ( messagingService && requestReceiver)
                                {
-                                       EventMessagingServicePtr event = messagingService->getMessagingServiceEvent();
+                                       EventMessagingServicePtr event = messagingService->getEventFromHandle(handle);
                                        if ( status == NOTI_DOWNLOAD_FINISH )
                                        {
                                                LogDebug("Sync Success");
@@ -595,6 +597,8 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event)
                                EventMessagingServiceReqReceiver* requestReceiver = mail->getRequestReceiver();
                                if (mail && requestReceiver) {
                                        EventMessagingServicePtr event = mail->getMessagingServiceEvent();
+//                                     EventMessagingServicePtr event = messagingService->getEventFromHandle(handle);
+                       
                                        if ( status == NOTI_DOWNLOAD_BODY_FINISH )
                                        {
                                                event->m_message->readAllData();
index e9be261..b0f6244 100755 (executable)
@@ -151,7 +151,7 @@ namespace DeviceAPI {
                                                                                                        MessageFilterValidatorFactory::ATTRIBUTE_BODY,            "preview_text"));             //TODO check
                        attributeMap.insert(
                                                                                        std::pair<std::string, std::string>(
-                                                                                                       MessageFilterValidatorFactory::ATTRIBUTE_IS_READ,          "mail_status"));     //TODO 1:seen, 2:deleted, 4:flagged, 8:answered, 20:draft
+                                                                                                       MessageFilterValidatorFactory::ATTRIBUTE_IS_READ,          "flags_seen_field"));        //TODO 1:seen, 2:deleted, 4:flagged, 8:answered, 20:draft
                        attributeMap.insert(
                                                                                        std::pair<std::string, std::string>(
                                                                                                        MessageFilterValidatorFactory::ATTRIBUTE_PRIORITY,         "priority"));
@@ -847,27 +847,32 @@ namespace DeviceAPI {
 
                        m_query.append(getQueryFromVector());
 
-                       if(m_query.compare(getQueryPrefix())==0){
-                               return "";
-                       }else{
-                               if(m_sortMode != NULL){
-                                       std::string platformAttrName = convertToEmfAttrName(m_sortMode->getAttributeName());
-                                       std::string sortModeString;
-                                       if(m_sortMode->getOrder() == ASCENDING_SORT_ORDER){
-                                               sortModeString = "ASC";
-                                       }else{
-                                               sortModeString = "DESC";
-                                       }
+                       LogDebug("m_limit : " << m_limit << " m_offset : " << m_offset);
 
-                                       buffer << " ORDER BY " << platformAttrName << " " << sortModeString;
-                                       if(m_limit != 0){
-                                               buffer << " LIMIT "  << m_offset  << "," << m_limit;
-                                       }
+                       if(m_sortMode != NULL)
+                       {
+                               std::string platformAttrName = convertToEmfAttrName(m_sortMode->getAttributeName());
+                               std::string sortModeString;
+                               if(m_sortMode->getOrder() == ASCENDING_SORT_ORDER){
+                                       sortModeString = "ASC";
+                               }else{
+                                       sortModeString = "DESC";
                                }
+                               buffer << " ORDER BY " << platformAttrName << " " << sortModeString;
+                       }
 
+                       if(m_limit != 0){
+                               buffer << " LIMIT "  << m_offset  << "," << m_limit;
+                       }
+
+                       m_orderLimit.append(buffer.str());
+
+                       if(m_query.compare(getQueryPrefix())==0){
+                               LogDebug("m_query null");
+                               return "";
+                       }else{
                                m_query.append(getQuerySuffix());
-//                             m_query.append(buffer.str());
-                               m_orderLimit.append(buffer.str());
+                               LogDebug("m_query not null");
                                return m_query;
                        }
                }
index 126dff8..ac6e370 100755 (executable)
@@ -634,6 +634,7 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
        vector<IMessagePtr> retVal;
        std::string filterSql;
        std::string orderLimitSql ="";
+       std::string emailFilterSql;
        std::string typeAndString = "AND A.MAIN_TYPE=";
        std::string typeString = "A.MAIN_TYPE=";
 
@@ -658,8 +659,9 @@ vector<IMessagePtr> Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f
        switch(type){
                case EMAIL:
                        LogDebug("message type is EMAIL:[" << messageType <<"]");
-                       LogDebug("filterSql:[" << filterSql <<"]");
-                       retVal = queryEmailMessage(filterSql);
+                       emailFilterSql = filterSql + orderLimitSql;
+                       LogDebug("filterSql:[" << emailFilterSql <<"]");
+                       retVal = queryEmailMessage(emailFilterSql);
                        break;
 
                case SMS:
@@ -1334,6 +1336,19 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event)
                                FolderType folder = msg->getCurrentFolder();
                                jsEvent->setMsg_Event_Type(EventMessageReceived::MSG_ADDED);
 
+                               LogInfo("Added message is in folder: " << folder);
+
+                               jsEvent->setMessage(msg);
+                               jsEvent->setConversation(conversation);
+                               
+                               if(m_onMessageReceived.size() > 0){
+                                       m_onMessageReceived.emit(jsEvent);
+                               }
+                               
+                               if(m_onConversationReceived.size() > 0){
+                               m_onConversationReceived.emit(jsEvent);
+                               }
+/*
                                if (OUTBOX != folder && SENTBOX != folder && DRAFTBOX != folder)
                                {
                                        jsEvent->setMessage(msg);
@@ -1350,6 +1365,7 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event)
                                } else {
                                        LogWarning("New email message in ignored folder: " << folder);
                                }
+*/
                        }
                        else if ((mail_id > 0) && (NOTI_MAIL_DELETE == status))
                        { // TODO also RECEIVE_THREAD_ITEM?
index 56df77b..0d144da 100755 (executable)
@@ -196,6 +196,30 @@ EventMessagingServicePtr MessagingService::getEventFromOpId(int opIdx)
        return event;
 }
 
+EventMessagingServicePtr MessagingService::getEventFromHandle(int handle)
+{
+       LogDebug("handle index : " << handle);
+       EventMessagingServicePtr event;
+       int cnt = m_opRequests.size();  //item count.
+       LogDebug("cnt : " << cnt);
+       if (cnt > 0)
+       {
+               OpRequestsIterator it;
+               for( it = m_opRequests.begin(); it != m_opRequests.end(); ++it)
+               {
+                       LogDebug("it->first : " << it->first);
+                       LogDebug("it->second.handle : " << it->second.handle);
+                       if((unsigned int)handle == it->second.handle)
+                       {
+                               LogDebug("get opId : " << it->first);
+                               LogDebug("event of handle : " << it->second.handle);
+                               event = it->second.event;
+                       }
+               }
+       }
+       return event;
+}
+
 void MessagingService::setHandleToOpId(int opIdx, int handle)
 {
        LogDebug("operation index : " << opIdx);
index 221cf67..b518e60 100755 (executable)
@@ -57,6 +57,7 @@ public:
        int getOpTypeFromOpId(int opId);
        IMessagePtr getMessageFromOpId(int opId);
        EventMessagingServicePtr getEventFromOpId(int opId);
+       EventMessagingServicePtr getEventFromHandle(int handle);
        
        void setHandleToOpId(int opId, int handle);
        void setMessageToOpId(int opId, IMessagePtr& message);
index 3fe7a63..a7bc5ef 100755 (executable)
@@ -30,7 +30,8 @@ namespace Messaging {
 
 SyncNetworkStatus::SyncNetworkStatus(const DBus::MessagePtr& message)
 {
-    Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
+       LogDebug("enter : "  << message->getInterface());
+       Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS);
     initialize(message);
 }
 
index 39a85f8..eca0fd5 100644 (file)
@@ -73,7 +73,7 @@ namespace{
                size_t                                  dataSize;                                                                                                                       /**< Indicates the data size. The unit is byte. */
                void                                    *pData;                                                                                                                         /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
                void                                    *pMmsData;                                                                                                              /**< Indicates the message payload information as a body. default character encoding is UTF-8*/
-               size_t                          mmsDataSize;
+//             size_t                          mmsDataSize;
        } MSG_MESSAGE_HIDDEN_S;
 
 
index 6eea329..61a894a 100755 (executable)
@@ -35,13 +35,6 @@ enum EventNFCStatus {
        NFC_DETATCHED
 };
 
-enum EventNFCSEType {
-       NFC_SE_NONE,
-       NFC_SE_ESE,
-       NFC_SE_UICC,
-       NFC_SE_INVALID
-};
-
 class EventNFCChanged : public WrtDeviceApis::Commons::ListenerEvent<EventNFCChanged>
 {
 private:
@@ -66,33 +59,11 @@ public:
        EventNFCChangedSetPowered(bool state): powerState(state) { }
 };
 
-class EventNFCSetCardEmulation : public EventNFCTemplate<EventNFCSetCardEmulation>
-{
-private:
-       EventNFCSEType seType;
-public:
-       EventNFCSEType getSEType()  {return seType;}
-       EventNFCSetCardEmulation(EventNFCSEType type): seType(type) { }
-};
-
-class EventNFCChangedCardEmulation : public WrtDeviceApis::Commons::ListenerEvent<EventNFCChangedCardEmulation>
-{
-private:
-       EventNFCSEType seType;
-public:
-       EventNFCSEType getSEType()  {return seType;}
-       void setSEType(EventNFCSEType type) {seType = type;}
-       EventNFCChangedCardEmulation():seType(NFC_SE_NONE) { }
-};
 
 typedef DPL::SharedPtr<EventNFCChanged> EventNFCChangedPtr;
 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventNFCChanged> EventNFCChangedEmitter;
 typedef DPL::SharedPtr<EventNFCChangedEmitter> EventNFCChangedEmitterPtr;
 typedef DPL::SharedPtr<EventNFCChangedSetPowered> EventNFCChangedSetPoweredPtr;
-typedef DPL::SharedPtr<EventNFCSetCardEmulation> EventNFCSetCardEmulationPtr;
-typedef DPL::SharedPtr<EventNFCChangedCardEmulation> EventNFCChangedCardEmulationPtr;
-typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventNFCChangedCardEmulation> EventNFCChangedCardEmulationEmitter;
-typedef DPL::SharedPtr<EventNFCChangedCardEmulationEmitter> EventNFCChangedCardEmulationEmitterPtr;
 } // NFC
 } // DeviceAPI
 
index c42717a..a961f18 100755 (executable)
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-//\r
-\r
-\r
-#include "INFCAdapter.h"\r
-\r
-namespace DeviceAPI {\r
-namespace NFC {\r
-\r
-using namespace WrtDeviceApis::Commons;\r
-\r
-INFCAdapter::INFCAdapter() :\r
-       EventNFCSetPoweredRequestReceiver(ThreadEnum::NFC_THREAD),\r
-       EventNFCSetCardEmulationRequestReceiver(ThreadEnum::NFC_THREAD) {\r
-}\r
-\r
-INFCAdapter::~INFCAdapter() {\r
-}\r
-\r
-}\r
-}\r
+//
+
+
+#include "INFCAdapter.h"
+
+namespace DeviceAPI {
+namespace NFC {
+
+using namespace WrtDeviceApis::Commons;
+
+INFCAdapter::INFCAdapter() :
+       EventNFCSetPoweredRequestReceiver(ThreadEnum::NFC_THREAD) {
+}
+
+INFCAdapter::~INFCAdapter() {
+}
+
+}
+}
index 4214ef2..ac223a2 100755 (executable)
@@ -29,11 +29,9 @@ namespace DeviceAPI {
 namespace NFC {
 
 typedef WrtDeviceApis::Commons::EventRequestReceiver<EventNFCChangedSetPowered> EventNFCSetPoweredRequestReceiver;
-typedef WrtDeviceApis::Commons::EventRequestReceiver<EventNFCSetCardEmulation> EventNFCSetCardEmulationRequestReceiver;
 
 class INFCAdapter :
-               public EventNFCSetPoweredRequestReceiver,
-               public EventNFCSetCardEmulationRequestReceiver
+               public EventNFCSetPoweredRequestReceiver
 {
     public:
 
@@ -45,14 +43,9 @@ class INFCAdapter :
        virtual void *getCachedMessage() = 0;
        virtual bool getPowerState() = 0;
        virtual void setPowered(const EventNFCChangedSetPoweredPtr& event) = 0;
-       virtual EventNFCSEType getSEType() = 0;
-       virtual void setCardEmulation(const EventNFCSetCardEmulationPtr& event) = 0;
-       virtual void setCardEmulationChangeListener(const EventNFCChangedCardEmulationEmitterPtr& event) = 0;
-       virtual void unsetCardEmulationChangeListener() = 0;
 protected:
         INFCAdapter();
        virtual void OnRequestReceived(const EventNFCChangedSetPoweredPtr& event) = 0;
-       virtual void OnRequestReceived(const EventNFCSetCardEmulationPtr& event) = 0;
 };
 
 typedef DPL::SharedPtr<INFCAdapter> INFCAdapterPtr;
old mode 100644 (file)
new mode 100755 (executable)
index 1867589..8df196c
@@ -49,7 +49,7 @@ using namespace WrtDeviceApis::CommonsJavaScript;
 
 #define TIZEN_NFCADAPTER_ATTRIBUTENAME "NFCAdapter"
 #define TIZEN_NFCADAPTER_POWERED "powered"
-#define TIZEN_NFCADAPTER_SETYPE "seType"
+
 namespace DeviceAPI {
 namespace NFC {
 
@@ -78,7 +78,6 @@ JSStaticValue JSNFCAdapter::m_property[] =
 {
     //NFCAdapterProperties
        {TIZEN_NFCADAPTER_POWERED,  getProperty, NULL, kJSPropertyAttributeReadOnly},
-       {TIZEN_NFCADAPTER_SETYPE,  getProperty, NULL, kJSPropertyAttributeReadOnly},
        { 0, 0, 0, 0 }
 };
 
@@ -89,9 +88,6 @@ JSStaticFunction JSNFCAdapter::m_function[] = {
        {"unsetPeerListener",       JSNFCAdapter::unsetPeerListener, kJSPropertyAttributeNone},
        {"getCachedMessage", JSNFCAdapter::getCachedMessage, kJSPropertyAttributeNone},
        {"setPowered",      JSNFCAdapter::setPowered, kJSPropertyAttributeNone },
-       {"setCardEmulation",      JSNFCAdapter::setCardEmulation, kJSPropertyAttributeNone },
-       {"setCardEmulationChangeListener",      JSNFCAdapter::setCardEmulationChangeListener, kJSPropertyAttributeNone },
-       {"unsetCardEmulationChangeListener",      JSNFCAdapter::unsetCardEmulationChangeListener, kJSPropertyAttributeNone },
        { 0, 0, 0}
 };
 
@@ -152,17 +148,6 @@ JSValueRef JSNFCAdapter::getProperty(JSContextRef context, JSObjectRef object,
                        }
                        INFCAdapterPtr nfcAdapter(privateObject->getObject() );
                        return convert.toJSValueRef(nfcAdapter->getPowerState());
-               } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCADAPTER_SETYPE)) {
-                       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_CARDEMULATION_FUNCS);
-                       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-                       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(object));
-                       if (!privateObject) {
-                               LogError("private object is null");
-                               ThrowMsg(NullPointerException, "Private object not initialized");
-                       }
-                       INFCAdapterPtr nfcAdapter(privateObject->getObject() );
-                       return convert.toJSValueRefSEType(nfcAdapter->getSEType());
                }
        } Catch (NullPointerException) {
                LogError("NullPointerException: " << _rethrown_exception.GetMessage());
@@ -523,174 +508,6 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object,
        return JSValueMakeUndefined(context);
 }
 
-JSValueRef JSNFCAdapter::setCardEmulation (JSContextRef context, JSObjectRef object,
-               JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
-               JSValueRef* exception) {
-       LogDebug("Enter");
-
-       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_CARDEMULATION_FUNCS);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       Validator validator(context, exception);
-       if(argumentCount == 0) {
-           /* 1st argument is mandatory. */
-               LogError("TypeMismatchException!");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-       if ((argumentCount > 1) && !JSValueIsNull(context, arguments[1]) && !JSValueIsUndefined(context, arguments[1]) && !validator.isCallback(arguments[1])) {
-               /* And 2st argument must be Callback. */
-               LogError("TypeMismatchException!");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-       if ((argumentCount > 2) && !JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2]) && !validator.isCallback(arguments[2])) {
-               /* 3nd argument must be Callback. */
-               LogError("TypeMismatchException!");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       JSValueRef onSuccessForCbm = NULL, onErrorForCbm = NULL;
-       if ((argumentCount > 1) && validator.isCallback(arguments[1])) {
-               onSuccessForCbm = arguments[1];
-       }
-       if ((argumentCount > 2) && validator.isCallback(arguments[2])) {
-               onErrorForCbm = arguments[2];
-       }
-
-       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (!privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       JSContextRef global_context = privateObject->getContext();
-
-       INFCAdapterPtr nfcAdapter(privateObject->getObject() );
-       JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, onSuccessForCbm, onErrorForCbm, true, true);
-
-       Try {
-               NFCConverter nfcConverter(context);
-               EventNFCSEType seType = NFC_SE_INVALID;
-               seType = nfcConverter.toSEType(arguments[0]);
-
-               EventNFCSetCardEmulationPtr event(new EventNFCSetCardEmulation(seType));
-               event->setPrivateData( StaticPointerCast<IEventPrivateData>(callbackManager) );
-               event->setForAsynchronousCall(&NFCStaticController::getInstance());
-               nfcAdapter->setCardEmulation(event);
-               NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context);
-               return JSValueMakeUndefined(context);
-       } Catch (ConversionException) {
-               LogError("ConversionException");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
-       } Catch (UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
-       } Catch(NullPointerException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-       }
-       callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error"));
-       return JSValueMakeUndefined(context);
-}
-
-JSValueRef JSNFCAdapter::setCardEmulationChangeListener (JSContextRef context, JSObjectRef object,
-               JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[],
-               JSValueRef* exception) {
-       LogDebug("Entered ");
-
-       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_CARDEMULATION_FUNCS);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       Validator validator(context, exception);
-
-       if ((argumentCount < 1) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !validator.isCallback(arguments[0])) {
-               /* 1st argument is mandatory. And 1st argument must be Callback. */
-               LogError("TypeMismatchException!");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       JSValueRef onSuccessForCbm = NULL;
-       if (validator.isCallback(arguments[0])) {
-               onSuccessForCbm = arguments[0];
-       }
-
-       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (!privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       JSContextRef global_context = privateObject->getContext();
-
-       INFCAdapterPtr nfcAdapter(privateObject->getObject() );
-       JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(global_context, onSuccessForCbm, NULL, true, true);
-
-       Try {
-               EventNFCChangedCardEmulationEmitterPtr emitter(new EventNFCChangedCardEmulationEmitter);
-               emitter->setListener(&NFCStaticController::getInstance());
-               emitter->setEventPrivateData(StaticPointerCast<EventNFCChangedCardEmulation::PrivateDataType>(callbackManager));
-               nfcAdapter->setCardEmulationChangeListener(emitter);
-
-               NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(global_context, thisObject, static_cast<long>(ID_NFCADAPTER_CARDEMULATION_LISTENER)));
-               IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
-               NFCListenerManagerSingleton::Instance().registerListener(listenerItem, global_context);
-
-               return JSValueMakeUndefined(context);
-       } Catch (ConversionException) {
-               LogError("ConversionException");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
-       } Catch (UnknownException) {
-               LogError("UnknownException: " << _rethrown_exception.GetMessage());
-       } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-       }
-
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
-}
-
-JSValueRef JSNFCAdapter::unsetCardEmulationChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject,
-               size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
-       LogDebug("JSNFCAdapter::unsetPeerListener Enter");
-
-       AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_CARDEMULATION_FUNCS);
-       TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
-
-       NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (!privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
-
-       Try {
-               INFCAdapterPtr nfcAdapter(privateObject->getObject());
-               nfcAdapter->unsetCardEmulationChangeListener();
-
-               NFCListenerCancellerPtr canceller = NFCListenerCancellerPtr(new NFCListenerCanceller(privateObject->getContext(), thisObject,  ID_NFCADAPTER_CARDEMULATION_LISTENER));
-               IListenerItemPtr listenerItem = StaticPointerCast<IListenerItem>(canceller);
-               NFCListenerManagerSingleton::Instance().unregisterListener(listenerItem);
-
-               return JSValueMakeUndefined(context);
-       } Catch (ConversionException) {
-               LogError("ConversionException");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (NullPointerException) {
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
-       } Catch (WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-       }
-       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
-}
-
 
 }
 }
index d252bde..f910f18 100755 (executable)
@@ -100,27 +100,6 @@ private:
                size_t argumentCount,
                const JSValueRef arguments[],
                JSValueRef* exception);
-
-    static JSValueRef setCardEmulation(JSContextRef context,
-               JSObjectRef object,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception);
-
-    static JSValueRef setCardEmulationChangeListener(JSContextRef context,
-               JSObjectRef object,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception);
-
-    static JSValueRef unsetCardEmulationChangeListener(JSContextRef context,
-               JSObjectRef object,
-               JSObjectRef thisObject,
-               size_t argumentCount,
-               const JSValueRef arguments[],
-               JSValueRef* exception);
 };
 
 }
old mode 100644 (file)
new mode 100755 (executable)
index 8f6f15a..1a165b4
@@ -37,8 +37,6 @@ NFCAdapter::NFCAdapter() {
        m_NFCTargetEmitterPtr.Reset();
        m_tagFilter.Reset();
        m_EventNFCChangedSetPoweredPtr.Reset();
-       m_eventNFCSetCardEmulationPtr.Reset();
-       m_NFCChangedCardEmulations.Reset();
 }
 
 NFCAdapter::~NFCAdapter() {
@@ -46,8 +44,6 @@ NFCAdapter::~NFCAdapter() {
        unsetTagListener();
        unsetPeerListener();
        m_EventNFCChangedSetPoweredPtr.Reset();
-       m_eventNFCSetCardEmulationPtr.Reset();
-       unsetCardEmulationChangeListener();
 }
 
 int NFCAdapter::setTagListener(const EventNFCChangedEmitterPtr& emitter, const TagFilterPtr& filter) {
@@ -201,87 +197,5 @@ void NFCAdapter::setPoweredManualAnswer(int error) {
        }
 }
 
-EventNFCSEType NFCAdapter::getSEType() {
-       return NFCDefaultAdapterSingleton::Instance().getSEType();
-}
-
-void NFCAdapter::setCardEmulation(const EventNFCSetCardEmulationPtr& event) {
-       LogDebug("Enter");
-       EventRequestReceiver<EventNFCSetCardEmulation>::PostRequest(event);
-}
-
-void NFCAdapter::OnRequestReceived(const EventNFCSetCardEmulationPtr& event) {
-       if (getSEType() == event->getSEType()) {
-               event->setResult(true);
-               return;
-       }
-       if (m_eventNFCSetCardEmulationPtr.Get() !=NULL) {
-               event->setResult(false);
-               event->setError(DeviceAPI::Common::JSTizenException::SERVICE_NOT_AVAILABLE);
-               event->setErrorMessage("Progressing Identical Operation");
-               return;
-       }
-
-       event->switchToManualAnswer();
-       m_eventNFCSetCardEmulationPtr = event;
-       Try {
-               NFCDefaultAdapterSingleton::Instance().setCardEmulation(event->getSEType(), this);
-               return;
-       } Catch(PlatformException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               event->setResult(false);
-               event->setError(DeviceAPI::Common::JSTizenException::SERVICE_NOT_AVAILABLE);
-               event->setErrorMessage("Progressing Identical Operation");
-               EventRequestReceiver<EventNFCSetCardEmulation>::ManualAnswer(event);
-       } Catch(WrtDeviceApis::Commons::Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               setCardEmulationManualAnswer(NFC_ERROR_OPERATION_FAILED);
-       }
-}
-
-void NFCAdapter::setCardEmulationManualAnswer(int error) {
-       if (m_eventNFCSetCardEmulationPtr.Get() != NULL) {
-               if (error == NFC_ERROR_NONE) {
-                       m_eventNFCSetCardEmulationPtr->setResult(true);
-               } else {
-                       NFCUtil util;
-                       m_eventNFCSetCardEmulationPtr->setResult(false);
-                       if (error == NFC_ERROR_INVALID_PARAMETER) {
-                               m_eventNFCSetCardEmulationPtr->setError(DeviceAPI::Common::JSTizenException::NOT_FOUND_ERROR);
-                               m_eventNFCSetCardEmulationPtr->setErrorMessage("Not Found Error");
-                       } else {
-                               m_eventNFCSetCardEmulationPtr->setError(util.getNFCErrorString(error));
-                               m_eventNFCSetCardEmulationPtr->setErrorMessage(util.getNFCErrorMessage(error));
-                       }
-               }
-               EventRequestReceiver<EventNFCSetCardEmulation>::ManualAnswer(m_eventNFCSetCardEmulationPtr);
-               m_eventNFCSetCardEmulationPtr.Reset();
-       }
-}
-
-void NFCAdapter::setCardEmulationChangeListener(const EventNFCChangedCardEmulationEmitterPtr& emitter) {
-       LogDebug("Entered");
-
-       if (m_NFCChangedCardEmulations.Get() != NULL)
-               ThrowMsg(PlatformException, "It has already set Card Emulation Change Listener");
-
-       m_NFCChangedCardEmulations = emitter;
-
-       NFCDefaultAdapterSingleton::Instance().setCardEmulationChangeListener(this);
-}
-
-void NFCAdapter::seChanged(EventNFCSEType seType) {
-       if (m_NFCChangedCardEmulations.Get() != NULL) {
-               EventNFCChangedCardEmulationPtr event(new EventNFCChangedCardEmulation());
-               event->setSEType(seType);
-               LogDebug("emit event with seChanged(type:" << seType << ")");
-               m_NFCChangedCardEmulations->emit(event);
-       }
-}
-void NFCAdapter::unsetCardEmulationChangeListener() {
-       m_NFCChangedCardEmulations.Reset();
-       NFCDefaultAdapterSingleton::Instance().unsetCardEmulationChangeListener(this);
-}
-
 }
 }
index c28f8e5..e9b48b9 100755 (executable)
@@ -58,24 +58,13 @@ public:
        virtual bool getPowerState();
        virtual void setPowered(const EventNFCChangedSetPoweredPtr& event);
        void setPoweredManualAnswer(int error);
-
-       virtual EventNFCSEType getSEType();
-       virtual void setCardEmulation(const EventNFCSetCardEmulationPtr& event);
-       void setCardEmulationManualAnswer(int error);
-
-       virtual void setCardEmulationChangeListener(const EventNFCChangedCardEmulationEmitterPtr& event);
-       void seChanged(EventNFCSEType seType);
-       virtual void unsetCardEmulationChangeListener();
 private:
        EventNFCChangedEmitterPtr m_NFCTagEmitterPtr;
        EventNFCChangedEmitterPtr m_NFCTargetEmitterPtr;
        EventNFCChangedSetPoweredPtr m_EventNFCChangedSetPoweredPtr;
-       EventNFCSetCardEmulationPtr m_eventNFCSetCardEmulationPtr;
-       EventNFCChangedCardEmulationEmitterPtr m_NFCChangedCardEmulations;
        TagFilterPtr m_tagFilter;
   protected:
        virtual void OnRequestReceived(const EventNFCChangedSetPoweredPtr& event);
-       virtual void OnRequestReceived(const EventNFCSetCardEmulationPtr& event);
 };
 
 }
index 4c92aeb..d5deb1a 100755 (executable)
@@ -390,28 +390,5 @@ NFCChangedCallback NFCConverter::toNFCChangedCallback(const JSValueRef& arg) {
     return result;
 }
 
-EventNFCSEType NFCConverter::toSEType(JSValueRef arg) {
-       std::string seType = toString(arg);
-       if (seType == "NONE")
-               return NFC_SE_NONE;
-       else if (seType == "ESE")
-               return NFC_SE_ESE;
-       else if (seType == "UICC")
-               return NFC_SE_UICC;
-       else
-               ThrowMsg(Commons::ConversionException, "No Match SE Type");
-}
-
-JSValueRef NFCConverter::toJSValueRefSEType(EventNFCSEType type) {
-       if (type == NFC_SE_NONE)
-               return toJSValueRef("NONE");
-       else if (type == NFC_SE_ESE)
-               return toJSValueRef("ESE");
-       else if (type == NFC_SE_UICC)
-               return toJSValueRef("UICC");
-       else
-               ThrowMsg(Commons::ConversionException, "No Match SE Type");
-}
-
 }
 }
index d9421fb..ecdb70e 100755 (executable)
@@ -57,8 +57,6 @@ class NFCConverter : public WrtDeviceApis::CommonsJavaScript::Converter
        void *getRecordHandle(const JSValueRef& arg);
        void *getMessageHandle(const JSValueRef& arg);
        NFCChangedCallback toNFCChangedCallback(const JSValueRef& arg);
-       EventNFCSEType toSEType(JSValueRef arg);
-       JSValueRef toJSValueRefSEType(EventNFCSEType type);
   private:
     bool initializeAllowedProperties();
     static std::vector<std::string> m_allowedTagFilterProperties;
old mode 100644 (file)
new mode 100755 (executable)
index b7d95b2..8d2a688
@@ -71,15 +71,7 @@ namespace
                LogDebug("Callback NFCSetActivationCompletedCallback.");
                NFCDefaultAdapterSingleton::Instance().setPoweredManualAnswer(error);
        }
-       static void NFCSetCardEmulationCompletedCallback(nfc_error_e error, void *user_data) {
-               LogDebug("Callback NFCSetActivationCompletedCallback.");
-               NFCDefaultAdapterSingleton::Instance().setCardEmulationManualAnswer(error, user_data);
-       }
-       static void NFCSetSEEventCallback(nfc_se_event_e event, void *user_data) {
-               LogDebug("Callback NFCSetSEEventCallback.");
-               if (event == NFC_SE_EVENT_SE_TYPE_CHANGED)
-                       NFCDefaultAdapterSingleton::Instance().seChanged();
-       }
+
 }//private namespace
 
 NFCDefaultAdapter::NFCDefaultAdapter()
@@ -88,9 +80,7 @@ NFCDefaultAdapter::NFCDefaultAdapter()
 
        m_NFCTagListeners.clear();
        m_NFCTargetListeners.clear();
-       m_NFCChangedSETypes.clear();
        m_poweredAdapter = NULL;
-       m_seType = NFC_SE_INVALID;
 }
 
 NFCDefaultAdapter::~NFCDefaultAdapter() {
@@ -354,122 +344,6 @@ void NFCDefaultAdapter::setPoweredManualAnswer(int error) {
        }
 }
 
-EventNFCSEType NFCDefaultAdapter::getSEType() {
-       LogDebug("Enter");
-       nfc_se_type_e type = NFC_SE_TYPE_DISABLE;
-       if (nfc_manager_get_card_emulation_se_type(&type) == NFC_ERROR_NONE) {
-               NFCUtil util;
-               if (util.convertTonfcSEType(type) != NFC_SE_INVALID)
-                       return util.convertTonfcSEType(type);
-       }
-       ThrowMsg(PlatformException, "Wrong SE Type or operation to get SE Type is failed");
-}
-
-void NFCDefaultAdapter::setCardEmulation(const EventNFCSEType seType, NFCAdapter * adapter) {
-       LogDebug("Enter");
-       try {
-               if (getSEType() == seType) {
-                       adapter->setCardEmulationManualAnswer(NFC_ERROR_NONE);
-                       seChanged();
-                       return;
-               }
-
-               nfc_se_type_e nfcSeType = NFC_SE_TYPE_DISABLE;
-               if (seType == NFC_SE_NONE)
-                       nfcSeType = NFC_SE_TYPE_DISABLE;
-               else if (seType == NFC_SE_ESE)
-                       nfcSeType = NFC_SE_TYPE_ESE;
-               else if (seType == NFC_SE_UICC)
-                       nfcSeType = NFC_SE_TYPE_UICC;
-               else
-                       ThrowMsg(PlatformException, "Wrong SE TYPE");
-
-               int result = NFC_ERROR_NONE;
-               if (!m_initialized)
-                       result = initialize();
-
-               if (result == NFC_ERROR_NONE) {
-                       result = nfc_manager_set_card_emulation_se_type(nfcSeType, NFCSetCardEmulationCompletedCallback, (void *)adapter);
-               }
-
-               if (result != NFC_ERROR_NONE)
-                       adapter->setCardEmulationManualAnswer(result);
-       } catch (const WrtDeviceApis::Commons::Exception& ex) {
-               LogError("Exception: " << ex.GetMessage());
-               adapter->setCardEmulationManualAnswer(NFC_ERROR_OPERATION_FAILED);
-       }
-}
-
-void NFCDefaultAdapter::setCardEmulationManualAnswer(int error, void *adapter) {
-       if (adapter != NULL) {
-               ((NFCAdapter *)adapter)->setCardEmulationManualAnswer(error);
-               if (error == NFC_ERROR_NONE)
-                       seChanged();
-       }
-}
-
-void NFCDefaultAdapter::setCardEmulationChangeListener(NFCAdapter *adapter) {
-       LogDebug("Entered");
-       int result = -1;
-
-       m_NFCChangedSETypes.push_back(adapter);
-
-       if (!m_initialized) {
-               if (initialize() != NFC_ERROR_NONE) {
-                       m_NFCChangedSETypes.clear();
-                       ThrowMsg(PlatformException, "Could not initialize NFC.");
-               }
-       }
-       if (m_NFCChangedSETypes.size() > 1)
-               return;
-
-       m_seType = getSEType();
-       result = nfc_manager_set_se_event_cb(NFCSetSEEventCallback, this);
-
-       NFCUtil util;
-       if (result != NFC_ERROR_NONE) {
-               m_NFCTargetListeners.pop_back();
-               util.throwNFCException(result, "failed to set callback of nfc_manager_set_p2p_target_discovered_cb");
-       }
-
-       LogInfo("NFCDefaultAdapter::setPeerListener : result << " << result);
-}
-
-void NFCDefaultAdapter::unsetCardEmulationChangeListener(NFCAdapter * adapter) {
-       LogDebug("Entered");
-
-       if (!m_initialized) {
-               if (initialize() != NFC_ERROR_NONE) {
-                       ThrowMsg(PlatformException, "Could not initialize NFC.");
-               }
-       }
-
-       std::vector<NFCAdapter *>::iterator it;
-       for (it = m_NFCChangedSETypes.begin(); it != m_NFCChangedSETypes.end(); ++it) {
-               if (*it == adapter) {
-                       m_NFCChangedSETypes.erase(it);
-                       LogDebug("emitter is removed. (" << m_NFCChangedSETypes.size() << ")");
-                       break;
-               }
-       }
-
-       if (m_NFCChangedSETypes.empty()) {
-               nfc_manager_unset_se_event_cb();
-               m_seType = NFC_SE_INVALID;
-       }
-}
-
-void NFCDefaultAdapter::seChanged() {
-       if (m_seType != NFC_SE_INVALID) {
-               if (m_seType != getSEType()) {
-                       m_seType = getSEType();
-                       std::vector<NFCAdapter *>::iterator it;
-                       for (it = m_NFCChangedSETypes.begin(); it != m_NFCChangedSETypes.end(); ++it) {
-                               (*it)->seChanged(m_seType);
-                       }
-               }
-       }
-}
 
 }
 }
index df62570..500993f 100755 (executable)
@@ -59,14 +59,6 @@ public:
        void setPowered(const bool state, NFCAdapter * adapter);
        void setPoweredManualAnswer(int error);
 
-       EventNFCSEType getSEType();
-       void setCardEmulation(const EventNFCSEType seType, NFCAdapter * adapter);
-       void setCardEmulationManualAnswer(int error, void *adapter);
-
-       void setCardEmulationChangeListener(NFCAdapter *adapter);
-       void seChanged();
-       void unsetCardEmulationChangeListener(NFCAdapter * adapter);
-
        bool isSupported();
        void deinitialze();
 private:
@@ -77,11 +69,9 @@ private:
 
        std::vector<NFCAdapter *> m_NFCTagListeners;
        std::vector<NFCAdapter *> m_NFCTargetListeners;
-       std::vector<NFCAdapter *> m_NFCChangedSETypes;
         
        NFCAdapter * m_poweredAdapter;
        bool m_initialized;
-       EventNFCSEType m_seType;
 
        friend class DPL::Singleton<NFCDefaultAdapter>;
 
old mode 100644 (file)
new mode 100755 (executable)
index 7252822..5702396
@@ -35,7 +35,6 @@ enum NFCListenerWatchID {
        ID_NFCADAPTER_TAG_LISTENER = 1,
        ID_NFCADAPTER_PEER_LISTENER,
        ID_NFCPEER_RECEIVENDEF_LISTENER,
-       ID_NFCADAPTER_CARDEMULATION_LISTENER
 };
 
 class NFCListenerManager : public DeviceAPI::Common::IListenerController
@@ -100,21 +99,7 @@ public:
                                }
                                break;
                        }
-                       case ID_NFCADAPTER_CARDEMULATION_LISTENER:
-                       {
-                               NFCAdapterPrivObject* privateObject = static_cast<NFCAdapterPrivObject*>(JSObjectGetPrivate(m_object));
-                               if (NULL == privateObject) {
-                                       LogError("Object has no privateObject");
-                                       return;
-                               }
-                               Try {
-                                       INFCAdapterPtr nfcAdapter( privateObject->getObject());
-                                       nfcAdapter->unsetCardEmulationChangeListener();
-                               } Catch(WrtDeviceApis::Commons::Exception) {
-                                       LogError("Error on platform : " << _rethrown_exception.GetMessage());
-                               }
-                               break;                          
-                       }
+
                        default:
                                LogError("Wrong ID");
                }
old mode 100644 (file)
new mode 100755 (executable)
index 1659725..5418c35
@@ -49,9 +49,7 @@ NFCStaticController& NFCStaticController::getInstance() {
 
 NFCStaticController::NFCStaticController() :
        EventNFCChangedListener(ThreadEnum::NULL_THREAD), 
-       setPoweredAnswerReceiver(ThreadEnum::NULL_THREAD),
-       setCardEmulationAnswerReceiver(ThreadEnum::NULL_THREAD),
-       EventNFCChangedCardEmulationListener(ThreadEnum::NULL_THREAD) {
+       setPoweredAnswerReceiver(ThreadEnum::NULL_THREAD) {
 }
 
 void NFCStaticController::onAnswerReceived(const EventNFCChangedPtr& event) {
@@ -137,74 +135,5 @@ void NFCStaticController::OnAnswerReceived(const EventNFCChangedSetPoweredPtr &e
        }
 }
 
-void NFCStaticController::OnAnswerReceived(const EventNFCSetCardEmulationPtr &event)
-{
-       JSCallbackManagerPtr cbm =
-           DPL::StaticPointerCast<JSCallbackManager>(event->getPrivateData());
-
-       Try {
-               if (!cbm) {
-                       LogDebug("no callback manager");
-                       return;
-               }
-               NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm);
-               if (event->getResult()) {
-                       LogDebug("result success");
-                       cbm->callOnSuccess();
-                       return;
-               }
-               LogDebug("result fail");
-               std::string error = event->getError();
-               std::string errorMessage = event->getErrorMessage();
-               JSValueRef errorObject;
-               if (error != "") {
-                       if (errorMessage != "")
-                               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, errorMessage);
-                       else
-                               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, error);
-               } else
-                       errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-               cbm->callOnError(errorObject);
-       } Catch (PlatformException) {
-               LogError("PlatformException"  << _rethrown_exception.GetMessage());
-               JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::SERVICE_NOT_AVAILABLE,"Service Not Available");
-               cbm->callOnError(errorObject);
-       } Catch (UnknownException) {
-               LogError("UnknownException"  << _rethrown_exception.GetMessage());
-               JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-               cbm->callOnError(errorObject);          
-       } Catch (Exception) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-               cbm->callOnError(errorObject);  
-       }
-}
-
-void NFCStaticController::onAnswerReceived(const EventNFCChangedCardEmulationPtr& event) {
-       LogDebug("Enter");
-
-       Try {
-               JSCallbackManagerPtr cbm =
-                   DPL::StaticPointerCast<JSCallbackManager>(event->getPrivateData());
-               EventNFCSEType seType = event->getSEType();
-
-               if (seType != NFC_SE_INVALID) {
-                       JSContextRef context = cbm->getContext();
-                       LogDebug("callOnSuccess");
-                       NFCConverter converter(context);
-                       cbm->callOnSuccess(converter.toJSValueRefSEType(seType));
-               }
-       } Catch (ConversionException) {
-               LogError("Conversion exception while processing EventNFCChanged");
-       } Catch (PlatformException) {
-               LogError("PlatformException:Platform can't create NFCTag"  << _rethrown_exception.GetMessage());
-       } Catch (UnknownException) {
-               LogError("UnknownException:Platform can't create NFCTag"  << _rethrown_exception.GetMessage());
-       } Catch (NullPointerException) {
-               LogError("NullPointer exception while processing EventNFCChanged");
-       }
-
-}
-
 } // NFC
 } // DeviceAPI
index cfc79bb..e7749a9 100755 (executable)
@@ -29,21 +29,17 @@ namespace NFC {
 using namespace WrtDeviceApis::Commons;
 typedef EventListener<EventNFCChanged> EventNFCChangedListener;
 typedef EventAnswerReceiver<EventNFCChangedSetPowered> setPoweredAnswerReceiver;
-typedef EventAnswerReceiver<EventNFCSetCardEmulation> setCardEmulationAnswerReceiver;
-typedef EventListener<EventNFCChangedCardEmulation> EventNFCChangedCardEmulationListener;
+
 class NFCStaticController :
        public EventNFCChangedListener,
-       public setPoweredAnswerReceiver,
-       public setCardEmulationAnswerReceiver,
-       public EventNFCChangedCardEmulationListener
+       public setPoweredAnswerReceiver
 {
 public:
        static NFCStaticController& getInstance();
 
        void onAnswerReceived(const EventNFCChangedPtr& event);
        void OnAnswerReceived(const EventNFCChangedSetPoweredPtr &event);
-       void OnAnswerReceived(const EventNFCSetCardEmulationPtr &event);
-       void onAnswerReceived(const EventNFCChangedCardEmulationPtr& event);
+
 protected:
        NFCStaticController();
 };
old mode 100644 (file)
new mode 100755 (executable)
index 9c726b9..b069dff
@@ -164,19 +164,6 @@ nfcTNF NFCUtil::convertTonfcTNF(unsigned short tnf) {
        }
 }
 
-EventNFCSEType NFCUtil::convertTonfcSEType(unsigned short type) {
-       switch (static_cast<nfc_se_type_e>(type)) {
-               case NFC_SE_TYPE_DISABLE:
-                       return NFC_SE_NONE;
-               case NFC_SE_TYPE_ESE:
-                       return NFC_SE_ESE;
-               case NFC_SE_TYPE_UICC:
-                       return NFC_SE_UICC;
-               default:
-                       LogDebug("Wrong SE Type : " << type);
-                       return NFC_SE_INVALID;
-       }
-}
 
 NdefRecordData NFCUtil::getNDEFRecordData(void *handle) {
        nfc_ndef_record_h recordHandle = static_cast<nfc_ndef_record_h>(handle);
index 4de5ad8..5dc335f 100755 (executable)
@@ -42,7 +42,6 @@ class NFCUtil
        nfcTagType convertTonfcTagType(const unsigned short type);
        unsigned short convertToTNF(nfcTNF tnf);
        nfcTNF convertTonfcTNF(unsigned short tnf);
-       EventNFCSEType convertTonfcSEType(unsigned short type);
        NdefRecordData getNDEFRecordData(void *handle);
        bool copyNDEFRecord(void **src, void **dest);
        bool copyNDEFMessage(void **src, void **dest);
index 56621d0..3b2f00c 100755 (executable)
@@ -183,7 +183,7 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS
     std::string networkType = converter.toString(arguments[0]);
     std::string domainName = converter.toString(arguments[1]);
     if (strcmp(networkType.c_str(), "CELLULAR") != 0) {
-        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error");
+        return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error");
     }
 
        callbackManager->setOnSuccess(onsuccess);
index bcccd27..d89704f 100755 (executable)
@@ -40,10 +40,10 @@ m_index(index)
 }
 
 NotificationLine::NotificationLine(notification_h noti, int index, std::string &info, std::string &subInfo):
-m_notiHandle(noti),
-m_index(index),
 m_info(info),
-m_subInfo(subInfo)
+m_subInfo(subInfo),
+m_notiHandle(noti),
+m_index(index)
 {
        LogDebug("create by notification with data" );
 }
index 8c6fc9c..8a9d3eb 100755 (executable)
@@ -57,8 +57,8 @@ static void service_bundle_iterator(const char *key, const int type, const bundl
 #endif
 
 StatusNotification::StatusNotification(NotificationType statusType) :
-       m_notiHandle(NULL),
        m_service(NULL),
+       m_notiHandle(NULL),
        m_lines(NULL)
 {      
        notification_type_e type = NOTIFICATION_TYPE_NONE;
@@ -91,6 +91,10 @@ StatusNotification::StatusNotification(NotificationType statusType) :
                LogDebug("noti =" << noti);
                setNotificationHandle((void*)noti);
                setNotificationState(NOTI_STATE_CREATED);
+               if ( statusType == NOTI_TYPE_PROGRESS)
+               {
+                       notification_update_progress(noti, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
+               }
        }
        m_lines = NotificationLineArrayPtr(new NotificationLineArray());
        m_thumbs = StringArrayPtr(new StringArray());
@@ -98,8 +102,8 @@ StatusNotification::StatusNotification(NotificationType statusType) :
 }
 
 StatusNotification::StatusNotification(void* noti) :
-       m_notiHandle(NULL),
        m_service(NULL),
+       m_notiHandle(NULL),
        m_lines(NULL)
 {
        LogDebug("noti : " << noti);
@@ -149,6 +153,11 @@ StatusNotification::StatusNotification(void* noti) :
                setNotificationLines();
                setNotificationState(NOTI_STATE_CREATED);
 
+                if ( type  == NOTI_TYPE_PROGRESS)
+                {
+                        notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
+                }
+
                //service
                bundle *bSvc = NULL;
 
@@ -168,73 +177,6 @@ StatusNotification::StatusNotification(void* noti) :
                                        ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service creation error");
                                }
 
-#if 0
-                               const char *tmpStr = NULL;
-                               if(m_service == NULL && service_create(&m_service) != SERVICE_ERROR_NONE)
-                               {
-                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service creation error");
-                               }
-                               
-                               tmpStr = appsvc_get_operation(bSvc);
-                               if (tmpStr)
-                               {
-                                       LogDebug("operation = " << tmpStr);
-                                       if (tmpStr)
-                                       {
-                                               if (service_set_operation(m_service, tmpStr) != SERVICE_ERROR_NONE)
-                                               {
-                                                       ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set operation error");
-                                               }
-                                       }
-                                       else if (service_set_operation(m_service, SERVICE_OPERATION_DEFAULT) != SERVICE_ERROR_NONE)
-                                       {
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set operation error");
-                                       }
-                                       tmpStr = NULL;  
-                               }
-
-                               else 
-                               {
-                                       if (service_set_operation(m_service, SERVICE_OPERATION_DEFAULT) != SERVICE_ERROR_NONE)
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set operation error");
-                               }
-                               
-                               tmpStr = appsvc_get_uri(bSvc);
-                               if (tmpStr)
-                               {
-                                       LogDebug("uri = " << tmpStr);
-                                       if (service_set_uri(m_service, tmpStr) != SERVICE_ERROR_NONE)
-                                       {
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set uri error");
-                                       }
-                                       tmpStr = NULL;
-                               }
-                               
-                               tmpStr = appsvc_get_mime(bSvc);
-                               if(tmpStr)
-                               {
-                                       LogDebug("mime = " << tmpStr);
-                                       if (service_set_mime(m_service, tmpStr) != SERVICE_ERROR_NONE)
-                                       {
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set mime error");
-                                       }
-                                       tmpStr = NULL;
-                               }
-               
-                               tmpStr = appsvc_get_category(bSvc);
-                               if(tmpStr)
-                               {
-                                       LogDebug("category = " << tmpStr);
-                                       if (service_set_category(m_service, tmpStr) != SERVICE_ERROR_NONE)
-                                       {
-                                               ThrowMsg(WrtDeviceApis::Commons::UnknownException, "service set category error");
-                                       }
-                                       tmpStr = NULL;
-                               }
-                               
-                               //extra option
-                               bundle_foreach(bSvc, service_bundle_iterator, m_service); 
-#endif
                                bundle_free(bSvc); //bundle free
                        }
                }
@@ -242,8 +184,8 @@ StatusNotification::StatusNotification(void* noti) :
 }
 
 StatusNotification::StatusNotification(int privID) :
-               m_notiHandle(NULL),
                m_service(NULL),
+               m_notiHandle(NULL),
                m_lines(NULL)
 {
        LogDebug("priv ID : " << privID);
@@ -1754,7 +1696,6 @@ void StatusNotification::setNotificationLines()
 DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplicationControl()
 {      
        service_h service = NULL;
-       int retcode = 0;
        char *tempStr = NULL;
        
        DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
@@ -2016,7 +1957,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati
                }
                                
                std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = appControl->getAppControlDataArray();
-               size_t index = 0, indexArray = 0;
+               size_t index = 0;
 
                LogDebug (" App Control Datas Count : " << appControlDataArray.size());
 
@@ -2071,7 +2012,6 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati
 
 void StatusNotification::setApplicationId(const std::string& appId)
 {
-       int retcode = 0;
        LogDebug("m_service = " << m_service << " appId = " << appId);
        if (!m_service)
        {       
index 1b9abb0..0e3b8cc 100755 (executable)
@@ -44,6 +44,7 @@ TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
 
 SET(SRCS
        plugin_initializer.cpp
+       plugin_config.cpp
 )
 
 ADD_LIBRARY(${TARGET_NAME} SHARED ${SRCS})
index bff7d3a..d827e8e 100755 (executable)
@@ -33,12 +33,15 @@ class EventSETemplate : public WrtDeviceApis::Commons::IEvent<templateClass>
 {
 protected:
        bool result;
-       std::string errorCode;
+       std::string errorName;
+       std::string errorMessage;
 public:
        void setResult(const bool value) {result = value;}
        bool getResult() const {return result;}
-       void setError(const std::string &error) { errorCode= error;}
-       std::string getError() {return errorCode;}
+       void setError(const std::string &error) { errorName = error;}
+       std::string getError() {return errorName;}
+       void setErrorMessage(const std::string &message) { errorMessage= message;}
+       std::string getErrorMessage() {return errorMessage;}
        EventSETemplate() :result(true) { }
 };
 
old mode 100644 (file)
new mode 100755 (executable)
index 541894c..23c9c96
@@ -31,6 +31,7 @@
 #include "JSSEChannel.h"
 #include "SEAsyncCallbackManager.h"
 #include "SEConverter.h"
+#include "plugin_config.h"
 
 using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis::Commons;
@@ -167,6 +168,9 @@ JSValueRef JSSEChannel::close(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        SEChannelPrivObject* privateObject = static_cast<SEChannelPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LogError("private object is null");
@@ -179,9 +183,6 @@ JSValueRef JSSEChannel::close(JSContextRef context,
                return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (PlatformException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
        } Catch (WrtDeviceApis::Commons::Exception) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -197,6 +198,9 @@ JSValueRef JSSEChannel::transmit(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        Validator validator(context, exception);
 
        if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) {
@@ -250,14 +254,6 @@ JSValueRef JSSEChannel::transmit(JSContextRef context,
        } Catch (ConversionException) {
                LogError("ConversionException: " << _rethrown_exception.GetMessage());
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
-               return JSValueMakeUndefined(context);
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
old mode 100644 (file)
new mode 100755 (executable)
index 3273ef2..740e5c1
@@ -31,7 +31,7 @@
 #include "SEResponseDispatcher.h"
 #include "JSSEReader.h"
 #include "SEAsyncCallbackManager.h"
-
+#include "plugin_config.h"
 
 using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis::Commons;
@@ -170,6 +170,10 @@ JSValueRef JSSEReader::getName(JSContextRef context,
         JSValueRef* exception)
 {
        LogDebug("Entered ");
+
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        SEReaderPrivObject* privateObject = static_cast<SEReaderPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LogError("private object is null");
@@ -190,6 +194,9 @@ JSValueRef JSSEReader::openSession(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        Validator validator(context, exception);
 
        if ((argumentCount < 1) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !validator.isCallback(arguments[0])) {
@@ -237,14 +244,6 @@ JSValueRef JSSEReader::openSession(JSContextRef context,
        } Catch (ConversionException) {
                LogError("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException");
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
-               return JSValueMakeUndefined(context);
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -263,6 +262,10 @@ JSValueRef JSSEReader::closeSessions(JSContextRef context,
         JSValueRef* exception)
 {
        LogDebug("Entered ");
+
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        SEReaderPrivObject* privateObject = static_cast<SEReaderPrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LogError("private object is null");
old mode 100644 (file)
new mode 100755 (executable)
index d9d8e49..9873832
@@ -34,7 +34,7 @@
 #include "SEAsyncCallbackManager.h"
 #include "SEListenerManager.h"
 #include "SEConverter.h"
-
+#include "plugin_config.h"
 
 using namespace DeviceAPI::Common;
 using namespace WrtDeviceApis::Commons;
@@ -142,6 +142,9 @@ JSValueRef JSSEService::getReaders(JSContextRef context,
 
        Validator validator(context, exception);
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        if ((argumentCount < 1) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !validator.isCallback(arguments[0])) {
                /* 1st argument is mandatory. And 1st argument must be Callback. */
                LogError("TypeMismatchException!");
@@ -185,14 +188,6 @@ JSValueRef JSSEService::getReaders(JSContextRef context,
        } Catch (ConversionException) {
                LogError("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException");
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
-               return JSValueMakeUndefined(context);
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -212,6 +207,9 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        Validator validator(context, exception);
 
        if ((argumentCount < 1) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
@@ -268,6 +266,9 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o
                size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) {
        LogDebug("Enter");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        if ((argumentCount < 1) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0])) {
                /* 1st argument is mandatory. And 1st argument must be Callback. */
                LogError("TypeMismatchException!");
@@ -297,7 +298,7 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o
        } Catch (NullPointerException) {
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
        } Catch (NotFoundException) {
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, "Not Found ID");
+               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Not Found ID");
        } Catch (WrtDeviceApis::Commons::Exception) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
        }
@@ -313,6 +314,9 @@ JSValueRef JSSEService::shutdown(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        SEServicePrivObject* privateObject = static_cast<SEServicePrivObject*>(JSObjectGetPrivate(thisObject));
        if (NULL == privateObject) {
                LogError("private object is null");
@@ -325,9 +329,6 @@ JSValueRef JSSEService::shutdown(JSContextRef context,
                return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
-       } Catch (PlatformException) {
-               LogError("Exception: " << _rethrown_exception.GetMessage());
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available");
        } Catch (WrtDeviceApis::Commons::Exception) {
                LogError("Exception: " << _rethrown_exception.GetMessage());
        }
old mode 100644 (file)
new mode 100755 (executable)
index 2f8e149..c422def
@@ -32,7 +32,7 @@
 #include "JSSESession.h"
 #include "SEConverter.h"
 #include "SEAsyncCallbackManager.h"
-
+#include "plugin_config.h"
 
 
 using namespace DeviceAPI::Common;
@@ -171,15 +171,23 @@ JSValueRef JSSESession::getATR(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (NULL == privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       ISESessionPtr seSession(privateObject->getObject());
-       SEConverter convert(context);
-       return convert.toJSValueRef(seSession->getATR());
+       Try {
+               SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (NULL == privateObject) {
+                       LogError("private object is null");
+                       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+               }
+
+               ISESessionPtr seSession(privateObject->getObject());
+               SEConverter convert(context);
+               return convert.toJSValueRef(seSession->getATR());
+       } Catch (WrtDeviceApis::Commons::Exception) {
+               LogError("Exception: " << _rethrown_exception.GetMessage());
+       }
+       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }
 
 JSValueRef JSSESession::close(JSContextRef context,
@@ -189,15 +197,23 @@ JSValueRef JSSESession::close(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (NULL == privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       ISESessionPtr seSession(privateObject->getObject());
-       seSession->close();
-       return JSValueMakeUndefined(context);
+       Try {
+               SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (NULL == privateObject) {
+                       LogError("private object is null");
+                       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+               }
+
+               ISESessionPtr seSession(privateObject->getObject());
+               seSession->close();
+               return JSValueMakeUndefined(context);
+       } Catch (WrtDeviceApis::Commons::Exception) {
+               LogError("Exception: " << _rethrown_exception.GetMessage());
+       }
+       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }
 
 JSValueRef JSSESession::closeChannels(JSContextRef context,
@@ -207,15 +223,23 @@ JSValueRef JSSESession::closeChannels(JSContextRef context,
         const JSValueRef arguments[],
         JSValueRef* exception)
 {
-       SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
-       if (NULL == privateObject) {
-               LogError("private object is null");
-               return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       }
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
 
-       ISESessionPtr seSession(privateObject->getObject());
-       seSession->closeChannels();
-       return JSValueMakeUndefined(context);
+       Try {
+               SESessionPrivObject* privateObject = static_cast<SESessionPrivObject*>(JSObjectGetPrivate(thisObject));
+               if (NULL == privateObject) {
+                       LogError("private object is null");
+                       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
+               }
+
+               ISESessionPtr seSession(privateObject->getObject());
+               seSession->closeChannels();
+               return JSValueMakeUndefined(context);
+       } Catch (WrtDeviceApis::Commons::Exception) {
+               LogError("Exception: " << _rethrown_exception.GetMessage());
+       }
+       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error");
 }
 
 JSValueRef JSSESession::openBasicChannel(JSContextRef context,
@@ -227,6 +251,9 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        Validator validator(context, exception);
 
        if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) {
@@ -268,7 +295,12 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context,
        Converter convert(context);
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(privateObject->getContext(), onSuccessForCbm, onErrorForCbm, true, true);
        Try {
-               EventSEOpenChannelPtr event(new EventSEOpenChannel(convert.toVectorOfUChars(arguments[0]), true));
+               std::vector<unsigned char> aid = convert.toVectorOfUChars(arguments[0]);
+               if ((aid.size() < 5) || (aid.size() > 16)) {
+                       LogError("wrong aid length : " << aid.size());
+                       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Wrong AID length");
+               }
+               EventSEOpenChannelPtr event(new EventSEOpenChannel(aid, true));
                event->setPrivateData( StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&SEResponseDispatcher::getInstance());
 
@@ -280,14 +312,6 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context,
        } Catch (ConversionException) {
                LogError("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException");
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
-               return JSValueMakeUndefined(context);
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
@@ -307,6 +331,9 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context,
 {
        LogDebug("Entered ");
 
+    AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS);
+    TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
+
        Validator validator(context, exception);
 
        if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) {
@@ -348,7 +375,12 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context,
        Converter convert(context);
        JSCallbackManagerPtr callbackManager = JSCallbackManager::createObject(privateObject->getContext(), onSuccessForCbm, onErrorForCbm, true, true);
        Try {
-               EventSEOpenChannelPtr event(new EventSEOpenChannel(convert.toVectorOfUChars(arguments[0]), false));
+               std::vector<unsigned char> aid = convert.toVectorOfUChars(arguments[0]);
+               if ((aid.size() < 5) || (aid.size() > 16)) {
+                       LogError("wrong aid length : " << aid.size());
+                       return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Wrong AID length");
+               }
+               EventSEOpenChannelPtr event(new EventSEOpenChannel(aid, false));
                event->setPrivateData( StaticPointerCast<IEventPrivateData>(callbackManager) );
                event->setForAsynchronousCall(&SEResponseDispatcher::getInstance());
 
@@ -360,14 +392,6 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context,
        } Catch (ConversionException) {
                LogError("ConversionException");
                return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch");
-       } Catch (InvalidArgumentException) {
-               LogError("InvalidArgumentException");
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"));
-               return JSValueMakeUndefined(context);
-       } Catch (PlatformException) {
-               LogError("PlatformException: " << _rethrown_exception.GetMessage());
-               callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"));
-               return JSValueMakeUndefined(context);
        } Catch (UnknownException) {
                LogError("UnknownException: " << _rethrown_exception.GetMessage());
        } Catch (WrtDeviceApis::Commons::Exception) {
index a59c75d..266cdb5 100644 (file)
@@ -82,15 +82,13 @@ void SEChannel::transmit(const EventSEChannelTransmitPtr& event) {
 }
 
 void SEChannel::transmitManualAnswer(unsigned char *buffer, unsigned int length, int error, const EventSEChannelTransmitPtr &event) {
+       SEUtil util;
        if (error != 0) {
                event->setResult(false);
-               if (error == -4)
-                       event->setError(DeviceAPI::Common::JSTizenException::INVALID_VALUES_ERROR);
-               else
-                       event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setError(util.getErrorString(error));
+               event->setErrorMessage(util.getErrorMessage(error));
        } else {
                event->setResult(true);
-               SEUtil util;
                event->setResponse(util.toVector(buffer, length));
        }
        EventRequestReceiver<EventSEChannelTransmit>::ManualAnswer(event);
@@ -124,7 +122,8 @@ void SEChannel::OnRequestReceived(const EventSEChannelTransmitPtr& event) {
        } catch (const WrtDeviceApis::Commons::Exception& ex) {
                LogError("Exception: " << ex.GetMessage());
                event->setResult(false);
-       
+               event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setErrorMessage("Unknown Error");
                EventRequestReceiver<EventSEChannelTransmit>::ManualAnswer(event);
        }       
 }
index 39616c0..d262592 100755 (executable)
 #include <CommonsJavaScript/Validator.h>
 #include <CommonsJavaScript/JSUtils.h>
 #include "SEConverter.h"
+#include <JSWebAPIError.h>
+#include <TizenExceptionData.h>
 
 using namespace std;
 using namespace WrtDeviceApis::CommonsJavaScript;
 using namespace WrtDeviceApis;
+using namespace DeviceAPI::Common;
 
 #define SE_LISTENER_ONSEREADY "onSEReady"
 #define SE_LISTENER_ONSENOTREADY "onSENotReady"
@@ -90,5 +93,16 @@ SEListener SEConverter::toSEListener(const JSValueRef& arg) {
        return result;
 }
 
+JSValueRef SEConverter::makeSeErrorObject(std::string error, std::string message) {
+       int code = JSWebAPIError::UNKNOWN_ERR;
+       if (error.compare("InvalidStateError") == 0)
+               code = JSWebAPIError::INVALID_STATE_ERR;
+       else
+               code = JSWebAPIError::convertToWebAPIErrorCode(error);
+
+       JSWebAPIError::PrivateObject::ObjectType data(new TizenExceptionData(code, error, message));
+       return JSUtils::makeObject(m_context, JSWebAPIError::getClassRef(), data);
+}
+
 }
 }
index 58a0f5e..286f58e 100755 (executable)
@@ -39,6 +39,8 @@ class SEConverter : public WrtDeviceApis::CommonsJavaScript::Converter
 
        JSValueRef toJSValueRef(const std::vector<unsigned char>& arg);
        SEListener toSEListener(const JSValueRef& arg);
+
+       JSValueRef makeSeErrorObject(std::string error, std::string message);
 };
 
 typedef WrtDeviceApis::CommonsJavaScript::ConverterFactory<SEConverter> SEConverterFactory;
index 60c1b5e..435caf4 100755 (executable)
@@ -20,7 +20,7 @@
 #include <dpl/log/log.h>
 
 #include <Commons/Exception.h>
-
+#include <JSTizenException.h>
 #include "SEReader.h"
 #include "SEUtil.h"
 
@@ -85,8 +85,15 @@ void SEReader::closeSessions() {
 }
 
 void SEReader::openSessionManualAnswer(void *session, int error, const EventSEOpenSessionPtr &event) {
-       if ((error != 0) || session == NULL) {
+       SEUtil util;
+       if (error != SCARD_ERROR_OK) {
+               event->setResult(false);
+               event->setError(util.getErrorString(error));
+               event->setErrorMessage(util.getErrorMessage(error));
+       } else if (session == NULL) {
                event->setResult(false);
+               event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setErrorMessage("Unknown Error");
        } else {
                event->setSession(session);
                event->setResult(true);
@@ -116,7 +123,8 @@ void SEReader::OnRequestReceived(const EventSEOpenSessionPtr& event) {
        } catch (const WrtDeviceApis::Commons::Exception& ex) {
                LogError("Exception: " << ex.GetMessage());
                event->setResult(false);
-       
+               event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setErrorMessage("Unknown Error");
                EventRequestReceiver<EventSEOpenSession>::ManualAnswer(event);
        }
 }
index e59f233..99ddad7 100644 (file)
@@ -88,7 +88,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event)
        SEAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm);
 
        JSContextRef context = cbm->getContext();
-
+       SEConverter convert(context);
        if (event->getResult()) {
                LogDebug("result success");
                std::vector<void *> readers = event->getListSEs();
@@ -96,19 +96,12 @@ void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event)
                for (std::size_t i = 0; i < readers.size(); i++)
                        ListSes.push_back(JSSEReader::createJSObject(context, readers[i]));
 
-               Converter convert(context);
                cbm->callOnSuccess(convert.toJSValueRef(ListSes));
                return;
        }
        LogDebug("result fail");
 
-       std::string error = event->getError();
-       JSValueRef errorObject = NULL;
-       if (error != "")
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, error);
-       else
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-       cbm->callOnError(errorObject);
+       cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage()));
 }
 
 void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenSessionPtr &event)
@@ -124,23 +117,16 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenSessionPtr &event)
        SEAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm);
 
        JSContextRef context = cbm->getContext();
+       SEConverter convert(context);
 
        if (event->getResult()) {
                LogDebug("result success");
-
-               Converter convert(context);
                cbm->callOnSuccess(convert.toJSValueRef(JSSESession::createJSObject(context, event->getSession())));
                return;
        }
        LogDebug("result fail");
 
-       std::string error = event->getError();
-       JSValueRef errorObject = NULL;
-       if (error != "")
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, error);
-       else
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-       cbm->callOnError(errorObject);
+       cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage()));
 }
 
 
@@ -157,23 +143,16 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenChannelPtr &event)
        SEAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm);
 
        JSContextRef context = cbm->getContext();
+       SEConverter convert(context);
 
        if (event->getResult()) {
                LogDebug("result success");
-
-               Converter convert(context);
                cbm->callOnSuccess(convert.toJSValueRef(JSSEChannel::createJSObject(context, event->getChannel())));
                return;
        }
        LogDebug("result fail");
 
-       std::string error = event->getError();
-       JSValueRef errorObject = NULL;
-       if (error != "")
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, error);
-       else
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-       cbm->callOnError(errorObject);
+       cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage()));
 }
 
 void SEResponseDispatcher::OnAnswerReceived(const EventSEChannelTransmitPtr &event)
@@ -189,27 +168,16 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEChannelTransmitPtr &eve
        SEAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm);
 
        JSContextRef context = cbm->getContext();
+       SEConverter convert(context);
 
        if (event->getResult()) {
                LogDebug("result success");
-
-               SEConverter convert(context);
                cbm->callOnSuccess(convert.toJSValueRef(event->getResponse()));
                return;
        }
        LogDebug("result fail");
 
-       std::string error = event->getError();
-       JSValueRef errorObject = NULL;
-
-       if (error == JSTizenException::INVALID_VALUES_ERROR)
-               cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR,"Invalid APDU command"));
-       else if (error != "")
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), error, error);
-       else
-               errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error");
-       
-       cbm->callOnError(errorObject);
+       cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage()));
 }
 
 }
index 6748b78..5ecf8e8 100755 (executable)
@@ -21,7 +21,7 @@
 #include <dpl/log/log.h>
 
 #include <Commons/Exception.h>
-
+#include <JSTizenException.h>
 #include "SESession.h"
 #include "SEUtil.h"
 
@@ -94,8 +94,15 @@ void SESession::openChannel(const EventSEOpenChannelPtr& event) {
 
 
 void SESession::openChannelManualAnswer(void * channel, int error, const EventSEOpenChannelPtr &event) {
-       if ((error != 0) || channel == NULL) {
+       SEUtil util;
+       if (error != SCARD_ERROR_OK) {
                event->setResult(false);
+               event->setError(util.getErrorString(error));
+               event->setErrorMessage(util.getErrorMessage(error));
+       } else if (channel == NULL) {
+               event->setResult(false);
+               event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setErrorMessage("Unknown Error");
        } else {
                event->setChannel(channel);
                event->setResult(true);
@@ -133,7 +140,8 @@ void SESession::OnRequestReceived(const EventSEOpenChannelPtr& event) {
        } catch (const WrtDeviceApis::Commons::Exception& ex) {
                LogError("Exception: " << ex.GetMessage());
                event->setResult(false);
-       
+               event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR);
+               event->setErrorMessage("Unknown Error");
                EventRequestReceiver<EventSEOpenChannel>::ManualAnswer(event);
        }
 }
index cba5c56..d9ec214 100755 (executable)
@@ -19,7 +19,8 @@
 
 #include "SEUtil.h"
 #include <dpl/log/log.h>
-
+#include <JSTizenException.h>
+#include <smartcard-types.h>
 
 namespace DeviceAPI {
 namespace SecureElement {
@@ -48,5 +49,62 @@ unsigned char *SEUtil::toCharPtr(std::vector<unsigned char> vec) {
        return NULL;
 }
 
+std::string SEUtil::getErrorString(const int errorCode) {
+       LogDebug ("Errorcode : " << errorCode);
+       switch(errorCode) {
+               case SCARD_ERROR_OK:
+                       return "";
+               case SCARD_ERROR_NOT_ENOUGH_RESOURCE:
+                       return "NoChannelError";
+               case SCARD_ERROR_OUT_OF_MEMORY:
+               case SCARD_ERROR_UNAVAILABLE:
+               case SCARD_ERROR_IPC_FAILED:
+               case SCARD_ERROR_OPERATION_TIMEOUT:
+               case SCARD_ERROR_UNKNOWN:
+                       return DeviceAPI::Common::JSTizenException::IO_ERROR;
+               case SCARD_ERROR_ILLEGAL_STATE:
+               case SCARD_ERROR_ILLEGAL_REFERENCE:
+                       return "InvalidStateError";
+               case SCARD_ERROR_ILLEGAL_PARAM:
+                       return DeviceAPI::Common::JSTizenException::INVALID_VALUES_ERROR;
+               case SCARD_ERROR_SECURITY_NOT_ALLOWED:
+                       return DeviceAPI::Common::JSTizenException::PERMISSION_DENIED_ERROR;
+               case SCARD_ERROR_IO_FAILED:
+                       return DeviceAPI::Common::JSTizenException::NOT_FOUND_ERROR;
+       }
+       return DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR;
+}
+
+std::string SEUtil::getErrorMessage(const int errorCode) {
+       LogDebug ("Errorcode : " << errorCode);
+       switch(errorCode) {
+               case SCARD_ERROR_OK:
+                       return "";
+               case SCARD_ERROR_NOT_ENOUGH_RESOURCE:
+                       return "Not Enough Resource";
+               case SCARD_ERROR_OUT_OF_MEMORY:
+                       return "Out Of Memory";
+               case SCARD_ERROR_UNAVAILABLE:
+                       return "Unavailable";
+               case SCARD_ERROR_IPC_FAILED:
+                       return "Platform Error";
+               case SCARD_ERROR_OPERATION_TIMEOUT:
+                       return "Operation Timeout";
+               case SCARD_ERROR_UNKNOWN:
+                       return "Unknown Error";
+               case SCARD_ERROR_ILLEGAL_STATE:
+                       return "Illegal state";
+               case SCARD_ERROR_ILLEGAL_REFERENCE:
+                       return "Illegal reference";
+               case SCARD_ERROR_ILLEGAL_PARAM:
+                       return "Illegal param";
+               case SCARD_ERROR_SECURITY_NOT_ALLOWED:
+                       return "Security Not Allowed";
+               case SCARD_ERROR_IO_FAILED:
+                       return "Not Exist In SE";
+       }
+       return "UnknownError";
+}
+
 }
 }
index 47d8c2e..f0b0498 100755 (executable)
@@ -21,6 +21,7 @@
 #define _SEUTIL_H_
 
 #include <vector>
+#include <string>
 
 namespace DeviceAPI {
 namespace SecureElement {
@@ -33,6 +34,8 @@ class SEUtil
        virtual  ~SEUtil() {}
        std::vector<unsigned char> toVector(const unsigned char *ch, const int size);
        unsigned char *toCharPtr(std::vector<unsigned char> vec) ;
+       std::string getErrorString(const int errorCode);
+       std::string getErrorMessage(const int errorCode);
 };
 
 }
index 73c18a7..74306aa 100755 (executable)
@@ -8,6 +8,11 @@
     <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
 
     <api-feature>
+        <name>http://tizen.org/privilege/secureelement</name>
+        <device-capability>secureelement</device-capability>
+    </api-feature>
+
+    <api-feature>
         <name>http://tizen.org/privilege/se</name>
         <device-capability>se</device-capability>
     </api-feature>
diff --git a/src/SecureElement/plugin_config.cpp b/src/SecureElement/plugin_config.cpp
new file mode 100755 (executable)
index 0000000..aee0428
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+
+
+#include <map>
+#include <utility>
+#include <Commons/FunctionDefinition.h>
+#include <Commons/FunctionDeclaration.h>
+#include <Commons/Exception.h>
+
+#include "plugin_config.h"
+
+#define SECUREELEMENT_FEATURE_API_SECUREELEMENT "http://tizen.org/privilege/secureelement"
+#define SECUREELEMENT_FEATURE_API_SE "http://tizen.org/privilege/se"
+
+#define SECUREELEMENT_DEVICE_CAP_SECUREELEMENT "secureelement"
+#define SECUREELEMENT_DEVICE_CAP_SE "se"
+
+namespace DeviceAPI {
+namespace SecureElement {
+
+static WrtDeviceApis::Commons::FunctionMapping createSecureElementFunctions();
+
+static WrtDeviceApis::Commons::FunctionMapping SecureElementFunctions =
+    createSecureElementFunctions();
+
+DEFINE_FUNCTION_GETTER(SecureElement, SecureElementFunctions);
+
+static WrtDeviceApis::Commons::FunctionMapping createSecureElementFunctions()
+{
+    using namespace WrtDeviceApis::Commons;
+
+    /**
+     * Device capabilities
+     */
+    ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SECUREELEMENT, SECUREELEMENT_DEVICE_CAP_SECUREELEMENT);
+       ACE_CREATE_DEVICE_CAP(DEVICE_CAP_SE, SECUREELEMENT_DEVICE_CAP_SE);
+
+    ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_SECUREELEMENT);
+    ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECUREELEMENT, DEVICE_CAP_SECUREELEMENT);
+       ACE_ADD_DEVICE_CAP(DEVICE_LIST_SECUREELEMENT, DEVICE_CAP_SE);
+
+    /**
+     * API features
+     */
+    ACE_CREATE_FEATURE(FEATURE_SECUREELEMENT, SECUREELEMENT_FEATURE_API_SECUREELEMENT);
+       ACE_CREATE_FEATURE(FEATURE_SE, SECUREELEMENT_FEATURE_API_SE);
+
+    ACE_CREATE_FEATURE_LIST(SECUREELEMENT_FEATURES_SECUREELEMENT);
+    ACE_ADD_API_FEATURE(SECUREELEMENT_FEATURES_SECUREELEMENT, FEATURE_SECUREELEMENT);
+       ACE_ADD_API_FEATURE(SECUREELEMENT_FEATURES_SECUREELEMENT, FEATURE_SE);
+
+    /**
+     * Functions
+     */
+
+    FunctionMapping SecureElementFunctions;
+
+       AceFunction seFunctions = ACE_CREATE_FUNCTION(
+            FUNCTION_SECUREELEMENT_FUNCTIONS,
+            SECUREELEMENT_FUNCTION_API_FUNCS,
+            SECUREELEMENT_FEATURES_SECUREELEMENT,
+            DEVICE_LIST_SECUREELEMENT);
+
+    SecureElementFunctions.insert(std::make_pair(
+                               SECUREELEMENT_FUNCTION_API_FUNCS,
+                               seFunctions));
+
+    return SecureElementFunctions;
+}
+} 
+} 
+
+#undef SECUREELEMENT_FEATURE_API_SE
+#undef SECUREELEMENT_FEATURE_API_SECUREELEMENT
+#undef SECUREELEMENT_DEVICE_CAP_SE
+#undef SECUREELEMENT_DEVICE_CAP_SECUREELEMENT
\ No newline at end of file
diff --git a/src/SecureElement/plugin_config.h b/src/SecureElement/plugin_config.h
new file mode 100755 (executable)
index 0000000..1507058
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ */
+
+
+#ifndef _SECUREELEMENT_PLUGIN_CONFIG_H_
+#define _SECUREELEMENT_PLUGIN_CONFIG_H_
+
+#include <Commons/FunctionDeclaration.h>
+
+namespace DeviceAPI {
+namespace SecureElement {
+
+#define SECUREELEMENT_FUNCTION_API_FUNCS "SecureElementFunctions"
+
+DECLARE_FUNCTION_GETTER(SecureElement);
+
+#define SECURE_ELEMENT_CHECK_ACCESS(functionName)                       \
+    aceCheckAccess<AceFunctionGetter, DefaultArgsVerifier<> >(                \
+        getSecureElementFunctionData,             \
+        functionName)
+}
+}
+
+#endif //  _SECUREELEMENT_PLUGIN_CONFIG_H_
\ No newline at end of file
index 9447e0f..b804699 100755 (executable)
@@ -1379,6 +1379,8 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Network) {
                 Network->networkType= "2.5";
             } else if (networkType == VCONFKEY_TELEPHONY_SVCTYPE_3G || networkType == VCONFKEY_TELEPHONY_SVCTYPE_HSDPA) {
                 Network->networkType= "3G";
+            } else if (networkType == VCONFKEY_TELEPHONY_SVCTYPE_LTE) {
+                Network->networkType= "4G";
             } else {
                 Network->networkType= "NONE";
             }
@@ -1446,8 +1448,8 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) {
     int plmn = 0, cellid = 0, lac = 0, isRoaming = 0, isFlightMode = 0;
 
     if (vconf_get_int(VCONFKEY_TELEPHONY_PLMN, &plmn) == 0) {
-        cellularNetwork->mcc = plmn / 1000;
-        cellularNetwork->mnc = plmn % 1000;
+        cellularNetwork->mcc = plmn / 100;
+        cellularNetwork->mnc = plmn % 100;
     }
     
     if (vconf_get_int(VCONFKEY_TELEPHONY_CELLID, &cellid) == 0) {
index 664bf5a..e16fe4b 100644 (file)
 #include "JSFeatureParam.h"
 
 
-namespace DeviceAPI {\rnamespace Tizen {
+namespace DeviceAPI {
+namespace Tizen {
 
 namespace {
     const char* PLUGIN_NAME = "Feature";
     const char* ATTRIBUTE_URI = "uri";
-    const char* ATTRIBUTE_REQUIRED = "required";
-    const char* ATTRIBUTE_PARAMS = "params";
 }
 
 JSClassDefinition JSFeature::m_classInfo =
@@ -61,8 +60,6 @@ JSClassDefinition JSFeature::m_classInfo =
 
 JSStaticValue JSFeature::m_properties[] = {
     { ATTRIBUTE_URI, getProperty, NULL, kJSPropertyAttributeReadOnly },
-    { ATTRIBUTE_REQUIRED, getProperty, NULL, kJSPropertyAttributeReadOnly },
-    { ATTRIBUTE_PARAMS, getProperty, NULL, kJSPropertyAttributeReadOnly },
     { 0, 0, 0, 0 }
 };
 
@@ -112,34 +109,6 @@ JSValueRef JSFeature::getProperty(JSContextRef context, JSObjectRef object,
         if (JSStringIsEqualToUTF8CString(propertyName, ATTRIBUTE_URI)) {
             return converter.toJSValueRef(priv->getObject()->getName() );
         }
-        else if (JSStringIsEqualToUTF8CString(propertyName, ATTRIBUTE_REQUIRED)) {
-            if (priv->getObject()->isRequestedByWidget()) {
-                return converter.toJSValueRef(priv->getObject()->isRequired() );
-            }
-            return JSValueMakeNull(context);
-        }
-        else if (JSStringIsEqualToUTF8CString(propertyName, ATTRIBUTE_PARAMS)) {
-            if (priv->getObject()->isRequestedByWidget()) {
-                JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
-                if (jsResult) {
-                    WrtDeviceApis::WidgetDB::Api::IWidgetFeature::Params params =
-                        priv->getObject()->getParams();
-                    WrtDeviceApis::WidgetDB::Api::IWidgetFeature::ParamsIterator it =
-                        params.begin();
-                    size_t i = 0;
-                    for (; it != params.end(); ++it, ++i) {
-                        std::pair<std::string, std::string> param = make_pair(it->first, it->second);
-                        JSFeatureParamPrivObject *priv = new JSFeatureParamPrivObject(context, param);
-                        JSObjectRef tempVal = JSObjectMake(context, JSFeatureParam::getClassRef(), priv);
-                        bool result = JSSetArrayElement(context, jsResult, i, tempVal);
-                        if(result == false)
-                               continue;
-                    }
-                    return jsResult;
-                }
-            }
-            return JSValueMakeNull(context);
-        }
     }
     Catch(WrtDeviceApis::Commons::Exception)
     {