From f39631eec68093eb85a63ae38af1ae42dd35bc57 Mon Sep 17 00:00:00 2001 From: Dongjin Choi Date: Tue, 23 Apr 2013 19:37:35 +0900 Subject: [PATCH] wrt-plugins-tizen_0.4.23 --- packaging/wrt-plugins-tizen.spec | 4 +- src/Alarm/AlarmAbsolute.cpp | 5 +- src/Alarm/AlarmAbsolute.h | 1 - src/Alarm/AlarmConverter.cpp | 35 +- src/Alarm/AlarmConverter.h | 1 - src/Alarm/AlarmRelative.cpp | 7 +- src/Alarm/AlarmRelative.h | 1 - src/Alarm/CMakeLists.txt | 0 src/Alarm/JSAlarmAbsolute.cpp | 15 +- src/Alarm/JSAlarmManager.cpp | 52 +- src/Alarm/JSAlarmRelative.cpp | 11 +- src/Alarm/plugin_initializer.cpp | 11 +- src/Application/AppManagerWrapper.cpp | 62 +-- src/Application/Application.cpp | 23 +- src/Application/Application.h | 1 - src/Application/ApplicationCert.h | 1 - src/Application/ApplicationContext.h | 1 - src/Application/ApplicationControl.cpp | 14 +- src/Application/ApplicationControl.h | 1 - src/Application/ApplicationControlData.cpp | 5 +- src/Application/ApplicationControlData.h | 1 - src/Application/ApplicationController.cpp | 78 +-- src/Application/ApplicationController.h | 1 - src/Application/ApplicationConverter.cpp | 13 +- src/Application/ApplicationInformation.h | 1 - src/Application/ApplicationListenerManager.h | 12 +- src/Application/ApplicationManager.cpp | 322 ++++++------ src/Application/ApplicationManager.h | 12 +- src/Application/CMakeLists.txt | 0 src/Application/EventApplicationFindAppControl.h | 3 +- src/Application/JSApplication.cpp | 18 +- src/Application/JSApplicationCert.cpp | 10 +- src/Application/JSApplicationContext.cpp | 11 +- src/Application/JSApplicationControl.cpp | 23 +- src/Application/JSApplicationControlData.cpp | 15 +- .../JSApplicationEventCallbackManager.cpp | 16 +- src/Application/JSApplicationInformation.cpp | 13 +- src/Application/JSApplicationManager.cpp | 50 +- src/Application/JSRequestedApplicationControl.cpp | 38 +- src/Application/RequestedApplicationControl.cpp | 22 +- src/Application/RequestedApplicationControl.h | 1 - src/Application/plugin_initializer.cpp | 15 +- src/Bluetooth/BluetoothAdapter.cpp | 332 ++++++------ src/Bluetooth/BluetoothCallbackUtil.cpp | 18 +- src/Bluetooth/BluetoothClass.cpp | 12 +- src/Bluetooth/BluetoothClassDeviceMajor.cpp | 10 +- src/Bluetooth/BluetoothClassDeviceMinor.cpp | 10 +- src/Bluetooth/BluetoothClassDeviceService.cpp | 12 +- src/Bluetooth/BluetoothDevice.cpp | 22 +- src/Bluetooth/BluetoothServiceHandler.cpp | 14 +- src/Bluetooth/BluetoothSocket.cpp | 54 +- src/Bluetooth/JSBluetoothAdapter.cpp | 60 +-- src/Bluetooth/JSBluetoothClass.cpp | 6 +- src/Bluetooth/JSBluetoothClassDeviceMajor.cpp | 6 +- src/Bluetooth/JSBluetoothClassDeviceMinor.cpp | 6 +- src/Bluetooth/JSBluetoothClassDeviceService.cpp | 6 +- src/Bluetooth/JSBluetoothDevice.cpp | 8 +- src/Bluetooth/JSBluetoothManager.cpp | 10 +- src/Bluetooth/JSBluetoothServiceHandler.cpp | 18 +- src/Bluetooth/JSBluetoothSocket.cpp | 22 +- src/Bluetooth/plugin_initializer.cpp | 12 +- src/Bookmark/BookmarkManager.cpp | 56 +-- src/Bookmark/JSBookmarkFolder.cpp | 18 +- src/Bookmark/JSBookmarkItem.cpp | 14 +- src/Bookmark/JSBookmarkManager.cpp | 23 +- src/Bookmark/plugin_initializer.cpp | 16 +- src/CMakeLists.txt | 3 +- src/Calendar/Calendar.cpp | 193 ++++--- src/Calendar/CalendarConverter.cpp | 62 ++- src/Calendar/CalendarEvent.cpp | 61 ++- src/Calendar/CalendarFilter.cpp | 98 ++-- src/Calendar/CalendarFilter.h | 1 + src/Calendar/CalendarFilterConverter.cpp | 4 +- src/Calendar/CalendarListenerManager.h | 8 +- src/Calendar/CalendarManager.cpp | 78 +-- src/Calendar/CalendarResponseDispatcher.cpp | 37 +- src/Calendar/CalendarUtility.cpp | 22 +- src/Calendar/EventAlarm.cpp | 2 +- src/Calendar/EventAttendee.cpp | 3 +- src/Calendar/EventRecurrenceRule.cpp | 8 +- src/Calendar/EventWrapper.cpp | 417 ++++++++------- src/Calendar/ICalendar.cpp | 1 + src/Calendar/ICalendar.h | 1 - src/Calendar/JSCalendar.cpp | 134 +++-- src/Calendar/JSCalendarAlarm.cpp | 26 +- src/Calendar/JSCalendarAttendee.cpp | 22 +- src/Calendar/JSCalendarEvent.cpp | 54 +- src/Calendar/JSCalendarEventId.cpp | 21 +- src/Calendar/JSCalendarItemProperties.cpp | 118 +++-- src/Calendar/JSCalendarManager.cpp | 48 +- src/Calendar/JSCalendarRecurrenceRule.cpp | 28 +- src/Calendar/JSCalendarTask.cpp | 28 +- src/Calendar/plugin_initializer.cpp | 16 +- src/Callhistory/CallHistory.cpp | 92 ++-- src/Callhistory/CallHistoryEntry.cpp | 12 +- src/Callhistory/CallHistoryFilter.cpp | 26 +- src/Callhistory/CallHistoryFilterConverter.cpp | 5 +- src/Callhistory/CallHistoryListenerManager.h | 6 +- src/Callhistory/CallHistoryStaticController.cpp | 4 +- src/Callhistory/Converter.cpp | 8 +- src/Callhistory/JSCallHistoryEntry.cpp | 3 +- src/Callhistory/JSRemoteParty.cpp | 3 +- src/Callhistory/ResponseDispatcher.cpp | 5 +- src/Callhistory/plugin_initializer.cpp | 15 +- src/Common/ArgumentValidator.cpp | 4 - src/Common/AsyncCallbackManager.h | 12 +- src/Common/CallbackUserData.cpp | 5 - src/Common/GlobalContextManager.cpp | 16 +- src/Common/IListenerManager.h | 20 +- src/Common/JSArray.cpp | 2 +- src/Common/JSTizenException.cpp | 8 +- src/Common/JSTizenExceptionFactory.cpp | 7 +- src/Common/JSWebAPIError.cpp | 16 +- src/Common/JSWebAPIError2.cpp | 11 +- src/Common/JSWebAPIErrorFactory.cpp | 4 +- src/Common/JSWebAPIException.cpp | 16 +- src/Common/Logger.h | 26 +- src/Common/StandaloneConsole/JSConsole.cpp | 2 +- src/Common/StandaloneConsole/StandaloneConsole.cpp | 8 +- src/Contact/AddressBook.cpp | 251 +++++---- src/Contact/AddressBookController.cpp | 72 +-- src/Contact/AddressBookController.h | 1 - src/Contact/Contact.cpp | 9 +- src/Contact/ContactConverter.cpp | 49 +- src/Contact/ContactFilterConverter.cpp | 7 +- src/Contact/ContactListenerManager.h | 14 +- src/Contact/ContactManager.cpp | 155 +++--- src/Contact/ContactManagerController.cpp | 70 +-- src/Contact/ContactObjectA2PConverter.cpp | 139 ++--- src/Contact/ContactObjectP2AConverter.cpp | 41 +- src/Contact/ContactQueue.cpp | 29 +- src/Contact/ContactRef.cpp | 1 + src/Contact/ContactRef.h | 1 - src/Contact/ContactSearchEngine.cpp | 35 +- src/Contact/ContactsSvcChangeListenerManager.cpp | 96 ++-- src/Contact/ContactsSvcObjectConverter.cpp | 18 +- src/Contact/ContactsSvcWrapper.cpp | 35 +- src/Contact/IAddressBook.cpp | 5 +- src/Contact/IAddressBook.h | 1 - src/Contact/IContact.h | 1 - src/Contact/IPerson.cpp | 2 +- src/Contact/IPerson.h | 1 - src/Contact/JSAddressBook.cpp | 140 +++--- src/Contact/JSAddressBookArray.cpp | 28 +- src/Contact/JSAddressBookChangeCallbackManager.cpp | 16 +- src/Contact/JSAttributesOfInterestArray.cpp | 62 +-- src/Contact/JSContact.cpp | 106 ++-- src/Contact/JSContactAddress.cpp | 43 +- src/Contact/JSContactAddressArray.cpp | 28 +- src/Contact/JSContactAddressTypeArray.cpp | 28 +- src/Contact/JSContactAnniversary.cpp | 17 +- src/Contact/JSContactAnniversaryArray.cpp | 28 +- src/Contact/JSContactArray.cpp | 28 +- src/Contact/JSContactEmailAddress.cpp | 19 +- src/Contact/JSContactEmailAddressArray.cpp | 28 +- src/Contact/JSContactEmailAddressTypeArray.cpp | 28 +- src/Contact/JSContactGroup.cpp | 31 +- src/Contact/JSContactGroupArray.cpp | 28 +- src/Contact/JSContactManager.cpp | 120 ++--- .../JSContactManagerChangeCallbackManager.cpp | 16 +- src/Contact/JSContactName.cpp | 46 +- src/Contact/JSContactOrganization.cpp | 31 +- src/Contact/JSContactOrganizationArray.cpp | 28 +- src/Contact/JSContactPhoneNumber.cpp | 20 +- src/Contact/JSContactPhoneNumberArray.cpp | 28 +- src/Contact/JSContactPhoneNumberTypeArray.cpp | 28 +- src/Contact/JSContactRef.cpp | 22 +- src/Contact/JSContactWebSite.cpp | 15 +- src/Contact/JSContactWebSiteArray.cpp | 28 +- src/Contact/JSPerson.cpp | 48 +- src/Contact/JSPersonArray.cpp | 28 +- src/Contact/JSStringArray.cpp | 26 +- src/Contact/Person.cpp | 35 +- src/Contact/PersonSearchEngine.cpp | 3 +- src/Contact/plugin_initializer.cpp | 15 +- src/Content/AudioLyrics.cpp | 3 +- src/Content/AudioLyricsUtil.cpp | 29 +- src/Content/ContentAudio.cpp | 3 +- src/Content/ContentController.cpp | 28 +- src/Content/ContentConverter.cpp | 8 +- src/Content/ContentFilterConverter.cpp | 7 +- src/Content/ContentFilterValidator.cpp | 7 +- src/Content/ContentFolder.cpp | 13 +- src/Content/ContentImage.cpp | 18 +- src/Content/ContentListener.cpp | 13 +- src/Content/ContentManager.cpp | 216 ++++---- src/Content/ContentMedia.cpp | 28 +- src/Content/ContentSearchVisitor.cpp | 6 +- src/Content/ContentVideo.cpp | 19 +- src/Content/IContentManager.cpp | 29 +- src/Content/IContentManager.h | 3 - src/Content/IEventUpdate.h | 5 +- src/Content/IEventUpdateBatch.h | 3 +- src/Content/JSAudio.cpp | 84 ++-- src/Content/JSAudioLyrics.cpp | 29 +- src/Content/JSContent.cpp | 93 ++-- src/Content/JSContentManager.cpp | 76 ++- src/Content/JSFolder.cpp | 38 +- src/Content/JSImage.cpp | 46 +- src/Content/JSVideo.cpp | 53 +- src/Content/plugin_initializer.cpp | 16 +- src/DataControl/DataControlConverter.cpp | 9 +- src/DataControl/DataControlConverter.h | 2 - src/DataControl/DataControlListener.cpp | 17 +- src/DataControl/EventAddValue.h | 3 +- src/DataControl/EventDelete.h | 4 +- src/DataControl/EventGetIndexedRow.h | 3 +- src/DataControl/EventGetValue.h | 3 +- src/DataControl/EventInsert.h | 3 +- src/DataControl/EventRemoveValue.h | 5 +- src/DataControl/EventSelect.h | 3 +- src/DataControl/EventUpdate.h | 4 +- src/DataControl/EventUpdateValue.h | 3 +- src/DataControl/JSDataControlManager.cpp | 47 +- src/DataControl/JSMappedDataControlConsumer.cpp | 131 ++++- src/DataControl/JSSQLDataControlConsumer.cpp | 138 ++++- src/DataControl/JSSelectObjectArrayValues.cpp | 24 +- src/DataControl/MappedDataControlConsumer.cpp | 60 +-- src/DataControl/RowData.h | 3 +- src/DataControl/SelectDataObject.cpp | 28 +- src/DataControl/SqlDataControlConsumer.cpp | 62 +-- src/DataControl/plugin_initializer.cpp | 14 +- src/DataSync/DataSyncConverter.cpp | 15 +- src/DataSync/DataSyncListenerManager.h | 8 +- src/DataSync/DataSyncManager.cpp | 166 +++--- src/DataSync/DataSyncResponseDispatcher.cpp | 19 +- src/DataSync/JSDataSyncManager.cpp | 150 +++--- src/DataSync/JSSyncInfo.cpp | 30 +- src/DataSync/JSSyncProfileInfo.cpp | 28 +- src/DataSync/JSSyncServiceInfo.cpp | 29 +- src/DataSync/JSSyncStatistics.cpp | 14 +- src/DataSync/plugin_initializer.cpp | 16 +- src/Download/DownloadCallback.cpp | 60 +-- src/Download/DownloadManager.cpp | 50 +- src/Download/JSDownloadManager.cpp | 32 +- src/Download/JSDownloadRequest.cpp | 147 +++--- src/Download/JSDownloadRequest.h | 5 - src/Download/plugin_initializer.cpp | 12 +- src/Filesystem/Converter.cpp | 2 +- src/Filesystem/FilesystemListenerManager.h | 6 +- src/Filesystem/FilesystemUtils.cpp | 25 +- src/Filesystem/JSFile.cpp | 142 ++++-- src/Filesystem/JSFilestream.cpp | 8 +- src/Filesystem/JSFilesystemManager.cpp | 114 ++++- src/Filesystem/JSStorage.cpp | 4 +- src/Filesystem/Manager.cpp | 48 +- src/Filesystem/Node.cpp | 27 +- src/Filesystem/Path.cpp | 7 +- src/Filesystem/PathUtils.cpp | 4 +- src/Filesystem/ResponseDispatcher.cpp | 16 +- src/Filesystem/StorageStaticController.cpp | 5 +- src/Filesystem/Stream.cpp | 7 +- src/Filesystem/plugin_initializer.cpp | 11 +- src/Log/CMakeLists.txt | 1 + src/Log/plugin_initializer.cpp | 6 +- src/MessagePort/ILocalMessagePort.cpp | 1 + src/MessagePort/ILocalMessagePort.h | 1 - src/MessagePort/IRemoteMessagePort.cpp | 1 + src/MessagePort/IRemoteMessagePort.h | 1 - src/MessagePort/JSLocalMessagePort.cpp | 23 +- src/MessagePort/JSMessagePortManager.cpp | 35 +- src/MessagePort/JSRemoteMessagePort.cpp | 13 +- src/MessagePort/LocalMessagePort.cpp | 19 +- src/MessagePort/LocalMessagePort.h | 1 - src/MessagePort/LocalMessagePortController.cpp | 21 +- src/MessagePort/LocalMessagePortController.h | 1 - src/MessagePort/MessagePortJSUtil.cpp | 11 +- src/MessagePort/MessagePortListenerManager.h | 8 +- src/MessagePort/MessagePortManager.cpp | 40 +- src/MessagePort/MessagePortManagerProxy.cpp | 25 +- src/MessagePort/MessagePortManagerProxy.h | 0 src/MessagePort/MessagePortUtility.cpp | 4 +- src/MessagePort/RemoteMessagePort.cpp | 3 +- src/MessagePort/RemoteMessagePort.h | 1 - src/MessagePort/plugin_initializer.cpp | 15 +- src/Messaging/Attachment.cpp | 27 +- src/Messaging/AttachmentFactory.cpp | 78 +-- src/Messaging/Attachments.cpp | 36 +- src/Messaging/BinarySms.cpp | 12 +- src/Messaging/CallbackMgr.cpp | 36 +- src/Messaging/CallbackNumber.cpp | 4 +- src/Messaging/Conversation.cpp | 141 +++--- src/Messaging/ConversationFilterValidator.cpp | 11 +- src/Messaging/ConversationQueryGenerator.cpp | 10 +- src/Messaging/ConverterMessage.cpp | 141 +++--- src/Messaging/ConverterMessage.h | 3 +- src/Messaging/DBus/Connection.cpp | 36 +- src/Messaging/Email.cpp | 166 +++--- src/Messaging/EmailConverter.cpp | 10 +- src/Messaging/EmailService.cpp | 22 +- src/Messaging/EmailUtils.cpp | 11 +- src/Messaging/EmptyMessage.cpp | 13 +- src/Messaging/FolderFilterValidator.cpp | 15 +- src/Messaging/FolderQueryGenerator.cpp | 43 +- src/Messaging/IAttachment.cpp | 27 +- src/Messaging/IBinarySms.cpp | 6 +- src/Messaging/IEmail.cpp | 6 +- src/Messaging/IEmptyMessage.cpp | 6 +- src/Messaging/IMessage.cpp | 28 +- src/Messaging/IMessagingService.cpp | 13 +- src/Messaging/IMessagingService.h | 1 - src/Messaging/IMessagingServiceManager.h | 1 - src/Messaging/IMms.cpp | 6 +- src/Messaging/ISms.cpp | 6 +- src/Messaging/JSConversation.cpp | 17 +- src/Messaging/JSMessage.cpp | 340 ++++++------- src/Messaging/JSMessage.h | 8 +- src/Messaging/JSMessageAttachment.cpp | 116 ++--- src/Messaging/JSMessageBody.cpp | 62 ++- src/Messaging/JSMessageFolder.cpp | 18 +- src/Messaging/JSMessagingService.cpp | 197 ++++---- src/Messaging/JSMessagingServiceManager.cpp | 22 +- src/Messaging/JSMessagingStorage.cpp | 247 ++++----- src/Messaging/JSRecipientArray.cpp | 48 +- src/Messaging/MailSender.cpp | 48 +- src/Messaging/MailSync.cpp | 177 +++---- src/Messaging/MessageFactory.cpp | 52 +- src/Messaging/MessageFilterConverter.cpp | 15 +- src/Messaging/MessageFilterValidator.cpp | 13 +- src/Messaging/MessageListenerManager.h | 10 +- src/Messaging/MessageQueryGenerator.cpp | 147 +++--- src/Messaging/Messaging.cpp | 558 ++++++++++----------- src/Messaging/MessagingController.cpp | 59 +-- src/Messaging/MessagingController.h | 1 - src/Messaging/MessagingListener.cpp | 171 ++++--- src/Messaging/MessagingService.cpp | 67 +-- src/Messaging/MessagingServiceManager.cpp | 43 +- src/Messaging/Mms.cpp | 391 +++++++-------- src/Messaging/MsgServiceHandleMgr.h | 10 +- src/Messaging/Recipient.cpp | 4 +- src/Messaging/ReqReceiverMessage.cpp | 187 +++---- src/Messaging/ScopedMail.h | 10 +- src/Messaging/ScopedMailAttachment.h | 10 +- src/Messaging/ScopedMailbox.h | 10 +- src/Messaging/Sms.cpp | 289 ++++++----- src/Messaging/SourceAddress.cpp | 4 +- .../StorageChangesConversationFilterValidator.cpp | 7 +- .../StorageChangesConversationGenerator.cpp | 279 +++++------ .../StorageChangesFolderFilterValidator.cpp | 7 +- src/Messaging/StorageChangesFolderGenerator.cpp | 209 ++++---- .../StorageChangesMessageFilterValidator.cpp | 7 +- src/Messaging/StorageChangesMessageGenerator.cpp | 358 ++++++------- src/Messaging/SyncNetworkStatus.cpp | 14 +- src/Messaging/ToRecipient.cpp | 4 +- src/Messaging/VirtualMessage.cpp | 2 +- src/Messaging/log.h | 4 +- src/Messaging/messageDB/MessageStorageReader.cpp | 109 ++-- src/Messaging/messageDB/MsgSqliteWrapper.cpp | 106 ++-- src/Messaging/plugin_initializer.cpp | 14 +- src/NFC/JSNFCAdapter.cpp | 97 ++-- src/NFC/JSNFCManager.cpp | 66 ++- src/NFC/JSNFCTag.cpp | 81 ++- src/NFC/JSNFCTarget.cpp | 66 ++- src/NFC/JSNdefMessage.cpp | 77 ++- src/NFC/JSNdefRecord.cpp | 38 +- src/NFC/JSNdefRecordMedia.cpp | 36 +- src/NFC/JSNdefRecordText.cpp | 43 +- src/NFC/JSNdefRecordURI.cpp | 34 +- src/NFC/NFCAdapter.cpp | 32 +- src/NFC/NFCConverter.cpp | 38 +- src/NFC/NFCDefaultAdapter.cpp | 70 +-- src/NFC/NFCListenerManager.h | 14 +- src/NFC/NFCStaticController.cpp | 27 +- src/NFC/NFCTag.cpp | 74 ++- src/NFC/NFCTarget.cpp | 45 +- src/NFC/NFCUtil.cpp | 31 +- src/NFC/NdefMessage.cpp | 27 +- src/NFC/NdefRecord.cpp | 50 +- src/NFC/ResponseDispatcher.cpp | 54 +- src/NFC/plugin_initializer.cpp | 14 +- .../JSNetworkBearerSelection.cpp | 26 +- .../JSNetworkBearerSelectionCallbackManager.cpp | 18 +- .../NetworkBearerSelection.cpp | 119 +++-- .../NetworkBearerSelection.h | 8 + .../NetworkBearerSelectionResponseDispatcher.cpp | 22 +- .../OnNetworkBearerSelectionStateChanged.h | 3 +- src/NetworkBearerSelection/plugin_initializer.cpp | 10 +- src/Notification/JSNotificationDetailInfo.cpp | 4 +- src/Notification/JSNotificationManager.cpp | 14 +- src/Notification/JSStatusNotification.cpp | 64 +-- src/Notification/NotificationDetailInfo.cpp | 190 +------ src/Notification/NotificationLine.cpp | 22 +- src/Notification/NotificationManager.cpp | 88 ++-- src/Notification/StatusNotification.cpp | 292 +++++------ src/Notification/StatusNotification.h | 2 +- src/Notification/plugin_initializer.cpp | 12 +- src/Package/JSPackageInformation.cpp | 13 +- src/Package/JSPackageManager.cpp | 40 +- src/Package/PackageInformation.h | 2 +- src/Package/PackageManager.cpp | 138 ++--- src/Package/PackageManager.h | 3 + src/Package/plugin_initializer.cpp | 14 +- src/Power/JSPowerManager.cpp | 22 +- src/Power/PowerManager.cpp | 29 +- src/Power/plugin_initializer.cpp | 12 +- src/Power/test/main.cpp | 9 +- src/Push/JSPushManager.cpp | 20 +- src/Push/PushManager.cpp | 62 +-- src/Push/config.xml | 0 src/Push/plugin_initializer.cpp | 12 +- src/SecureElement/JSSEChannel.cpp | 45 +- src/SecureElement/JSSEReader.cpp | 41 +- src/SecureElement/JSSEService.cpp | 58 ++- src/SecureElement/JSSESession.cpp | 66 ++- src/SecureElement/SEChannel.cpp | 23 +- src/SecureElement/SEConverter.cpp | 10 +- src/SecureElement/SEListenerManager.h | 6 +- src/SecureElement/SEReader.cpp | 28 +- src/SecureElement/SEResponseDispatcher.cpp | 37 +- src/SecureElement/SEService.cpp | 29 +- src/SecureElement/SESession.cpp | 26 +- src/SecureElement/SEUtil.cpp | 6 +- src/SecureElement/plugin_initializer.cpp | 10 +- src/SecureStorage/JSSecureStorageManager.cpp | 28 +- src/SecureStorage/SecureStorageManager.cpp | 34 +- src/SecureStorage/plugin_initializer.cpp | 12 +- src/SystemSetting/ConverterSystemSetting.cpp | 9 +- src/SystemSetting/ConverterSystemSetting.h | 1 - src/SystemSetting/JSSystemSetting.cpp | 65 ++- src/SystemSetting/SystemSetting.cpp | 106 ++-- .../SystemSettingResponseDispatcher.cpp | 34 +- src/SystemSetting/config.xml | 0 src/SystemSetting/plugin_initializer.cpp | 14 +- src/Systeminfo/BaseProperties.h | 3 +- src/Systeminfo/EventGetSysteminfo.cpp | 6 +- src/Systeminfo/EventWatchSysteminfo.cpp | 57 ++- src/Systeminfo/JSBatteryInfo.cpp | 14 +- src/Systeminfo/JSBuildInfo.cpp | 12 +- src/Systeminfo/JSCellularNetworkInfo.cpp | 14 +- src/Systeminfo/JSCpuInfo.cpp | 14 +- src/Systeminfo/JSDeviceCapabilitiesInfo.cpp | 94 ++-- src/Systeminfo/JSDeviceOrientationInfo.cpp | 12 +- src/Systeminfo/JSDisplayInfo.cpp | 12 +- src/Systeminfo/JSLocaleInfo.cpp | 12 +- src/Systeminfo/JSNetworkInfo.cpp | 12 +- src/Systeminfo/JSPeripheralInfo.cpp | 12 +- src/Systeminfo/JSSIMInfo.cpp | 52 +- src/Systeminfo/JSStorageInfo.cpp | 12 +- src/Systeminfo/JSSysteminfo.cpp | 40 +- src/Systeminfo/JSWifiNetworkInfo.cpp | 14 +- src/Systeminfo/Systeminfo.cpp | 266 +++++----- src/Systeminfo/SysteminfoListener.cpp | 6 +- src/Systeminfo/SysteminfoListenerManager.h | 6 +- src/Systeminfo/SysteminfoPropertyInfo.h | 6 +- src/Systeminfo/plugin_initializer.cpp | 15 +- src/TimeUtil/JSTZDate.cpp | 460 +++++++++-------- src/TimeUtil/JSTimeDuration.cpp | 94 ++-- src/TimeUtil/JSTimeUtil.cpp | 77 ++- src/TimeUtil/TZDate.cpp | 84 ++-- src/TimeUtil/TimeUtil.cpp | 40 +- src/TimeUtil/TimeUtilConverter.cpp | 23 +- src/TimeUtil/TimeUtilTools.cpp | 42 +- src/TimeUtil/plugin_initializer.cpp | 11 +- src/Tizen/AnyFactory.cpp | 7 +- src/Tizen/CMakeLists.txt | 2 - src/Tizen/FilterConverter.cpp | 14 +- src/Tizen/IFilterVisitor.cpp | 2 +- src/Tizen/JSAttributeFilter.cpp | 27 +- src/Tizen/JSAttributeRangeFilter.cpp | 19 +- src/Tizen/JSCompositeFilter.cpp | 24 +- src/Tizen/JSFeature.cpp | 122 ----- src/Tizen/JSFeature.h | 90 ---- src/Tizen/JSFeatureParam.cpp | 126 ----- src/Tizen/JSFeatureParam.h | 90 ---- src/Tizen/JSSimpleCoordinates.cpp | 26 +- src/Tizen/JSSortMode.cpp | 27 +- src/Tizen/JSTizen.cpp | 129 +---- src/Tizen/JSTizen.h | 8 - src/Tizen/plugin_initializer.cpp | 10 +- 469 files changed, 9395 insertions(+), 9834 deletions(-) mode change 100755 => 100644 src/Alarm/AlarmAbsolute.cpp mode change 100755 => 100644 src/Alarm/AlarmConverter.cpp mode change 100755 => 100644 src/Alarm/AlarmRelative.cpp mode change 100755 => 100644 src/Alarm/CMakeLists.txt mode change 100755 => 100644 src/Alarm/JSAlarmAbsolute.cpp mode change 100755 => 100644 src/Alarm/JSAlarmManager.cpp mode change 100755 => 100644 src/Alarm/JSAlarmRelative.cpp mode change 100755 => 100644 src/Application/ApplicationControl.cpp mode change 100755 => 100644 src/Application/ApplicationControlData.cpp mode change 100755 => 100644 src/Application/ApplicationConverter.cpp mode change 100755 => 100644 src/Application/CMakeLists.txt mode change 100755 => 100644 src/Application/JSApplicationEventCallbackManager.cpp mode change 100755 => 100644 src/Application/plugin_initializer.cpp mode change 100755 => 100644 src/Bookmark/BookmarkManager.cpp mode change 100755 => 100644 src/Bookmark/JSBookmarkFolder.cpp mode change 100755 => 100644 src/Bookmark/JSBookmarkItem.cpp mode change 100755 => 100644 src/Bookmark/JSBookmarkManager.cpp mode change 100755 => 100644 src/Bookmark/plugin_initializer.cpp mode change 100755 => 100644 src/Calendar/Calendar.cpp mode change 100755 => 100644 src/Calendar/CalendarConverter.cpp mode change 100755 => 100644 src/Calendar/CalendarEvent.cpp mode change 100755 => 100644 src/Calendar/CalendarFilter.cpp mode change 100755 => 100644 src/Calendar/CalendarListenerManager.h mode change 100755 => 100644 src/Calendar/CalendarManager.cpp mode change 100755 => 100644 src/Calendar/CalendarResponseDispatcher.cpp mode change 100755 => 100644 src/Calendar/CalendarUtility.cpp mode change 100755 => 100644 src/Calendar/EventRecurrenceRule.cpp mode change 100755 => 100644 src/Calendar/EventWrapper.cpp mode change 100755 => 100644 src/Calendar/JSCalendar.cpp mode change 100755 => 100644 src/Calendar/JSCalendarAlarm.cpp mode change 100755 => 100644 src/Calendar/JSCalendarAttendee.cpp mode change 100755 => 100644 src/Calendar/JSCalendarEvent.cpp mode change 100755 => 100644 src/Calendar/JSCalendarEventId.cpp mode change 100755 => 100644 src/Calendar/JSCalendarItemProperties.cpp mode change 100755 => 100644 src/Calendar/JSCalendarManager.cpp mode change 100755 => 100644 src/Calendar/JSCalendarRecurrenceRule.cpp mode change 100755 => 100644 src/Calendar/JSCalendarTask.cpp mode change 100755 => 100644 src/Calendar/plugin_initializer.cpp mode change 100755 => 100644 src/Callhistory/CallHistory.cpp mode change 100755 => 100644 src/Callhistory/CallHistoryEntry.cpp mode change 100755 => 100644 src/Callhistory/CallHistoryFilter.cpp mode change 100755 => 100644 src/Callhistory/CallHistoryListenerManager.h mode change 100755 => 100644 src/Callhistory/CallHistoryStaticController.cpp mode change 100755 => 100644 src/Callhistory/Converter.cpp mode change 100755 => 100644 src/Callhistory/plugin_initializer.cpp mode change 100755 => 100644 src/Contact/AddressBook.cpp mode change 100755 => 100644 src/Contact/AddressBookController.cpp mode change 100755 => 100644 src/Contact/Contact.cpp mode change 100755 => 100644 src/Contact/ContactConverter.cpp mode change 100755 => 100644 src/Contact/ContactListenerManager.h mode change 100755 => 100644 src/Contact/ContactManager.cpp mode change 100755 => 100644 src/Contact/ContactManagerController.cpp mode change 100755 => 100644 src/Contact/ContactObjectA2PConverter.cpp mode change 100755 => 100644 src/Contact/ContactObjectP2AConverter.cpp mode change 100755 => 100644 src/Contact/ContactSearchEngine.cpp mode change 100755 => 100644 src/Contact/ContactsSvcChangeListenerManager.cpp mode change 100755 => 100644 src/Contact/ContactsSvcObjectConverter.cpp mode change 100755 => 100644 src/Contact/ContactsSvcWrapper.cpp mode change 100755 => 100644 src/Contact/IAddressBook.cpp mode change 100755 => 100644 src/Contact/JSAddressBook.cpp mode change 100755 => 100644 src/Contact/JSAddressBookArray.cpp mode change 100755 => 100644 src/Contact/JSAddressBookChangeCallbackManager.cpp mode change 100755 => 100644 src/Contact/JSAttributesOfInterestArray.cpp mode change 100755 => 100644 src/Contact/JSContact.cpp mode change 100755 => 100644 src/Contact/JSContactAddress.cpp mode change 100755 => 100644 src/Contact/JSContactAddressArray.cpp mode change 100755 => 100644 src/Contact/JSContactAddressTypeArray.cpp mode change 100755 => 100644 src/Contact/JSContactAnniversary.cpp mode change 100755 => 100644 src/Contact/JSContactAnniversaryArray.cpp mode change 100755 => 100644 src/Contact/JSContactArray.cpp mode change 100755 => 100644 src/Contact/JSContactEmailAddress.cpp mode change 100755 => 100644 src/Contact/JSContactEmailAddressArray.cpp mode change 100755 => 100644 src/Contact/JSContactEmailAddressTypeArray.cpp mode change 100755 => 100644 src/Contact/JSContactGroup.cpp mode change 100755 => 100644 src/Contact/JSContactGroupArray.cpp mode change 100755 => 100644 src/Contact/JSContactManager.cpp mode change 100755 => 100644 src/Contact/JSContactManagerChangeCallbackManager.cpp mode change 100755 => 100644 src/Contact/JSContactName.cpp mode change 100755 => 100644 src/Contact/JSContactOrganization.cpp mode change 100755 => 100644 src/Contact/JSContactOrganizationArray.cpp mode change 100755 => 100644 src/Contact/JSContactPhoneNumber.cpp mode change 100755 => 100644 src/Contact/JSContactPhoneNumberArray.cpp mode change 100755 => 100644 src/Contact/JSContactPhoneNumberTypeArray.cpp mode change 100755 => 100644 src/Contact/JSContactRef.cpp mode change 100755 => 100644 src/Contact/JSContactWebSite.cpp mode change 100755 => 100644 src/Contact/JSContactWebSiteArray.cpp mode change 100755 => 100644 src/Contact/JSPerson.cpp mode change 100755 => 100644 src/Contact/JSPersonArray.cpp mode change 100755 => 100644 src/Contact/JSStringArray.cpp mode change 100755 => 100644 src/Contact/Person.cpp mode change 100755 => 100644 src/Contact/PersonSearchEngine.cpp mode change 100755 => 100644 src/Contact/plugin_initializer.cpp mode change 100755 => 100644 src/Content/AudioLyricsUtil.cpp mode change 100755 => 100644 src/Content/ContentController.cpp mode change 100755 => 100644 src/Content/ContentConverter.cpp mode change 100755 => 100644 src/Content/ContentFilterConverter.cpp mode change 100755 => 100644 src/Content/ContentFilterValidator.cpp mode change 100755 => 100644 src/Content/ContentFolder.cpp mode change 100755 => 100644 src/Content/ContentImage.cpp mode change 100755 => 100644 src/Content/ContentListener.cpp mode change 100755 => 100644 src/Content/ContentManager.cpp mode change 100755 => 100644 src/Content/ContentMedia.cpp mode change 100755 => 100644 src/Content/ContentSearchVisitor.cpp mode change 100755 => 100644 src/Content/ContentVideo.cpp mode change 100755 => 100644 src/Content/IContentManager.cpp mode change 100755 => 100644 src/Content/IEventUpdate.h mode change 100755 => 100644 src/Content/IEventUpdateBatch.h mode change 100755 => 100644 src/Content/JSAudio.cpp mode change 100755 => 100644 src/Content/JSAudioLyrics.cpp mode change 100755 => 100644 src/Content/JSContent.cpp mode change 100755 => 100644 src/Content/JSContentManager.cpp mode change 100755 => 100644 src/Content/JSFolder.cpp mode change 100755 => 100644 src/Content/JSImage.cpp mode change 100755 => 100644 src/Content/JSVideo.cpp mode change 100755 => 100644 src/Content/plugin_initializer.cpp mode change 100755 => 100644 src/DataControl/DataControlConverter.cpp mode change 100755 => 100644 src/DataControl/DataControlListener.cpp mode change 100755 => 100644 src/DataControl/EventAddValue.h mode change 100755 => 100644 src/DataControl/EventDelete.h mode change 100755 => 100644 src/DataControl/EventGetIndexedRow.h mode change 100755 => 100644 src/DataControl/EventGetValue.h mode change 100755 => 100644 src/DataControl/EventInsert.h mode change 100755 => 100644 src/DataControl/EventRemoveValue.h mode change 100755 => 100644 src/DataControl/EventSelect.h mode change 100755 => 100644 src/DataControl/EventUpdate.h mode change 100755 => 100644 src/DataControl/EventUpdateValue.h mode change 100755 => 100644 src/DataControl/JSDataControlManager.cpp mode change 100755 => 100644 src/DataControl/JSMappedDataControlConsumer.cpp mode change 100755 => 100644 src/DataControl/JSSQLDataControlConsumer.cpp mode change 100755 => 100644 src/DataControl/JSSelectObjectArrayValues.cpp mode change 100755 => 100644 src/DataControl/MappedDataControlConsumer.cpp mode change 100755 => 100644 src/DataControl/RowData.h mode change 100755 => 100644 src/DataControl/SelectDataObject.cpp mode change 100755 => 100644 src/DataControl/SqlDataControlConsumer.cpp mode change 100755 => 100644 src/DataControl/plugin_initializer.cpp mode change 100755 => 100644 src/DataSync/DataSyncConverter.cpp mode change 100755 => 100644 src/DataSync/DataSyncListenerManager.h mode change 100755 => 100644 src/DataSync/DataSyncManager.cpp mode change 100755 => 100644 src/DataSync/DataSyncResponseDispatcher.cpp mode change 100755 => 100644 src/DataSync/JSDataSyncManager.cpp mode change 100755 => 100644 src/DataSync/JSSyncInfo.cpp mode change 100755 => 100644 src/DataSync/JSSyncProfileInfo.cpp mode change 100755 => 100644 src/DataSync/JSSyncServiceInfo.cpp mode change 100755 => 100644 src/DataSync/JSSyncStatistics.cpp mode change 100755 => 100644 src/DataSync/plugin_initializer.cpp mode change 100755 => 100644 src/Download/JSDownloadRequest.cpp mode change 100755 => 100644 src/Filesystem/FilesystemListenerManager.h mode change 100755 => 100644 src/Filesystem/FilesystemUtils.cpp mode change 100755 => 100644 src/Filesystem/JSFile.cpp mode change 100755 => 100644 src/Filesystem/JSFilestream.cpp mode change 100755 => 100644 src/Filesystem/JSFilesystemManager.cpp mode change 100755 => 100644 src/Filesystem/JSStorage.cpp mode change 100755 => 100644 src/Filesystem/Manager.cpp mode change 100755 => 100644 src/Filesystem/Node.cpp mode change 100755 => 100644 src/Filesystem/Path.cpp mode change 100755 => 100644 src/Filesystem/ResponseDispatcher.cpp mode change 100755 => 100644 src/Filesystem/StorageStaticController.cpp mode change 100755 => 100644 src/Filesystem/Stream.cpp mode change 100755 => 100644 src/Filesystem/plugin_initializer.cpp mode change 100755 => 100644 src/MessagePort/MessagePortManagerProxy.cpp mode change 100755 => 100644 src/MessagePort/MessagePortManagerProxy.h mode change 100755 => 100644 src/Messaging/AttachmentFactory.cpp mode change 100755 => 100644 src/Messaging/Attachments.cpp mode change 100755 => 100644 src/Messaging/BinarySms.cpp mode change 100755 => 100644 src/Messaging/CallbackNumber.cpp mode change 100755 => 100644 src/Messaging/ConversationFilterValidator.cpp mode change 100755 => 100644 src/Messaging/ConversationQueryGenerator.cpp mode change 100755 => 100644 src/Messaging/DBus/Connection.cpp mode change 100755 => 100644 src/Messaging/EmailUtils.cpp mode change 100755 => 100644 src/Messaging/FolderQueryGenerator.cpp mode change 100755 => 100644 src/Messaging/IAttachment.cpp mode change 100755 => 100644 src/Messaging/IBinarySms.cpp mode change 100755 => 100644 src/Messaging/IEmail.cpp mode change 100755 => 100644 src/Messaging/IMessage.cpp mode change 100755 => 100644 src/Messaging/IMessagingService.cpp mode change 100755 => 100644 src/Messaging/IMms.cpp mode change 100755 => 100644 src/Messaging/ISms.cpp mode change 100755 => 100644 src/Messaging/JSConversation.cpp mode change 100755 => 100644 src/Messaging/JSMessage.h mode change 100755 => 100644 src/Messaging/JSRecipientArray.cpp mode change 100755 => 100644 src/Messaging/MessageFactory.cpp mode change 100755 => 100644 src/Messaging/MessageFilterValidator.cpp mode change 100755 => 100644 src/Messaging/MessageQueryGenerator.cpp mode change 100755 => 100644 src/Messaging/Messaging.cpp mode change 100755 => 100644 src/Messaging/MessagingService.cpp mode change 100755 => 100644 src/Messaging/Recipient.cpp mode change 100755 => 100644 src/Messaging/ReqReceiverMessage.cpp mode change 100755 => 100644 src/Messaging/SourceAddress.cpp mode change 100755 => 100644 src/Messaging/StorageChangesConversationFilterValidator.cpp mode change 100755 => 100644 src/Messaging/StorageChangesConversationGenerator.cpp mode change 100755 => 100644 src/Messaging/StorageChangesFolderFilterValidator.cpp mode change 100755 => 100644 src/Messaging/StorageChangesFolderGenerator.cpp mode change 100755 => 100644 src/Messaging/StorageChangesMessageFilterValidator.cpp mode change 100755 => 100644 src/Messaging/StorageChangesMessageGenerator.cpp mode change 100755 => 100644 src/Messaging/SyncNetworkStatus.cpp mode change 100755 => 100644 src/Messaging/ToRecipient.cpp mode change 100755 => 100644 src/Messaging/log.h mode change 100755 => 100644 src/Messaging/plugin_initializer.cpp mode change 100755 => 100644 src/NFC/JSNFCAdapter.cpp mode change 100755 => 100644 src/NFC/NFCAdapter.cpp mode change 100755 => 100644 src/NFC/NFCConverter.cpp mode change 100755 => 100644 src/NFC/NFCDefaultAdapter.cpp mode change 100755 => 100644 src/NFC/NFCListenerManager.h mode change 100755 => 100644 src/NFC/NFCStaticController.cpp mode change 100755 => 100644 src/NFC/NFCTag.cpp mode change 100755 => 100644 src/NFC/NFCTarget.cpp mode change 100755 => 100644 src/NFC/NFCUtil.cpp mode change 100755 => 100644 src/NFC/NdefMessage.cpp mode change 100755 => 100644 src/NFC/NdefRecord.cpp mode change 100755 => 100644 src/NFC/plugin_initializer.cpp mode change 100755 => 100644 src/NetworkBearerSelection/JSNetworkBearerSelection.cpp mode change 100755 => 100644 src/NetworkBearerSelection/JSNetworkBearerSelectionCallbackManager.cpp mode change 100755 => 100644 src/NetworkBearerSelection/NetworkBearerSelection.cpp mode change 100755 => 100644 src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp mode change 100755 => 100644 src/NetworkBearerSelection/plugin_initializer.cpp mode change 100755 => 100644 src/Notification/JSNotificationDetailInfo.cpp mode change 100755 => 100644 src/Notification/JSNotificationManager.cpp mode change 100755 => 100644 src/Notification/JSStatusNotification.cpp mode change 100755 => 100644 src/Notification/NotificationLine.cpp mode change 100755 => 100644 src/Notification/NotificationManager.cpp mode change 100755 => 100644 src/Notification/StatusNotification.h mode change 100755 => 100644 src/Notification/plugin_initializer.cpp mode change 100755 => 100644 src/Power/JSPowerManager.cpp mode change 100755 => 100644 src/Power/PowerManager.cpp mode change 100755 => 100644 src/Power/plugin_initializer.cpp mode change 100755 => 100644 src/Push/config.xml mode change 100755 => 100644 src/SecureElement/JSSEChannel.cpp mode change 100755 => 100644 src/SecureElement/JSSEReader.cpp mode change 100755 => 100644 src/SecureElement/JSSEService.cpp mode change 100755 => 100644 src/SecureElement/JSSESession.cpp mode change 100755 => 100644 src/SecureElement/SEConverter.cpp mode change 100755 => 100644 src/SecureElement/SEReader.cpp mode change 100755 => 100644 src/SecureElement/SEService.cpp mode change 100755 => 100644 src/SecureElement/SESession.cpp mode change 100755 => 100644 src/SecureElement/SEUtil.cpp mode change 100755 => 100644 src/SecureElement/plugin_initializer.cpp mode change 100755 => 100644 src/SystemSetting/ConverterSystemSetting.cpp mode change 100755 => 100644 src/SystemSetting/JSSystemSetting.cpp mode change 100755 => 100644 src/SystemSetting/SystemSetting.cpp mode change 100755 => 100644 src/SystemSetting/SystemSettingResponseDispatcher.cpp mode change 100755 => 100644 src/SystemSetting/config.xml mode change 100755 => 100644 src/SystemSetting/plugin_initializer.cpp mode change 100755 => 100644 src/Systeminfo/EventGetSysteminfo.cpp mode change 100755 => 100644 src/Systeminfo/JSBatteryInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSBuildInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSCellularNetworkInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSCpuInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSDeviceOrientationInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSDisplayInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSLocaleInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSNetworkInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSPeripheralInfo.cpp mode change 100755 => 100644 src/Systeminfo/JSStorageInfo.cpp mode change 100644 => 100755 src/Systeminfo/JSSysteminfo.cpp mode change 100755 => 100644 src/Systeminfo/JSWifiNetworkInfo.cpp mode change 100755 => 100644 src/Systeminfo/SysteminfoListener.cpp mode change 100755 => 100644 src/Systeminfo/SysteminfoListenerManager.h mode change 100755 => 100644 src/Systeminfo/plugin_initializer.cpp mode change 100755 => 100644 src/TimeUtil/JSTZDate.cpp mode change 100755 => 100644 src/TimeUtil/JSTimeDuration.cpp mode change 100755 => 100644 src/TimeUtil/JSTimeUtil.cpp mode change 100755 => 100644 src/TimeUtil/TZDate.cpp mode change 100755 => 100644 src/TimeUtil/TimeUtil.cpp mode change 100755 => 100644 src/TimeUtil/TimeUtilConverter.cpp mode change 100755 => 100644 src/TimeUtil/TimeUtilTools.cpp mode change 100755 => 100644 src/TimeUtil/plugin_initializer.cpp delete mode 100644 src/Tizen/JSFeature.cpp delete mode 100644 src/Tizen/JSFeature.h delete mode 100644 src/Tizen/JSFeatureParam.cpp delete mode 100644 src/Tizen/JSFeatureParam.h diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index a6907a3..60e6f84 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,7 +1,7 @@ Name: wrt-plugins-tizen Summary: JavaScript plugins for WebRuntime -Version: 0.4.22 -Release: 2 +Version: 0.4.23 +Release: 0 Group: Development/Libraries License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/Alarm/AlarmAbsolute.cpp b/src/Alarm/AlarmAbsolute.cpp old mode 100755 new mode 100644 index 5a43024..31e0aa5 --- a/src/Alarm/AlarmAbsolute.cpp +++ b/src/Alarm/AlarmAbsolute.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace DeviceAPI { namespace Alarm { @@ -76,10 +77,10 @@ void AlarmAbsolute::setDate(struct tm date) snprintf(strDate, sizeof(strDate), "%d %d %d %d %d %d",m_date.tm_year, m_date.tm_mon, m_date.tm_mday, m_date.tm_hour, m_date.tm_min, m_date.tm_sec); - LogInfo("setDate encrypted string = " << strDate); + LoggerI("setDate encrypted string = " << strDate); service_add_extra_data(m_service_handle, ALARM_ALSOLUTE_DATE_KEY, strDate); - LogInfo("AlarmAbsolute Date = " << " Sec: " << m_date.tm_sec << ", Min: "<< m_date.tm_min + LoggerI("AlarmAbsolute Date = " << " Sec: " << m_date.tm_sec << ", Min: "<< m_date.tm_min << ", Hour:" << m_date.tm_hour << ", Day: " << m_date.tm_mday << ", MON: " << m_date.tm_mon << ", Year: " << m_date.tm_year); } diff --git a/src/Alarm/AlarmAbsolute.h b/src/Alarm/AlarmAbsolute.h index bd9a7b0..7e65af6 100755 --- a/src/Alarm/AlarmAbsolute.h +++ b/src/Alarm/AlarmAbsolute.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/src/Alarm/AlarmConverter.cpp b/src/Alarm/AlarmConverter.cpp old mode 100755 new mode 100644 index 6aaade4..3b3ad1b --- a/src/Alarm/AlarmConverter.cpp +++ b/src/Alarm/AlarmConverter.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -29,6 +27,7 @@ #include "AlarmAbsolute.h" #include "JSAlarmRelative.h" #include "AlarmRelative.h" +#include namespace DeviceAPI { namespace Alarm { @@ -96,7 +95,7 @@ service_h AlarmConverter::toService(std::string id) { service_h service; service_create(&service); - LogError("[ILOVEFILM] Enter AlarmConverter toService std package = " << id.c_str()); + LoggerE("[ILOVEFILM] Enter AlarmConverter toService std package = " << id.c_str()); service_set_operation(service, SERVICE_OPERATION_DEFAULT); service_set_package(service, id.c_str()); @@ -107,7 +106,7 @@ service_h AlarmConverter::toService(std::string id, std::string page) service_h service; service_create(&service); - LogError("[ILOVEFILM] Enter AlarmConverter toService std package = " << id.c_str()); + LoggerE("[ILOVEFILM] Enter AlarmConverter toService std package = " << id.c_str()); service_set_operation(service, SERVICE_OPERATION_DEFAULT); service_set_package(service, id.c_str()); @@ -122,21 +121,21 @@ bool AlarmConverter::toAlarmAbsolutePtr(int id, service_h handle, AlarmAbsoluteP memset(&date, 0, sizeof(tm)); int error = ALARM_ERROR_NONE; - LogInfo("Enter AlarmConverter.toAlarmAbsolutePtr"); + LoggerI("Enter AlarmConverter.toAlarmAbsolutePtr"); error = service_get_extra_data(handle, ALARM_ALSOLUTE_DATE_KEY, &dateString); - LogInfo("Date Strng = " << dateString); + LoggerI("Date Strng = " << dateString); if(error != SERVICE_ERROR_NONE) { - LogError("Fail to get AlarmDelay"); + LoggerE("Fail to get AlarmDelay"); return false; } sscanf(dateString, "%d %d %d %d %d %d", &date.tm_year, &date.tm_mon, &date.tm_mday, &date.tm_hour, &date.tm_min, &date.tm_sec); mktime(&date); - LogInfo("Converter AlarmAbsolute Date = " << " Sec: " << date.tm_sec << ", Min: "<< date.tm_min + LoggerI("Converter AlarmAbsolute Date = " << " Sec: " << date.tm_sec << ", Min: "<< date.tm_min << ", Hour: " << date.tm_hour << ", Day: " << date.tm_mday << ", MON: " << date.tm_mon << ", Year: " << date.tm_year); @@ -145,18 +144,18 @@ bool AlarmConverter::toAlarmAbsolutePtr(int id, service_h handle, AlarmAbsoluteP if(!strcmp(alarmType, ALARM_ALSOLUTE_RECURRENCE_TYPE_INTERVAL)) { int interval = 0; alarm_get_scheduled_period(id, &interval); - LogInfo("interval type alarm: "<setInterval(interval); } else if(!strcmp(alarmType, ALARM_ALSOLUTE_RECURRENCE_TYPE_BYDAYVALUE)) { int byDayValue =0; error = alarm_get_scheduled_recurrence_week_flag(id, &byDayValue); - LogInfo("daysOfWeek type alarm: "<0) { std::vector result; result = convertFlagToDaysOfTheWeek(byDayValue); privateData->setByDayRecurrence(result); } else { - LogInfo("Can't get the recurrence week flag."); + LoggerI("Can't get the recurrence week flag."); } } @@ -181,7 +180,7 @@ bool AlarmConverter::toAlarmRelativePtr(int id, service_h handle, AlarmRelativeP error = service_get_extra_data(handle, ALARM_RELATIVE_DELAY_KEY, &delayString); if(error != SERVICE_ERROR_NONE) { - LogError("Fail to get AlarmDelay"); + LoggerE("Fail to get AlarmDelay"); return false; } delay = atoi(delayString); @@ -214,30 +213,30 @@ int AlarmConverter::toNativeInterval(std::string freq, std::string interval) bool AlarmConverter::toAlarmService(service_h service, DeviceAPI::Application::ApplicationControlPtr appservice) { if (appservice->getOperation().compare("") != 0) { - LogDebug("operation is "<getOperation()); + LoggerD("operation is "<getOperation()); service_set_operation(service, appservice->getOperation().c_str() ); } else { - LogDebug("Error. operation is madatory field. cannot be null"); + LoggerD("Error. operation is madatory field. cannot be null"); return false; } if (appservice->getUri().compare("") != 0) { - LogDebug("uri is not null"); + LoggerD("uri is not null"); service_set_uri(service, appservice->getUri().c_str() ); } if (appservice->getMime().compare("") != 0) { - LogDebug("mime is "<getMime()); + LoggerD("mime is "<getMime()); service_set_mime(service, appservice->getMime().c_str() ); } - LogDebug(">>> appservice->getAppControlDataArray"); + LoggerD(">>> appservice->getAppControlDataArray"); std::vector appControlDataArray = appservice->getAppControlDataArray(); if (!appControlDataArray.empty()) { std::string key; const char** arr = NULL; - LogDebug("serviceDataArray.size() : "<getKey(); diff --git a/src/Alarm/AlarmConverter.h b/src/Alarm/AlarmConverter.h index f5439ca..cf9ada5 100755 --- a/src/Alarm/AlarmConverter.h +++ b/src/Alarm/AlarmConverter.h @@ -19,7 +19,6 @@ #ifndef _JS_TIZEN_ALARM_CONVERTER_H_ #define _JS_TIZEN_ALARM_CONVERTER_H_ -#include #include #include #include diff --git a/src/Alarm/AlarmRelative.cpp b/src/Alarm/AlarmRelative.cpp old mode 100755 new mode 100644 index 907e80a..ef4c741 --- a/src/Alarm/AlarmRelative.cpp +++ b/src/Alarm/AlarmRelative.cpp @@ -20,6 +20,7 @@ #include "alarm_common.h" #include #include +#include namespace DeviceAPI { namespace Alarm { @@ -80,14 +81,14 @@ int AlarmRelative::getDelay() void AlarmRelative::setPeriod(int value) { - LogInfo("Param Peroid = " << value); + LoggerI("Param Peroid = " << value); m_Period = value; - LogInfo("Setted Period = " << m_Period); + LoggerI("Setted Period = " << m_Period); } int AlarmRelative::getPeriod() { - LogInfo("return Period = " << m_Period); + LoggerI("return Period = " << m_Period); return m_Period; } diff --git a/src/Alarm/AlarmRelative.h b/src/Alarm/AlarmRelative.h index e730e67..910480b 100755 --- a/src/Alarm/AlarmRelative.h +++ b/src/Alarm/AlarmRelative.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/src/Alarm/CMakeLists.txt b/src/Alarm/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/src/Alarm/JSAlarmAbsolute.cpp b/src/Alarm/JSAlarmAbsolute.cpp old mode 100755 new mode 100644 index c3a9755..c53342d --- a/src/Alarm/JSAlarmAbsolute.cpp +++ b/src/Alarm/JSAlarmAbsolute.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -39,6 +37,7 @@ #include "plugin_config.h" #include "JSAlarmAbsolute.h" #include "JSAlarmManager.h" +#include namespace DeviceAPI { namespace Alarm { @@ -102,7 +101,7 @@ void JSAlarmAbsolute::finalize(JSObjectRef object) { JSAlarmAbsolutePriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { - LogError("Private object is null"); + LoggerE("Private object is null"); } delete priv; @@ -268,7 +267,7 @@ JSValueRef JSAlarmAbsolute::getDate(JSContextRef ctx, } date = privateData->getDate(); - LogInfo("JSAlarmAbsolute Date = " << " Sec : " << date.tm_sec << " Min : "<< date.tm_min + LoggerI("JSAlarmAbsolute Date = " << " Sec : " << date.tm_sec << " Min : "<< date.tm_min << " Hour" << date.tm_hour << "Day : " << date.tm_mday << " MON : " << date.tm_mon << " Year : " << date.tm_year); @@ -283,7 +282,7 @@ JSValueRef JSAlarmAbsolute::getDate(JSContextRef ctx, JSObjectRef result = JSObjectMakeDate(ctx, 6, args, exception); return result; } catch (...) { - LogWarning("Exception: occured"); + LoggerW("Exception: occured"); } return JSValueMakeUndefined(ctx); @@ -309,7 +308,7 @@ JSValueRef JSAlarmAbsolute::getId(JSContextRef ctx, return JSValueMakeNull(ctx); } } catch (...) { - LogWarning("Exception: occured"); + LoggerW("Exception: occured"); } return JSValueMakeUndefined(ctx); @@ -335,7 +334,7 @@ JSValueRef JSAlarmAbsolute::getInterval(JSContextRef ctx, return JSValueMakeNull(ctx); } } catch (...) { - LogWarning("Exception: occured"); + LoggerW("Exception: occured"); } return JSValueMakeUndefined(ctx); @@ -372,7 +371,7 @@ JSValueRef JSAlarmAbsolute::getDaysOfTheWeek(JSContextRef ctx, return jsResult; } catch (...) { - LogWarning("Exception: occured"); + LoggerW("Exception: occured"); } return JSValueMakeUndefined(ctx); diff --git a/src/Alarm/JSAlarmManager.cpp b/src/Alarm/JSAlarmManager.cpp old mode 100755 new mode 100644 index eef8a6a..d4ae5e7 --- a/src/Alarm/JSAlarmManager.cpp +++ b/src/Alarm/JSAlarmManager.cpp @@ -124,7 +124,7 @@ JSContextRef JSAlarmManager::gContext = NULL; void JSAlarmManager::initialize(JSContextRef ctx, JSObjectRef object) { gContext = ctx; - LogInfo("GContext = " << gContext); + LoggerI("GContext = " << gContext); } void JSAlarmManager::finalize(JSObjectRef object) @@ -156,7 +156,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef // applicationId std::string appId = validator.toString(1); - LogDebug("appId:[" << appId << "]"); + LoggerD("appId:[" << appId << "]"); // alarm JSObjectRef alarmObj = validator.toObject(0); @@ -195,7 +195,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef int err = ALARM_ERROR_NONE; if(alarmType == AbsoluteRecurrence::ByDayValue) { int bydayValue = converter.toNativeAlarmValue(alarmPtr->getByDayRecurrence()); - LogInfo("Native bydayValue = " << bydayValue); + LoggerI("Native bydayValue = " << bydayValue); err = alarm_schedule_with_recurrence_week_flag(service, &startDate, bydayValue, &alarm_id); } else if(alarmType == AbsoluteRecurrence::Interval) { int interval = alarmPtr->getInterval(); @@ -250,7 +250,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef } } else { - LogError("First parameter is not a Alarm object"); + LoggerE("First parameter is not a Alarm object"); throw TypeMismatchException("First parameter is not a Alarm object"); } TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -279,7 +279,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef ThrowMsg(InvalidArgumentException, "Wrong application id."); } applicationId = converter.toString(arguments[1]); - LogDebug("package:[" << applicationId << "]"); + LoggerD("package:[" << applicationId << "]"); } if(JSValueIsObjectOfClass(ctx, arguments[0], JSAlarmAbsolute::getClassRef())) { @@ -313,7 +313,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef service_set_operation(service, SERVICE_OPERATION_DEFAULT); } - LogDebug("applicationId:[" << applicationId << "]"); + LoggerD("applicationId:[" << applicationId << "]"); service_set_app_id(service, applicationId.c_str()); AbsoluteRecurrence::Type alarmType = alarmPtr->getRecurrenceType(); @@ -321,7 +321,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef int err = ALARM_ERROR_NONE; if(alarmType == AbsoluteRecurrence::ByDayValue) { int bydayValue = converter.toNativeAlarmValue(alarmPtr->getByDayRecurrence()); - LogInfo("Native bydayValue = " << bydayValue); + LoggerI("Native bydayValue = " << bydayValue); err = alarm_schedule_with_recurrence_week_flag(service, &startDate, bydayValue, &alarm_id); } else if(alarmType == AbsoluteRecurrence::Interval) { int interval = alarmPtr->getInterval(); @@ -333,7 +333,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef if(err == ALARM_ERROR_NONE) { alarmPtr->setId(alarm_id); }else{ - LogDebug("err:[" << err << "]"); + LoggerD("err:[" << err << "]"); ThrowMsg(PlatformException, "Alarm scheduling failed."); } } else if(JSValueIsObjectOfClass(ctx, arguments[0], JSAlarmRelative::getClassRef())) { @@ -368,7 +368,7 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef service_set_operation(service, SERVICE_OPERATION_DEFAULT); } - LogDebug("applicationId:[" << applicationId << "]"); + LoggerD("applicationId:[" << applicationId << "]"); service_set_app_id(service, applicationId.c_str()); int err = alarm_schedule_after_delay(service, delay, interval, &alarm_id); @@ -376,22 +376,22 @@ JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef if(err == ALARM_ERROR_NONE) { alarmPtr->setId(alarm_id); }else{ - LogDebug("err:[" << err << "]"); + LoggerD("err:[" << err << "]"); } } else { ThrowMsg(ConversionException, "Wrong first parameter type."); } } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(ctx, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(ctx, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(ctx, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(ctx, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(ctx); @@ -415,7 +415,7 @@ JSValueRef JSAlarmManager::remove(JSContextRef ctx, JSObjectRef object, JSObject std::stringstream(id) >> alarmId; if (alarmId <= 0) { - LogError("id is wrong : " << alarmId); + LoggerE("id is wrong : " << alarmId); throw InvalidValuesException("Invalid ID"); } @@ -448,7 +448,7 @@ JSValueRef JSAlarmManager::removeAll(JSContextRef ctx, JSObjectRef object, JSObj TIME_TRACER_ITEM_END("(removeAll)alarm_cancel_all", 0); if (ALARM_ERROR_NONE != returnVal) { - LogInfo("Error while removing all alarms: "<> alarmId; if (alarmId <= 0) { - LogError("id is wrong : " << alarmId); + LoggerE("id is wrong : " << alarmId); throw InvalidValuesException("Invalid ID"); } @@ -486,7 +486,7 @@ JSValueRef JSAlarmManager::get(JSContextRef ctx, JSObjectRef object, JSObjectRef ret = service_get_extra_data(service, ALARM_TYPE_KEY, &alarmType); if (ret != SERVICE_ERROR_NONE) { - LogError("Getting data failed: " << ret); + LoggerE("Getting data failed: " << ret); service_destroy(service); throw UnknownException("Unknown error occurred."); } @@ -536,10 +536,10 @@ JSValueRef JSAlarmManager::getAll(JSContextRef ctx, JSObjectRef object, JSObject int error = alarm_foreach_registered_alarm(alarm_iterate_callback, &alarmIds); if (error == ALARM_ERROR_CONNECTION_FAIL) { - LogWarning("Alarm system may not be ready yet."); + LoggerW("Alarm system may not be ready yet."); alarmIds.clear(); } else if(error != ALARM_ERROR_NONE) { - LogInfo("Error occurred while getting all alarms: "< #include #include #include @@ -41,6 +39,7 @@ #include #include +#include namespace DeviceAPI { namespace Alarm { @@ -103,7 +102,7 @@ void JSAlarmRelative::finalize(JSObjectRef object) { JSAlarmRelativePriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { - LogError("Private object is null"); + LoggerE("Private object is null"); } delete priv; } @@ -205,7 +204,7 @@ JSValueRef JSAlarmRelative::getRemainingSeconds(JSContextRef ctx, JSObjectRef fu long result = nextTime - currentTime; - LogDebug("nextTime: "<getDelay(); - LogInfo("JSAlarmRelative delay = " << delay); + LoggerI("JSAlarmRelative delay = " << delay); return DeviceAPI::Common::JSUtil::toJSValueRef(ctx, delay); } catch (const BasePlatformException &err) { return JSWebAPIException::throwException(ctx, exception, err); @@ -287,7 +286,7 @@ JSValueRef JSAlarmRelative::getPeriod(JSContextRef ctx, } period = privateData->getPeriod(); - LogInfo("JSAlarmRelative interval = " << period); + LoggerI("JSAlarmRelative interval = " << period); if(period == -1) { return JSValueMakeNull(ctx); } else { diff --git a/src/Alarm/plugin_initializer.cpp b/src/Alarm/plugin_initializer.cpp index 61f264d..4c8c386 100644 --- a/src/Alarm/plugin_initializer.cpp +++ b/src/Alarm/plugin_initializer.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -24,6 +22,7 @@ #include "JSAlarmManager.h" #include "JSAlarmAbsolute.h" #include "JSAlarmRelative.h" +#include #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen" @@ -47,7 +46,7 @@ class_definition_options_t ConstructorClassOptions = void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\AlarmManager ] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\AlarmManager ] on_widget_start_callback (" << widgetId << ")"); Try { TIME_TRACER_INIT(); @@ -55,13 +54,13 @@ void on_widget_start_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\AlarmManager ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\AlarmManager ] on_widget_stop_callback (" << widgetId << ")"); Try { TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Alarm"); @@ -70,7 +69,7 @@ void on_widget_stop_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } diff --git a/src/Application/AppManagerWrapper.cpp b/src/Application/AppManagerWrapper.cpp index 4b1c005..b7755d5 100644 --- a/src/Application/AppManagerWrapper.cpp +++ b/src/Application/AppManagerWrapper.cpp @@ -16,8 +16,6 @@ // #include "AppManagerWrapper.h" - -#include #include #include #include @@ -25,6 +23,8 @@ // To get package id from appId #include +#include + IMPLEMENT_SINGLETON(DeviceAPI::Application::AppManagerWrapper) namespace DeviceAPI { @@ -52,7 +52,7 @@ void AppManagerWrapper::registerAppListChangedCallbacks(IAppManagerAppListChange { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } @@ -68,20 +68,20 @@ void AppManagerWrapper::unregisterAppListChangedCallbacks(IAppManagerAppListChan { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } if(m_callbacks.size() == 0) { - LogWarning("No callbacks are registered."); + LoggerW("No callbacks are registered."); return; } AppListChangedCallbacksSet::iterator iter = m_callbacks.find(callbacks); if(iter == m_callbacks.end()) { - LogWarning("Callbacks " << callbacks << " are not registered."); + LoggerW("Callbacks " << callbacks << " are not registered."); return; } @@ -103,12 +103,12 @@ long AppManagerWrapper::getWatchIdAndInc() bool AppManagerWrapper::app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data) { if(app_id == NULL) { - LogWarning("app_manager listener gave a NULL package name."); + LoggerW("app_manager listener gave a NULL package name."); return true; } if(user_data == NULL) { - LogWarning("No user data to store appId"); + LoggerW("No user data to store appId"); return true; } @@ -121,7 +121,7 @@ bool AppManagerWrapper::app_callback(package_info_app_component_type_e comp_type void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_type, const char *pkgId, void *user_data) { if(user_data == NULL) { - LogWarning("No user data to store appId"); + LoggerW("No user data to store appId"); return; } @@ -136,19 +136,19 @@ void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_typ int ret = package_manager_get_package_info(pkgId, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot create package info by : " << pkgId); + LoggerD("Cannot create package info by : " << pkgId); return; } ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, user_data); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("failed while getting appids"); + LoggerD("failed while getting appids"); return; } ret = package_info_destroy(package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot destroy package info"); + LoggerD("Cannot destroy package info"); } for (size_t i = 0; i < appManager->applist.size(); i++) { @@ -161,7 +161,7 @@ void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_typ appListAppUpdated(appManager->applist.at(i).c_str()); break; default: - LogWarning("app_manager listener gave wrong event_type : " << event_type); + LoggerW("app_manager listener gave wrong event_type : " << event_type); break; } } @@ -174,7 +174,7 @@ void AppManagerWrapper::appListChangedCallback(app_manger_event_type_e event_typ void AppManagerWrapper::appListAppInstalled(const char *appId) { - LogDebug("app installed : " << appId); + LoggerD("app installed : " << appId); AppListChangedCallbacksSet::iterator iter = m_callbacks.begin(); for(; iter != m_callbacks.end(); iter++) @@ -185,7 +185,7 @@ void AppManagerWrapper::appListAppInstalled(const char *appId) void AppManagerWrapper::appListAppUninstalled(const char *appId) { - LogDebug("app uninstalled : " << appId); + LoggerD("app uninstalled : " << appId); AppListChangedCallbacksSet::iterator iter = m_callbacks.begin(); for(; iter != m_callbacks.end(); iter++) @@ -196,7 +196,7 @@ void AppManagerWrapper::appListAppUninstalled(const char *appId) void AppManagerWrapper::appListAppUpdated(const char *appId) { - LogDebug("app updated : " << appId); + LoggerD("app updated : " << appId); AppListChangedCallbacksSet::iterator iter = m_callbacks.begin(); for(; iter != m_callbacks.end(); iter++) @@ -221,17 +221,17 @@ int AppManagerWrapper::app_list_changed_cb_broker(int id, const char *type, cons int ret = package_manager_get_package_info(package, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot create package info by : " << package); + LoggerD("Cannot create package info by : " << package); } ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, data); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("failed while getting appids"); + LoggerD("failed while getting appids"); } ret = package_info_destroy(package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot destroy package info"); + LoggerD("Cannot destroy package info"); } event_type = APP_MANAGER_EVENT_UNINSTALLED; } else if (!strcasecmp(val, "update")) { @@ -253,7 +253,7 @@ int AppManagerWrapper::app_list_changed_cb_broker(int id, const char *type, cons void AppManagerWrapper::registerAppListChangedCallbacks() { if (m_manager_handle != NULL) { - LogWarning("Callback already registered."); + LoggerW("Callback already registered."); return; } @@ -268,7 +268,7 @@ void AppManagerWrapper::registerAppListChangedCallbacks() void AppManagerWrapper::unregisterAppListChangedCallbacks() { if (m_manager_handle == NULL) { - LogWarning("No callback registered"); + LoggerW("No callback registered"); return; } @@ -286,12 +286,12 @@ bool AppManagerWrapper::initializeAppInfo(ApplicationInformationPtr &appInfo) char* packageId = NULL; int ret = 0; - //LogDebug("InitializeAppInfo for " << appInfo->getAppId().c_str()); + //LoggerD("InitializeAppInfo for " << appInfo->getAppId().c_str()); ret = package_manager_get_package_id_by_app_id(appId.c_str(), &packageId); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Fail to get package id with appId : " << appId.c_str()); + LoggerD("Fail to get package id with appId : " << appId.c_str()); } // Below code is already run on ApplicationManager.cpp @@ -303,37 +303,37 @@ bool AppManagerWrapper::initializeAppInfo(ApplicationInformationPtr &appInfo) ret = pkgmgrinfo_appinfo_get_appinfo(appId.c_str(), &appinfo_h); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get appinfo by " << appId.c_str()); + LoggerD("Fail to get appinfo by " << appId.c_str()); } ret = pkgmgrinfo_appinfo_get_label(appinfo_h, &name); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get name by " << appId.c_str()); + LoggerD("Fail to get name by " << appId.c_str()); } appInfo->setName(name); ret = pkgmgrinfo_appinfo_get_icon(appinfo_h, &iconPath); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get icon by " << appId.c_str()); + LoggerD("Fail to get icon by " << appId.c_str()); } appInfo->setIconPath(iconPath); ret = pkgmgrinfo_appinfo_is_nodisplay(appinfo_h, &noDisplay); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get nodisplay by " << appId.c_str()); + LoggerD("Fail to get nodisplay by " << appId.c_str()); } appInfo->setShow(!noDisplay); ret = pkgmgrinfo_appinfo_foreach_category(appinfo_h, category_cb, (void*)appInfo.Get()); if (ret < 0) { - LogDebug("Fail to get categories " << appId.c_str()); + LoggerD("Fail to get categories " << appId.c_str()); } ret = pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h); if (ret < 0) { - LogDebug("Fail to destroy " << appId.c_str()); + LoggerD("Fail to destroy " << appId.c_str()); } #endif @@ -344,12 +344,12 @@ bool AppManagerWrapper::initializeAppInfo(ApplicationInformationPtr &appInfo) ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &pkginfo_h); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get package info"); + LoggerD("Fail to get package info"); } ret = pkgmgrinfo_pkginfo_get_version(pkginfo_h, &version); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get version"); + LoggerD("Fail to get version"); } appInfo->setVersion(version); diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 629759c..48b480a 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -24,6 +24,7 @@ #include "ApplicationControlData.h" #include "ApplicationControl.h" #include "ApplicationManager.h" +#include namespace DeviceAPI { namespace Application { @@ -63,14 +64,14 @@ void Application::setAppInfo(ApplicationInformationPtr& appInfo) void Application::getRequestedAppControl(const EventApplicationGetRequestedAppControlPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { int ret = 0; std::string bundle_str = event->getEncodedBundle(); - LogDebug("bundle str : " << bundle_str); + LoggerD("bundle str : " << bundle_str); service_h service = NULL; char* tmpStr = NULL; @@ -79,7 +80,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_create_event(request_bundle, &service); if(ret != SERVICE_ERROR_NONE) { - LogError("Fail to create event"); + LoggerE("Fail to create event"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); bundle_free(request_bundle); return; @@ -92,7 +93,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_get_operation(service, &tmpStr); if(ret == SERVICE_ERROR_NONE && tmpStr != NULL) { - LogDebug(" operation : " << tmpStr); + LoggerD(" operation : " << tmpStr); appControl->setOperation(tmpStr); free(tmpStr); tmpStr = NULL; @@ -101,7 +102,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_get_uri(service, &tmpStr); if(ret == SERVICE_ERROR_NONE && tmpStr != NULL) { - LogDebug(" uri : " << tmpStr); + LoggerD(" uri : " << tmpStr); appControl->setUri(tmpStr); free(tmpStr); tmpStr = NULL; @@ -110,7 +111,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_get_mime(service, &tmpStr); if(ret == SERVICE_ERROR_NONE && tmpStr != NULL) { - LogDebug(" mime : " << tmpStr); + LoggerD(" mime : " << tmpStr); appControl->setMime(tmpStr); free(tmpStr); tmpStr = NULL; @@ -119,7 +120,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_get_category(service, &tmpStr); if(ret == SERVICE_ERROR_NONE && tmpStr != NULL) { - LogDebug(" category : " << tmpStr); + LoggerD(" category : " << tmpStr); appControl->setCategory(tmpStr); free(tmpStr); tmpStr = NULL; @@ -129,7 +130,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_foreach_extra_data(service, ApplicationManager::service_extra_data_callback, &appControlDataArray); if (ret != SERVICE_ERROR_NONE) { - LogError("service_foreach_extra_data fail"); + LoggerE("service_foreach_extra_data fail"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); } else @@ -144,12 +145,12 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo ret = service_get_caller(service, &tmpStr); if(ret == SERVICE_ERROR_NONE && tmpStr != NULL) { - LogDebug(" caller App Id : " << tmpStr); + LoggerD(" caller App Id : " << tmpStr); appCtrMgr->setCallerAppId(tmpStr); free(tmpStr); tmpStr = NULL; } else { - LogError("caller id fail"); + LoggerE("caller id fail"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } event->setRequestedAppControl(appCtrMgr); @@ -157,7 +158,7 @@ void Application::getRequestedAppControl(const EventApplicationGetRequestedAppCo } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppControl : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppControl : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } diff --git a/src/Application/Application.h b/src/Application/Application.h index bbc5f9e..ef53a35 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -20,7 +20,6 @@ #include #include -#include #include #include "ApplicationInformation.h" #include "EventApplicationGetRequestedAppControl.h" diff --git a/src/Application/ApplicationCert.h b/src/Application/ApplicationCert.h index 0d754d8..54c5028 100644 --- a/src/Application/ApplicationCert.h +++ b/src/Application/ApplicationCert.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace DeviceAPI { diff --git a/src/Application/ApplicationContext.h b/src/Application/ApplicationContext.h index 97439d2..13cb362 100755 --- a/src/Application/ApplicationContext.h +++ b/src/Application/ApplicationContext.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace DeviceAPI { diff --git a/src/Application/ApplicationControl.cpp b/src/Application/ApplicationControl.cpp old mode 100755 new mode 100644 index 73d07c6..c652575 --- a/src/Application/ApplicationControl.cpp +++ b/src/Application/ApplicationControl.cpp @@ -22,8 +22,8 @@ * @version 0.1 */ - #include "ApplicationControl.h" +#include namespace DeviceAPI { namespace Application { @@ -31,7 +31,7 @@ namespace Application { ApplicationControl::ApplicationControl() : m_appControl(NULL) { - LogDebug("entered"); + LoggerD("entered"); } ApplicationControl::ApplicationControl(const std::string &op, const std::string &uri, @@ -39,7 +39,7 @@ ApplicationControl::ApplicationControl(const std::string &op, const std::string std::vector &dataArray) : m_appControl(NULL) { - LogDebug("entered"); + LoggerD("entered"); m_operation = op; m_uri = uri; m_mime = mime; @@ -49,7 +49,7 @@ ApplicationControl::ApplicationControl(const std::string &op, const std::string ApplicationControl::~ApplicationControl() { - LogDebug("entered"); + LoggerD("entered"); } std::string ApplicationControl::getOperation() const @@ -130,7 +130,7 @@ void ApplicationControl::replyResult(std::vector &app if (!appControlDataArray.empty()) { - LogDebug("appControlDataArray.size() : "<getKey().c_str(); std::vector valueArray = appControlDataArray.at(i)->getValue(); @@ -143,7 +143,7 @@ void ApplicationControl::replyResult(std::vector &app service_add_extra_data_array(reply, key, arr, valueArray.size()); } } else { - LogError("==[replyResult] appControlDataArray is empty"); + LoggerE("==[replyResult] appControlDataArray is empty"); } service_reply_to_launch_request(reply, m_appControl, SERVICE_RESULT_SUCCEEDED); @@ -161,7 +161,7 @@ void ApplicationControl::replyFailure() service_h reply; service_create(&reply); - LogError("==[replyFailure] enter ApplicationControl::replyFailure"); + LoggerE("==[replyFailure] enter ApplicationControl::replyFailure"); service_reply_to_launch_request(reply, m_appControl, SERVICE_RESULT_FAILED); service_destroy(reply); diff --git a/src/Application/ApplicationControl.h b/src/Application/ApplicationControl.h index fdd1ce1..4834877 100755 --- a/src/Application/ApplicationControl.h +++ b/src/Application/ApplicationControl.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "ApplicationControlData.h" diff --git a/src/Application/ApplicationControlData.cpp b/src/Application/ApplicationControlData.cpp old mode 100755 new mode 100644 index 5be9eb6..e51c9fb --- a/src/Application/ApplicationControlData.cpp +++ b/src/Application/ApplicationControlData.cpp @@ -16,19 +16,20 @@ // #include "ApplicationControlData.h" +#include namespace DeviceAPI { namespace Application { ApplicationControlData::ApplicationControlData() { - LogDebug("entered"); + LoggerD("entered"); } ApplicationControlData::~ApplicationControlData() { //nothing to do in destructor - LogDebug("entered"); + LoggerD("entered"); } std::string ApplicationControlData::getKey() const diff --git a/src/Application/ApplicationControlData.h b/src/Application/ApplicationControlData.h index 2e420c2..c0c8256 100755 --- a/src/Application/ApplicationControlData.h +++ b/src/Application/ApplicationControlData.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace DeviceAPI { diff --git a/src/Application/ApplicationController.cpp b/src/Application/ApplicationController.cpp index 1614635..be82a9d 100644 --- a/src/Application/ApplicationController.cpp +++ b/src/Application/ApplicationController.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -25,6 +24,7 @@ #include "JSApplicationEventCallbackManager.h" #include "ApplicationAsyncCallbackManager.h" #include "ApplicationInformationEventPrivateData.h" +#include namespace DeviceAPI { namespace Application { @@ -44,15 +44,15 @@ ApplicationController::ApplicationController(JSContextRef context, IApplicationM EventApplicationAppInfoEventListenerListener(ThreadEnum::NULL_THREAD), ApplicationPrivObject(context, application) { - LogDebug("ApplicationController constructed : " << this); + LoggerD("ApplicationController constructed : " << this); if (!application) { - LogWarning("controller has no application object"); + LoggerW("controller has no application object"); } } ApplicationController::~ApplicationController() { - LogDebug("ApplicationController destructed : " << this); + LoggerD("ApplicationController destructed : " << this); } void ApplicationController::OnAnswerReceived(const EventApplicationLaunchPtr &event) @@ -104,18 +104,18 @@ void ApplicationController::onAnswerReceived(const EventApplicationAppInfoEventL void ApplicationAsyncAnswerHandler::launch(const EventApplicationLaunchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -146,7 +146,7 @@ void ApplicationAsyncAnswerHandler::launch(const EventApplicationLaunchPtr &even callbackManager->callOnSuccess(); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -156,18 +156,18 @@ void ApplicationAsyncAnswerHandler::launch(const EventApplicationLaunchPtr &even void ApplicationAsyncAnswerHandler::kill(const EventApplicationKillPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -200,7 +200,7 @@ void ApplicationAsyncAnswerHandler::kill(const EventApplicationKillPtr &event) callbackManager->callOnSuccess(); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -210,18 +210,18 @@ void ApplicationAsyncAnswerHandler::kill(const EventApplicationKillPtr &event) void ApplicationAsyncAnswerHandler::launchAppControl(const EventApplicationLaunchAppControlPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -251,7 +251,7 @@ void ApplicationAsyncAnswerHandler::launchAppControl(const EventApplicationLaunc callbackManager->callOnSuccess(); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -261,18 +261,18 @@ void ApplicationAsyncAnswerHandler::launchAppControl(const EventApplicationLaunc void ApplicationAsyncAnswerHandler::launchAppControlReply(const EventApplicationLaunchAppControlReplyPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -295,7 +295,7 @@ void ApplicationAsyncAnswerHandler::launchAppControlReply(const EventApplication ApplicationConverterFactory::getConverter(gContext); JSValueRef result = converter->toJSValueRef(*appControlDataArray); - LogDebug("replyCallbackManager onsuccess"); + LoggerD("replyCallbackManager onsuccess"); callbackManager->callOnSuccess(result); return; @@ -307,18 +307,18 @@ void ApplicationAsyncAnswerHandler::launchAppControlReply(const EventApplication void ApplicationAsyncAnswerHandler::findAppControl(const EventApplicationFindAppControlPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -358,7 +358,7 @@ void ApplicationAsyncAnswerHandler::findAppControl(const EventApplicationFindApp callbackManager->callOnSuccess(result, 2); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -368,18 +368,18 @@ void ApplicationAsyncAnswerHandler::findAppControl(const EventApplicationFindApp void ApplicationAsyncAnswerHandler::getAppsContext(const EventApplicationGetAppsContextPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -416,7 +416,7 @@ void ApplicationAsyncAnswerHandler::getAppsContext(const EventApplicationGetApps callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -426,18 +426,18 @@ void ApplicationAsyncAnswerHandler::getAppsContext(const EventApplicationGetApps void ApplicationAsyncAnswerHandler::getAppsInfo(const EventApplicationGetAppsInfoPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ApplicationAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -474,7 +474,7 @@ void ApplicationAsyncAnswerHandler::getAppsInfo(const EventApplicationGetAppsInf callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -485,12 +485,12 @@ void ApplicationAsyncAnswerHandler::getAppsInfo(const EventApplicationGetAppsInf void ApplicationAsyncAnswerHandler::eventListener(const EventApplicationAppInfoEventListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSApplicationEventCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } @@ -505,7 +505,7 @@ void ApplicationAsyncAnswerHandler::eventListener(const EventApplicationAppInfoE ApplicationInformationPtr appInfo = event->getAppInfo(); if(appInfo == NULL) { - LogError("AppInfo did not set."); + LoggerE("AppInfo did not set."); return; } JSValueRef result = converter->toJSValueRefFromApplicationInformation(appInfo); @@ -516,7 +516,7 @@ void ApplicationAsyncAnswerHandler::eventListener(const EventApplicationAppInfoE ApplicationInformationPtr appInfo = event->getAppInfo(); if(appInfo == NULL) { - LogError("AppInfo did not set."); + LoggerE("AppInfo did not set."); return; } JSValueRef result = converter->toJSValueRefFromApplicationInformation(appInfo); @@ -528,7 +528,7 @@ void ApplicationAsyncAnswerHandler::eventListener(const EventApplicationAppInfoE std::string appId = appInfo->getAppId(); if(appId == "") { - LogError("AppId did not set."); + LoggerE("AppId did not set."); return; } JSValueRef result = converter->toJSValueRef(appId); @@ -536,11 +536,11 @@ void ApplicationAsyncAnswerHandler::eventListener(const EventApplicationAppInfoE } else { - LogError("Event callback type is wrong."); + LoggerE("Event callback type is wrong."); return; } } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } } diff --git a/src/Application/ApplicationController.h b/src/Application/ApplicationController.h index b76b2a2..32bccb6 100755 --- a/src/Application/ApplicationController.h +++ b/src/Application/ApplicationController.h @@ -18,7 +18,6 @@ #ifndef _TIZEN_APPLICATION_APPLICATION_CONTROLLER_H_ #define _TIZEN_APPLICATION_APPLICATION_CONTROLLER_H_ -#include #include #include #include diff --git a/src/Application/ApplicationConverter.cpp b/src/Application/ApplicationConverter.cpp old mode 100755 new mode 100644 index be78698..0179a64 --- a/src/Application/ApplicationConverter.cpp +++ b/src/Application/ApplicationConverter.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -33,6 +31,7 @@ #include "JSApplicationControl.h" #include "JSRequestedApplicationControl.h" #include "JSApplicationCert.h" +#include namespace DeviceAPI { namespace Application { @@ -52,7 +51,7 @@ ApplicationConverter::~ApplicationConverter() JSValueRef ApplicationConverter::toJSValueRefFromApplication(const ApplicationPtr &arg) { - LogDebug("entered to toJSValueRefFromApplication "); + LoggerD("entered to toJSValueRefFromApplication "); if(arg == NULL) { Throw(Commons::ConversionException); } @@ -62,7 +61,7 @@ JSValueRef ApplicationConverter::toJSValueRefFromApplication(const ApplicationPt JSValueRef ApplicationConverter::toJSValueRefFromApplicationCert(const ApplicationCertPtr &arg) { - LogDebug("entered to toJSValueRefFromApplicationCert "); + LoggerD("entered to toJSValueRefFromApplicationCert "); if(arg == NULL) { Throw(Commons::ConversionException); } @@ -252,7 +251,7 @@ ApplicationContextArrayPtr ApplicationConverter::toApplicationContextArray(const JSValueRef ApplicationConverter::toJSValueRef(const RequestedApplicationControlPtr &arg) { - LogDebug("entered to toJSValueRefFromRequestedApplicationControl" ); + LoggerD("entered to toJSValueRefFromRequestedApplicationControl" ); if(arg == NULL) { Throw(Commons::InvalidArgumentException); } @@ -271,7 +270,7 @@ RequestedApplicationControlPtr ApplicationConverter::toRequestedApplicationContr JSValueRef ApplicationConverter::toJSValueRef(const ApplicationControlPtr &arg) { - LogDebug("entered"); + LoggerD("entered"); if(arg == NULL) { Throw(Commons::InvalidArgumentException); } @@ -289,7 +288,7 @@ ApplicationControlPtr ApplicationConverter::toApplicationControl(const JSValueRe JSValueRef ApplicationConverter::toJSValueRef(const ApplicationControlDataPtr &arg) { - LogDebug("entered"); + LoggerD("entered"); return CommonsJavaScript::JSUtils::makeObject(m_context, JSApplicationControlData::getClassRef(), arg); } diff --git a/src/Application/ApplicationInformation.h b/src/Application/ApplicationInformation.h index c0f5410..3f9b4e5 100755 --- a/src/Application/ApplicationInformation.h +++ b/src/Application/ApplicationInformation.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace DeviceAPI { diff --git a/src/Application/ApplicationListenerManager.h b/src/Application/ApplicationListenerManager.h index e82cd83..4d70acd 100644 --- a/src/Application/ApplicationListenerManager.h +++ b/src/Application/ApplicationListenerManager.h @@ -20,12 +20,12 @@ #include #include -#include #include #include #include #include "JSApplicationManager.h" #include "ApplicationController.h" +#include namespace DeviceAPI { namespace Application { @@ -61,7 +61,7 @@ public: if(!priv) { - LogError("Object has no private object."); + LoggerE("Object has no private object."); return; } @@ -69,7 +69,7 @@ public: Try { - LogDebug("Remove a listener"); + LoggerD("Remove a listener"); EventApplicationRemoveAppInfoEventListenerPtr event( new EventApplicationRemoveAppInfoEventListener()); @@ -77,15 +77,15 @@ public: event->setForSynchronousCall(); Try { - LogDebug("Remove change listener"); + LoggerD("Remove change listener"); application->removeAppInfoEventListener(event); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Application/ApplicationManager.cpp b/src/Application/ApplicationManager.cpp index 091297b..388369c 100644 --- a/src/Application/ApplicationManager.cpp +++ b/src/Application/ApplicationManager.cpp @@ -32,8 +32,6 @@ #include -#include - // to launch app by aul #include @@ -51,6 +49,8 @@ // To get ppid #include +#include + namespace DeviceAPI { namespace Application { @@ -68,7 +68,7 @@ namespace { static void app_manager_app_context_event_callback(app_context_h app_context, app_context_event_e event, void *user_data) { - LogDebug("called"); + LoggerD("called"); int ret = 0; if(event != APP_CONTEXT_EVENT_TERMINATED) @@ -79,7 +79,7 @@ namespace { ret = app_context_get_pid(app_context, &pid); if(ret != APP_MANAGER_ERROR_NONE) { - LogDebug("Fail to get pid of terminated app (" << ret << ")"); + LoggerD("Fail to get pid of terminated app (" << ret << ")"); return; } @@ -97,21 +97,21 @@ namespace { ret = app_manager_get_app_info(appId, &handle); if (ret < 0) { - LogDebug("Fail to get appinfo by " << appId); + LoggerD("Fail to get appinfo by " << appId); return NULL; } ret = app_info_get_package(handle, &pkgName); if (ret < 0) { - LogDebug("Fail to get pkgName by " << appId); + LoggerD("Fail to get pkgName by " << appId); pkgName = NULL; } ret = app_info_destroy(handle); if (ret < 0) { - LogDebug("Fail to get destory appinfo"); + LoggerD("Fail to get destory appinfo"); return NULL; } @@ -138,14 +138,14 @@ namespace { ret = app_context_get_app_id(app_context, &app_id); if((ret != APP_MANAGER_ERROR_NONE) || (app_id == NULL)) { - LogDebug("app_context_get_app_id error (" << ret << ")"); + LoggerD("app_context_get_app_id error (" << ret << ")"); return false; } ret = app_context_get_pid(app_context, &pid); if(ret != APP_MANAGER_ERROR_NONE) { - LogDebug("app_context_get_app_id error (" << ret << ")"); + LoggerD("app_context_get_app_id error (" << ret << ")"); if (app_id) free(app_id); return false; @@ -174,7 +174,7 @@ namespace { static void service_reply_callback(service_h request, service_h reply, service_result_e result, void *user_data) { - LogDebug("appControlResultCallback called"); + LoggerD("appControlResultCallback called"); LaunchAppControlPendingEventMap::DataKeyType key = (LaunchAppControlPendingEventMap::DataKeyType)user_data; @@ -227,7 +227,7 @@ namespace { certName = "DISTRIBUTOR2_SIGNER"; break; default: - LogDebug("Unknow Cert type!!!"); + LoggerD("Unknow Cert type!!!"); break; } @@ -243,19 +243,19 @@ namespace { static int get_current_app_id(char** app_id) { - LogDebug("get_current_app_id enter"); + LoggerD("get_current_app_id enter"); int parent_pid = getppid(); - LogDebug("parent pid : " << parent_pid); + LoggerD("parent pid : " << parent_pid); int ret = app_manager_get_app_id(parent_pid, app_id); if ((ret != APP_MANAGER_ERROR_NONE) || (app_id == NULL)) { - LogDebug("Cannot get app id from pid : " << parent_pid); + LoggerD("Cannot get app id from pid : " << parent_pid); } else { - LogDebug("appid : " << *app_id); + LoggerD("appid : " << *app_id); } return ret; @@ -263,7 +263,7 @@ namespace { static int category_cb(const char *category, void *user_data) { - //LogDebug("enter"); + //LoggerD("enter"); if (category == NULL) return true; @@ -287,40 +287,40 @@ namespace { ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &pkginfo_h); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get package info"); + LoggerD("Fail to get package info"); } ret = pkgmgrinfo_pkginfo_get_version(pkginfo_h, &version); if ((ret != PMINFO_R_OK) || (version == NULL)) { - LogDebug("Fail to get version"); + LoggerD("Fail to get version"); } else { appInfo->setVersion(version); } ret = pkgmgrinfo_pkginfo_get_total_size(pkginfo_h, &total_size); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get total size"); + LoggerD("Fail to get total size"); } else { appInfo->setInstallSize(total_size); } ret = pkgmgrinfo_pkginfo_get_installed_time(pkginfo_h, &installed_time); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get installed time"); + LoggerD("Fail to get installed time"); } else { appInfo->setInstallDate(installed_time); } ret = pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get destroy pkginfo"); + LoggerD("Fail to get destroy pkginfo"); } - LogDebug("6"); + LoggerD("6"); } static ApplicationInformationPtr create_app_info(pkgmgrinfo_appinfo_h handle) { - //LogDebug("enter"); + //LoggerD("enter"); char* appId = NULL; //char* packageId = NULL; char* name = NULL; @@ -332,40 +332,40 @@ namespace { ApplicationInformationPtr appInfo(new ApplicationInformation()); ret = pkgmgrinfo_appinfo_get_appid(handle, &appId); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get name by " << appId); + LoggerD("Fail to get name by " << appId); } else { appInfo->setAppId(appId); } ret = pkgmgrinfo_appinfo_get_label(handle, &name); if ((ret != PMINFO_R_OK) || (name == NULL)) { - LogDebug("Fail to get name by " << appId); + LoggerD("Fail to get name by " << appId); } else { appInfo->setName(name); } ret = pkgmgrinfo_appinfo_get_icon(handle, &iconPath); if ((ret != PMINFO_R_OK) || (iconPath == NULL)) { - LogDebug("Fail to get icon by " << appId); + LoggerD("Fail to get icon by " << appId); } else { appInfo->setIconPath(iconPath); } ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &noDisplay); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get nodisplay by " << appId); + LoggerD("Fail to get nodisplay by " << appId); } else { appInfo->setShow(!noDisplay); } ret = pkgmgrinfo_appinfo_foreach_category(handle, category_cb, (void*)appInfo.Get()); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get categories " << appId); + LoggerD("Fail to get categories " << appId); } ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId); if ((ret != PMINFO_R_OK) || (pkgId == NULL)) { - LogDebug("Fail to get pkg Id by " << appId); + LoggerD("Fail to get pkg Id by " << appId); } else { appInfo->setPackageId(pkgId); } @@ -380,11 +380,11 @@ namespace { ret = pkgmgrinfo_appinfo_get_pkgname(handle, &packageId); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get package id with appId : " << appId); + LoggerD("Fail to get package id with appId : " << appId); return appInfo; } - LogDebug("package id : " << packageId); + LoggerD("package id : " << packageId); set_additional_app_info(appInfo, packageId); #endif @@ -396,7 +396,7 @@ namespace { static int installed_app_info_cb(pkgmgrinfo_appinfo_h handle, void *user_data) { - //LogDebug("enter"); + //LoggerD("enter"); ApplicationInformationPtr appInfo = create_app_info(handle); ApplicationInformationArray *appInfoArray = (ApplicationInformationArray*)user_data; appInfoArray->push_back(appInfo); @@ -409,14 +409,14 @@ namespace { { if(appid == NULL) { - LogWarning("appid is NULL"); + LoggerW("appid is NULL"); return false; } //ApplicationInformationPtr appInfo(new ApplicationInformation(appid)); pkgmgrinfo_appinfo_h handle; int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); if (ret != PMINFO_R_OK) { - LogWarning("Fail to get appInfo from appId : " << appid); + LoggerW("Fail to get appInfo from appId : " << appid); } ApplicationInformationPtr appInfo = create_app_info(handle); pkgmgrinfo_appinfo_destroy_appinfo(handle); @@ -565,7 +565,7 @@ void ApplicationManager::removeAppInfoEventListener(const EventApplicationRemove void ApplicationManager::getAppCerts(const EventApplicationGetAppCertsPtr& event) { - LogError("ApplicationManager::getAppCerts"); + LoggerE("ApplicationManager::getAppCerts"); if (m_initialized == false) { initialize(); } @@ -576,7 +576,7 @@ void ApplicationManager::getAppCerts(const EventApplicationGetAppCertsPtr& event void ApplicationManager::getAppSharedURI(const EventApplicationGetAppSharedURIPtr& event) { - LogError("ApplicationManager::getAppSharedURI"); + LoggerE("ApplicationManager::getAppSharedURI"); if (m_initialized == false) { initialize(); } @@ -595,7 +595,7 @@ void ApplicationManager::invokeManualAnswerLaunchAppControl(service_h request, s if(result == SERVICE_RESULT_SUCCEEDED) { - LogDebug("SERVICE_RESULT_SUCCEEDED in serviceResultCallback"); + LoggerD("SERVICE_RESULT_SUCCEEDED in serviceResultCallback"); // create new service object to store result. ApplicationControlDataArrayPtr appControlDataArray(new ApplicationControlDataArray()); @@ -604,17 +604,17 @@ void ApplicationManager::invokeManualAnswerLaunchAppControl(service_h request, s if( result == SERVICE_ERROR_NONE) { event->setAppControlDataArray(appControlDataArray); - LogDebug("service_foreach_extra_data() success"); + LoggerD("service_foreach_extra_data() success"); } else { - LogDebug("service_foreach_extra_data() failed"); + LoggerD("service_foreach_extra_data() failed"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); } } else if(result == SERVICE_RESULT_FAILED || result == SERVICE_RESULT_CANCELED) { - LogDebug("SERVICE_RESULT_FAILED in serviceResultCallback : " <setExceptionCode(Commons::ExceptionCodes::NotFoundException); } @@ -632,7 +632,7 @@ void ApplicationManager::invokeManualAnswerKill(int pid) EventApplicationKillPtr event = it->second; m_killEventMap.erase(it); - LogDebug("Calling kill success callback for pid : " << pid); + LoggerD("Calling kill success callback for pid : " << pid); EventRequestReceiver::ManualAnswer(event); } @@ -643,13 +643,13 @@ bool ApplicationManager::service_extra_data_callback(service_h service, const ch int ret = 0; ApplicationControlDataArray* appControlDataArray = (ApplicationControlDataArray*)user_data; - LogDebug(" key : " << key); + LoggerD(" key : " << key); bool isArray = false; ret = service_is_extra_data_array(service, key, &isArray); if (ret != SERVICE_ERROR_NONE) { - LogDebug("service_is_extra_data_array passes error"); + LoggerD("service_is_extra_data_array passes error"); // fail to checking. go to next extra data. return true; } @@ -665,12 +665,12 @@ bool ApplicationManager::service_extra_data_callback(service_h service, const ch switch(ret) { case SERVICE_ERROR_NONE: { - LogDebug("service_get_extra_data success"); + LoggerD("service_get_extra_data success"); std::vector valArray; - LogDebug("value length : " << length); + LoggerD("value length : " << length); for (int i = 0; i < length; i++) { - LogDebug("value : " << value[i]); + LoggerD("value : " << value[i]); if(value[i]) { valArray.push_back(value[i]); @@ -692,16 +692,16 @@ bool ApplicationManager::service_extra_data_callback(service_h service, const ch break; } case SERVICE_ERROR_INVALID_PARAMETER: - LogDebug("service_get_extra_data retuns SERVICE_ERROR_INVALID_PARAMETER"); + LoggerD("service_get_extra_data retuns SERVICE_ERROR_INVALID_PARAMETER"); break; case SERVICE_ERROR_KEY_NOT_FOUND: - LogDebug("service_get_extra_data retuns SERVICE_ERROR_KEY_NOT_FOUND"); + LoggerD("service_get_extra_data retuns SERVICE_ERROR_KEY_NOT_FOUND"); break; case SERVICE_ERROR_OUT_OF_MEMORY: - LogDebug("service_get_extra_data retuns SERVICE_ERROR_OUT_OF_MEMORY"); + LoggerD("service_get_extra_data retuns SERVICE_ERROR_OUT_OF_MEMORY"); break; default: - LogDebug("service_get_extra_data retuns Error"); + LoggerD("service_get_extra_data retuns Error"); break; } } @@ -716,11 +716,11 @@ bool ApplicationManager::service_extra_data_callback(service_h service, const ch { if(value == NULL) { - LogDebug("service_get_extra_data returns NULL"); + LoggerD("service_get_extra_data returns NULL"); break; } - LogDebug("service_get_extra_data success"); - LogDebug("key = "<setApp(m_app); return; } @@ -775,7 +775,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetCurrAppPtr& int ret = get_current_app_id(&app_id); if((ret != APP_ERROR_NONE) || (app_id == NULL)) { - LogError("Can not get app id from current pid (" << ret << ")"); + LoggerE("Can not get app id from current pid (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -788,7 +788,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetCurrAppPtr& pkgmgrinfo_appinfo_h handle; int ret = pkgmgrinfo_appinfo_get_appinfo(appId.c_str(), &handle); if (ret != PMINFO_R_OK) { - LogWarning("Fail to get appInfo from appId : " << appId); + LoggerW("Fail to get appInfo from appId : " << appId); } ApplicationInformationPtr appInfo = create_app_info(handle); @@ -798,7 +798,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetCurrAppPtr& ApplicationPtr app(new Application()); app->setAppInfo(appInfo); - LogDebug("set appinfo to application"); + LoggerD("set appinfo to application"); { //int pid = getpid(); int pid = getppid(); @@ -806,17 +806,17 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetCurrAppPtr& sstr << pid; app->setContextId(sstr.str()); - LogError("set pid : " << pid); + LoggerE("set pid : " << pid); } event->setApp(app); - LogDebug("set application to event "); + LoggerD("set application to event "); m_app = app; } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppInfo : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppInfo : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } @@ -825,7 +825,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetCurrAppPtr& void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -835,12 +835,12 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even std::string appId = event->getAppId(); if(appId.empty()) { - LogError("App id is empty"); + LoggerE("App id is empty"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } - LogDebug("Launching app id : " << appId); + LoggerD("Launching app id : " << appId); // if the application is running, send raise event to the app instead of reset the application. #if 1 @@ -854,7 +854,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even // delay 300ms for each retry usleep(300 * 1000); retry++; - LogDebug("retry launch request : " << retry); + LoggerD("retry launch request : " << retry); } if (ret < 0) { @@ -862,20 +862,20 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even { case AUL_R_EINVAL: case AUL_R_ERROR: - LogDebug("aul_open_app returns Not Found error"); + LoggerD("aul_open_app returns Not Found error"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); break; case AUL_R_ECOMM: - LogDebug("aul_open_app returns internal IPC error"); + LoggerD("aul_open_app returns internal IPC error"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); break; default: - LogDebug("aul_open_app returns Unknown error"); + LoggerD("aul_open_app returns Unknown error"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); break; } } else { - LogDebug("callee's pid " << ret); + LoggerD("callee's pid " << ret); } #else service_h service; @@ -895,7 +895,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even // delay 300ms for each retry usleep(300 * 1000); retry++; - LogDebug("retry launch request : " << retry); + LoggerD("retry launch request : " << retry); } service_destroy(service); @@ -905,20 +905,20 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even switch (ret) { case SERVICE_ERROR_INVALID_PARAMETER: - LogDebug("service_send_launch_request returns SERVICE_ERROR_INVALID_PARAMETER"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_INVALID_PARAMETER"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); break; case SERVICE_ERROR_OUT_OF_MEMORY: - LogDebug("service_send_launch_request returns SERVICE_ERROR_OUT_OF_MEMORY"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_OUT_OF_MEMORY"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); break; case SERVICE_ERROR_LAUNCH_REJECTED: case SERVICE_ERROR_APP_NOT_FOUND: - LogDebug("service_send_launch_request returns SERVICE_ERROR_APP_NOT_FOUND"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_APP_NOT_FOUND"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); break; default: - LogDebug("service_send_launch_request returns UNKNOWN ERROR!!! (" << ret << ")"); + LoggerD("service_send_launch_request returns UNKNOWN ERROR!!! (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); break; } @@ -929,14 +929,14 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchPtr& even } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on launch : " << _rethrown_exception.GetMessage()); + LoggerE("Error on launch : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -945,18 +945,18 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) if(contextId.empty()) { - LogError("Context id is empty"); + LoggerE("Context id is empty"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } - LogDebug("Killing context id : " << contextId); + LoggerD("Killing context id : " << contextId); int pid; std::stringstream(contextId) >> pid; if(pid <= 0) { - LogError("Context id is wrong : " << pid); + LoggerE("Context id is wrong : " << pid); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -972,7 +972,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) ret = app_manager_get_app_id(pid, &appIdCStr); if (ret != APP_MANAGER_ERROR_NONE) { - LogError("Error while getting app id (" << ret << ")"); + LoggerE("Error while getting app id (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -984,7 +984,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) ret = app_manager_get_app_context (appId.c_str(), &appContext); if (ret != APP_MANAGER_ERROR_NONE) { - LogError("Error while getting app context (" << ret << ")"); + LoggerE("Error while getting app context (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -993,7 +993,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) ret = app_manager_set_app_context_event_cb(app_manager_app_context_event_callback, this); if (ret != APP_MANAGER_ERROR_NONE) { - LogError("Error while registering app context event (" << ret << ")"); + LoggerE("Error while registering app context event (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); return; } @@ -1001,7 +1001,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) ret = app_manager_terminate_app(appContext); if (ret != APP_MANAGER_ERROR_NONE) { - LogError("Error while terminating app (" << ret << ")"); + LoggerE("Error while terminating app (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); return; } @@ -1012,14 +1012,14 @@ void ApplicationManager::OnRequestReceived(const EventApplicationKillPtr& event) } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on kill : " << _rethrown_exception.GetMessage()); + LoggerE("Error on kill : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppControlPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1029,7 +1029,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro ApplicationControlPtr appControl = event->getAppControl(); if(appControl == NULL) { - LogError("appControl is NULL"); + LoggerE("appControl is NULL"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } @@ -1037,7 +1037,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro std::string operation = appControl->getOperation(); if(operation.empty()) { - LogDebug("operation being madatory is empty"); + LoggerD("operation being madatory is empty"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } @@ -1049,7 +1049,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro if (!appId.empty()) { - LogDebug(" app id : " << appId); + LoggerD(" app id : " << appId); // Application exist checking. if specific application is not exist, return Not Found Exception. app_info_h info_h; @@ -1065,26 +1065,26 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro } service_set_operation(service, operation.c_str() ); - LogDebug(" operation : " << operation); + LoggerD(" operation : " << operation); std::string uri = appControl->getUri(); if (!uri.empty()) { - LogDebug(" uri : " << uri); + LoggerD(" uri : " << uri); service_set_uri(service, uri.c_str() ); } std::string mime = appControl->getMime(); if (!mime.empty()) { - LogDebug(" mime : " << mime); + LoggerD(" mime : " << mime); service_set_mime(service, mime.c_str() ); } std::string category = appControl->getCategory(); if (!category.empty()) { - LogDebug(" category : " << category); + LoggerD(" category : " << category); service_set_category(service, category.c_str() ); } @@ -1092,7 +1092,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro if(!appControlDataArray.empty()) { - LogDebug(" datas : " << appControlDataArray.size()); + LoggerD(" datas : " << appControlDataArray.size()); ApplicationControlDataArray::iterator iter; for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++) @@ -1100,7 +1100,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro ApplicationControlDataPtr appControlData = *iter; std::string key = appControlData->getKey(); - LogDebug(" key : " << key); + LoggerD(" key : " << key); if(key.empty()) { @@ -1116,7 +1116,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro for (size_t j = 0; j < size; j++) { arr[j] = valueArray.at(j).c_str(); - LogDebug(" value : " << arr[j]); + LoggerD(" value : " << arr[j]); } // @20121207-wscho: roll-back to return extra-data instead of extra-data array when the value size is one. @@ -1152,7 +1152,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro // delay 300ms for each retry usleep(300 * 1000); retry++; - LogDebug("retry launch request : " << retry); + LoggerD("retry launch request : " << retry); } service_destroy(service); @@ -1162,23 +1162,23 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro switch (ret) { case SERVICE_ERROR_INVALID_PARAMETER: - LogDebug("service_send_launch_request returns SERVICE_ERROR_INVALID_PARAMETER"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_INVALID_PARAMETER"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); break; case SERVICE_ERROR_OUT_OF_MEMORY: - LogDebug("service_send_launch_request returns SERVICE_ERROR_OUT_OF_MEMORY"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_OUT_OF_MEMORY"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); break; case SERVICE_ERROR_LAUNCH_REJECTED: - LogDebug("service_send_launch_request returns SERVICE_ERROR_LAUNCH_REJECTED!!!"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_LAUNCH_REJECTED!!!"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); break; case SERVICE_ERROR_APP_NOT_FOUND: - LogDebug("service_send_launch_request returns SERVICE_ERROR_APP_NOT_FOUND"); + LoggerD("service_send_launch_request returns SERVICE_ERROR_APP_NOT_FOUND"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); break; default: - LogDebug("service_send_launch_request returns UNKNOWN ERROR!!!"); + LoggerD("service_send_launch_request returns UNKNOWN ERROR!!!"); event->setExceptionCode(Commons::ExceptionCodes::UnknownException); break; } @@ -1197,27 +1197,27 @@ void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppContro } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on launchAppControl : " << _rethrown_exception.GetMessage()); + LoggerE("Error on launchAppControl : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationLaunchAppControlReplyPtr& event) { - LogDebug("entered"); + LoggerD("entered"); event->switchToManualAnswer(); } void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { ApplicationControlPtr appControl = event->getAppControl(); if(appControl == NULL) { - LogError("appControl is NULL"); + LoggerE("appControl is NULL"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } @@ -1225,7 +1225,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP std::string operation = appControl->getOperation(); if(operation.empty()) { - LogDebug("operation being madatory is empty"); + LoggerD("operation being madatory is empty"); event->setExceptionCode(Commons::ExceptionCodes::InvalidArgumentException); return; } @@ -1234,26 +1234,26 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP service_create(&service); service_set_operation(service, operation.c_str() ); - LogDebug(" operation : " << operation); + LoggerD(" operation : " << operation); std::string uri = appControl->getUri(); if (!uri.empty()) { - LogDebug(" uri : " << uri); + LoggerD(" uri : " << uri); service_set_uri(service, uri.c_str() ); } std::string mime = appControl->getMime(); if (!mime.empty()) { - LogDebug(" mime : " << mime); + LoggerD(" mime : " << mime); service_set_mime(service, mime.c_str() ); } std::string category = appControl->getCategory(); if (!category.empty()) { - LogDebug(" category : " << category); + LoggerD(" category : " << category); service_set_category(service, category.c_str() ); } @@ -1261,7 +1261,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP if(!appControlDataArray.empty()) { - LogDebug(" datas : " << appControlDataArray.size()); + LoggerD(" datas : " << appControlDataArray.size()); ApplicationControlDataArray::iterator iter; for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++) @@ -1269,7 +1269,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP ApplicationControlDataPtr appControlData = *iter; std::string key = appControlData->getKey(); - LogDebug(" key : " << key); + LoggerD(" key : " << key); if(key.empty()) { @@ -1285,7 +1285,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP for (size_t j = 0; j < size; j++) { arr[j] = valueArray.at(j).c_str(); - LogDebug(" value : " << arr[j]); + LoggerD(" value : " << arr[j]); } // @20121207-wscho: roll-back to return extra-data instead of extra-data array when the value size is one. @@ -1306,7 +1306,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP int result = service_foreach_app_matched(service, service_app_matched_callback, (void *)appInfos.Get()); if (result != SERVICE_ERROR_NONE) { - LogError("service_foreach_app_matched error (" << result << ")"); + LoggerE("service_foreach_app_matched error (" << result << ")"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); service_destroy(service); return; @@ -1318,7 +1318,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on findAppControl : " << _rethrown_exception.GetMessage()); + LoggerE("Error on findAppControl : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -1326,7 +1326,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationFindAppControlP void ApplicationManager::OnRequestReceived(const EventApplicationGetAppsContextPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1336,32 +1336,32 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppsContextP ret = app_manager_foreach_app_context(app_manager_app_context_callback, appContextArray.Get()); if(ret != APP_MANAGER_ERROR_NONE) { - LogError("app_manager_foreach_app_context error (" << ret << ")"); + LoggerE("app_manager_foreach_app_context error (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on : " << _rethrown_exception.GetMessage()); + LoggerE("Error on : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationGetAppContextPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { int ret = 0; std::string contextId = event->getAppContextId(); - LogDebug("contextId : " << contextId); + LoggerD("contextId : " << contextId); int pid; if (contextId.empty()) { - LogDebug("empty"); + LoggerD("empty"); //pid = getpid(); pid = getppid(); @@ -1371,11 +1371,11 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppContextPt } else { - LogDebug("not empty"); + LoggerD("not empty"); std::stringstream(contextId) >> pid; if (pid <= 0) { - LogError("contextId is wrong : " << contextId); + LoggerE("contextId is wrong : " << contextId); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -1390,11 +1390,11 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppContextPt { case APP_MANAGER_ERROR_NO_SUCH_APP: case APP_MANAGER_ERROR_INVALID_PARAMETER: - LogError("app_manager_get_app_id error : no such app"); + LoggerE("app_manager_get_app_id error : no such app"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); break; default: - LogError("app_manager_get_app_id error (" << ret << ")"); + LoggerE("app_manager_get_app_id error (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); break; } @@ -1416,14 +1416,14 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppContextPt } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppContext : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppContext : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationGetAppsInfoPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1431,20 +1431,20 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppsInfoPtr& ApplicationInformationArrayPtr appInfoArray = event->getAppInfoArray(); ret = pkgmgrinfo_appinfo_get_installed_list(installed_app_info_cb, (void*)appInfoArray.Get()); if (ret != PMINFO_R_OK) { - LogError("Error on getAppsInfo : "); + LoggerE("Error on getAppsInfo : "); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppsInfo : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppsInfo : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationGetAppInfoPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1458,7 +1458,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppInfoPtr& int ret = get_current_app_id(&app_id); if((ret != APP_ERROR_NONE) || (app_id == NULL)) { - LogError("Can not get app id from current pid (" << ret << ")"); + LoggerE("Can not get app id from current pid (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -1478,14 +1478,14 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppInfoPtr& } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppInfo : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppInfo : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationAddAppInfoEventListenerPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1493,7 +1493,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationAddAppInfoEvent if(m_installedApplicationsEmitters.size() == 0) { - LogDebug("First time registering event listener to this application object."); + LoggerD("First time registering event listener to this application object."); // Below can throw Exception AppManagerWrapperSingleton::Instance().registerAppListChangedCallbacks(this); @@ -1509,14 +1509,14 @@ void ApplicationManager::OnRequestReceived(const EventApplicationAddAppInfoEvent } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on addAppInfoEventListener : " << _rethrown_exception.GetMessage()); + LoggerE("Error on addAppInfoEventListener : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } void ApplicationManager::OnRequestReceived(const EventApplicationRemoveAppInfoEventListenerPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1534,19 +1534,19 @@ void ApplicationManager::OnRequestReceived(const EventApplicationRemoveAppInfoEv if(m_installedApplicationsEmitters.size() == 0) { - LogDebug("No more event listener on this application object."); + LoggerD("No more event listener on this application object."); AppManagerWrapperSingleton::Instance().unregisterAppListChangedCallbacks(this); } } Catch (WrtDeviceApis::Commons::NotFoundException) { - LogError("Not found : " << _rethrown_exception.GetMessage()); + LoggerE("Not found : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on removeAppInfoEventListener : " << _rethrown_exception.GetMessage()); + LoggerE("Error on removeAppInfoEventListener : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -1554,7 +1554,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationRemoveAppInfoEv void ApplicationManager::OnRequestReceived(const EventApplicationGetAppCertsPtr& event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1569,7 +1569,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppCertsPtr& int ret = get_current_app_id(&tmp); if((ret != APP_ERROR_NONE) || (tmp == NULL)) { - LogError("Can not get app id from current pid (" << ret << ")"); + LoggerE("Can not get app id from current pid (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -1582,12 +1582,12 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppCertsPtr& char* package = getPackageByAppId(appId.c_str()); if (package == NULL) { - LogError("Can not get package from appId (" << appId << ")"); + LoggerE("Can not get package from appId (" << appId << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } - LogDebug("package : " << package); + LoggerD("package : " << package); package_info_h pkg_info; int result = 0; @@ -1609,11 +1609,11 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppCertsPtr& event->setAppCerts(certArray); - LogDebug("Finish to getting package cert info"); + LoggerD("Finish to getting package cert info"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Error on getAppInfo : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getAppInfo : " << _rethrown_exception.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -1624,19 +1624,19 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppCertsPtr& void ApplicationManager::OnRequestReceived(const EventApplicationGetAppSharedURIPtr& event) { - LogError("ApplicationManager::getAppCerts"); + LoggerE("ApplicationManager::getAppCerts"); std::string id = event->getAppId(); std::string appId; int ret = 0; - LogError("appId(" << id << ")"); + LoggerE("appId(" << id << ")"); if (id.empty()) { char *app_id = NULL; //int ret = app_get_id(&app_id); // webkit2 patch. ret = get_current_app_id(&app_id); if((ret != APP_ERROR_NONE) || (app_id == NULL)) { - LogError("Can not get app id from current pid (" << ret << ")"); + LoggerE("Can not get app id from current pid (" << ret << ")"); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } @@ -1650,21 +1650,21 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppSharedURI char* pkg_name = NULL; ret = app_manager_get_app_info(appId.c_str(), &handle); if (ret != APP_ERROR_NONE) { - LogDebug("Fail to get appinfo by " << appId); + LoggerD("Fail to get appinfo by " << appId); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } ret = app_info_get_package(handle, &pkg_name); if ((ret != APP_ERROR_NONE) || (pkg_name == NULL)) { - LogDebug("Fail to get pkg_name by " << appId); + LoggerD("Fail to get pkg_name by " << appId); event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); return; } app_info_destroy(handle); - LogError("pkg_name(" << pkg_name << ")"); + LoggerE("pkg_name(" << pkg_name << ")"); pkgmgrinfo_pkginfo_h pkginfo_h; char* root_path = NULL; @@ -1678,19 +1678,19 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppSharedURI ret = pkgmgrinfo_pkginfo_get_root_path(pkginfo_h, &root_path); if ((ret != PMINFO_R_OK) && (root_path != NULL)) { - LogDebug("Fail to get root path"); + LoggerD("Fail to get root path"); free(pkg_name); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); return; } - LogError("pkg_name(" << root_path << ")"); + LoggerE("pkg_name(" << root_path << ")"); std::string sharedURI = TIZENAPIS_APP_FILE_SCHEME + std::string(root_path) + TIZENAPIS_APP_SLASH + std::string(pkg_name) + TIZENAPIS_APP_SLASH + TIZENAPIS_APP_SHARED; free(pkg_name); - LogError("sharedURI(" << sharedURI << ")"); + LoggerE("sharedURI(" << sharedURI << ")"); pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_h); @@ -1701,7 +1701,7 @@ void ApplicationManager::OnRequestReceived(const EventApplicationGetAppSharedURI void ApplicationManager::onAppManagerEventInstalled(const char *appId) { - LogDebug("APP_MANAGER_EVENT_INSTALLED, appId : "<< appId); + LoggerD("APP_MANAGER_EVENT_INSTALLED, appId : "<< appId); EventApplicationAppInfoEventListenerPtr event(new EventApplicationAppInfoEventListener()); @@ -1721,7 +1721,7 @@ void ApplicationManager::onAppManagerEventInstalled(const char *appId) void ApplicationManager::onAppManagerEventUninstalled(const char *appId) { - LogDebug("APP_MANAGER_EVENT_UNINSTALLED, appId : "<< appId); + LoggerD("APP_MANAGER_EVENT_UNINSTALLED, appId : "<< appId); EventApplicationAppInfoEventListenerPtr event(new EventApplicationAppInfoEventListener()); @@ -1734,7 +1734,7 @@ void ApplicationManager::onAppManagerEventUninstalled(const char *appId) void ApplicationManager::onAppManagerEventUpdated(const char *appId) { - LogDebug("APP_MANAGER_EVENT_UPDATED, appId : "<< appId); + LoggerD("APP_MANAGER_EVENT_UPDATED, appId : "<< appId); EventApplicationAppInfoEventListenerPtr event(new EventApplicationAppInfoEventListener()); diff --git a/src/Application/ApplicationManager.h b/src/Application/ApplicationManager.h index b94b3ee..ccfea50 100644 --- a/src/Application/ApplicationManager.h +++ b/src/Application/ApplicationManager.h @@ -186,7 +186,7 @@ public: DataPtrType dataPtr = getData(*keySetIter); if(dataPtr == NULL) { - LogWarning("No data for " << *keySetIter); + LoggerW("No data for " << *keySetIter); break; } @@ -202,7 +202,7 @@ public: if(dataKeyIter == m_dataMap.end()) { - LogDebug("No data for " << dataKey); + LoggerD("No data for " << dataKey); return; } @@ -213,7 +213,7 @@ public: typename KeyMapType::iterator keyMapIter = m_keyMap.find(key); if(keyMapIter == m_keyMap.end()) { - LogWarning("No data for Key"); + LoggerW("No data for Key"); return; } @@ -221,7 +221,7 @@ public: DataKeySetType::iterator keySetIter = keySet.find(dataKey); if(keySetIter == keySet.end()) { - LogWarning("No data for " << dataKey); + LoggerW("No data for " << dataKey); return; } @@ -233,7 +233,7 @@ public: typename KeyMapType::iterator keyMapIter = m_keyMap.find(key); if(keyMapIter == m_keyMap.end()) { - LogDebug("No data to erase."); + LoggerD("No data to erase."); return; } @@ -244,7 +244,7 @@ public: typename DataMapType::iterator dataKeyIter = m_dataMap.find(*keySetIter); if(dataKeyIter == m_dataMap.end()) { - LogWarning("No data to erase."); + LoggerW("No data to erase."); break; } diff --git a/src/Application/CMakeLists.txt b/src/Application/CMakeLists.txt old mode 100755 new mode 100644 diff --git a/src/Application/EventApplicationFindAppControl.h b/src/Application/EventApplicationFindAppControl.h index 0391ccc..ddd3abf 100755 --- a/src/Application/EventApplicationFindAppControl.h +++ b/src/Application/EventApplicationFindAppControl.h @@ -18,12 +18,11 @@ #ifndef TIZENAPIS_API_APPLICATION_EVENT_FIND_APP_CONTROL_H_ #define TIZENAPIS_API_APPLICATION_EVENT_FIND_APP_CONTROL_H_ - -#include #include #include #include "ApplicationInformation.h" #include "ApplicationControl.h" +#include namespace DeviceAPI { namespace Application { diff --git a/src/Application/JSApplication.cpp b/src/Application/JSApplication.cpp index 64645fc..9b88fd5 100644 --- a/src/Application/JSApplication.cpp +++ b/src/Application/JSApplication.cpp @@ -95,21 +95,21 @@ JSClassRef JSApplication::getClassRef() { void JSApplication::initialize(JSContextRef context, JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSApplication::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting JSApplication object"); + LoggerD("Deleting JSApplication object"); delete priv; } JSValueRef JSApplication::makeObject(JSContextRef ctx, const ApplicationPtr value) { - LogInfo("entered to ApplicationPtr "); + LoggerI("entered to ApplicationPtr "); if(value == NULL) { throw TypeMismatchException("Private object is NULL."); } @@ -161,7 +161,7 @@ JSValueRef JSApplication::getProperty(JSContextRef context, return converter->toJSValueRef(privateData->getContextId()); } } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSTizenExceptionFactory::postException(context, exception,JSTizenException::INVALID_VALUES_ERROR, "Invalid value error"); } @@ -176,7 +176,7 @@ JSValueRef JSApplication::exit(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -199,7 +199,7 @@ JSValueRef JSApplication::hide(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -223,7 +223,7 @@ JSValueRef JSApplication::getRequestedAppControl(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); JSApplicationPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); @@ -244,7 +244,7 @@ JSValueRef JSApplication::getRequestedAppControl(JSContextRef context, ScopedJSStringRef(JSStringCreateWithUTF8CString("__bundle")).get(), exception); if (JSValueIsUndefined(context, encodedBundle) || JSValueIsNull(context, encodedBundle)) { - LogError("encodedBundle"+converter->toString(encodedBundle)); + LoggerE("encodedBundle"+converter->toString(encodedBundle)); return JSValueMakeNull(context); } diff --git a/src/Application/JSApplicationCert.cpp b/src/Application/JSApplicationCert.cpp index 2f07ec8..8da497c 100644 --- a/src/Application/JSApplicationCert.cpp +++ b/src/Application/JSApplicationCert.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include "ApplicationCert.h" #include "JSApplicationCert.h" +#include namespace DeviceAPI { namespace Application { @@ -76,15 +76,15 @@ JSClassRef JSApplicationCert::getClassRef() { void JSApplicationCert::initialize(JSContextRef context, JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSApplicationCert::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationCertPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting JSApplicationCert object"); + LoggerD("Deleting JSApplicationCert object"); delete priv; } @@ -116,7 +116,7 @@ JSValueRef JSApplicationCert::getProperty(JSContextRef context, CommonsJavaScript::Converter converter(context); ApplicationCertPtr privateData = getPrivData(object); - LogError("JSApplicationCert::getProperty = " << propertyName); + LoggerE("JSApplicationCert::getProperty = " << propertyName); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CERT_TYPE)) { return converter.toJSValueRef(privateData->getType()); diff --git a/src/Application/JSApplicationContext.cpp b/src/Application/JSApplicationContext.cpp index 12e4739..1c4afa4 100644 --- a/src/Application/JSApplicationContext.cpp +++ b/src/Application/JSApplicationContext.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -27,6 +25,7 @@ //#include #include "ApplicationContext.h" #include "JSApplicationContext.h" +#include namespace DeviceAPI { namespace Application { @@ -81,7 +80,7 @@ JSValueRef JSApplicationContext::createJSObject(JSContextRef context, JSObjectRef jsValueRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsValueRef) { - LogError("object creation error"); + LoggerE("object creation error"); return JSValueMakeUndefined(context); } @@ -90,15 +89,15 @@ JSValueRef JSApplicationContext::createJSObject(JSContextRef context, void JSApplicationContext::initialize(JSContextRef context, JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSApplicationContext::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationContextPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting JSApplicationContext object"); + LoggerD("Deleting JSApplicationContext object"); delete priv; } diff --git a/src/Application/JSApplicationControl.cpp b/src/Application/JSApplicationControl.cpp index 65108c9..49b0b2f 100644 --- a/src/Application/JSApplicationControl.cpp +++ b/src/Application/JSApplicationControl.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -26,6 +24,7 @@ #include #include #include +#include //#include //#include @@ -92,7 +91,7 @@ const JSClassRef JSApplicationControl::getClassRef() JSObjectRef JSApplicationControl::createJSObject(JSContextRef context, const ApplicationControlPtr &appsvc) { - LogInfo(">> createJSObject"); + LoggerI(">> createJSObject"); JSApplicationControlPriv *priv = new JSApplicationControlPriv(context, appsvc); if (!priv) { @@ -135,15 +134,15 @@ ApplicationControlPtr JSApplicationControl::getPrivateData(JSContextRef context, void JSApplicationControl::initialize(JSContextRef context,JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSApplicationControl::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationControlPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting ApplicationControl object"); + LoggerD("Deleting ApplicationControl object"); delete priv; } @@ -195,7 +194,7 @@ bool JSApplicationControl::isObjectOfClass(JSContextRef context, JSValueRef valu ApplicationControlPtr JSApplicationControl::getPrivData(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSApplicationControlPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { throw TypeMismatchException("Private object is null"); @@ -221,11 +220,11 @@ JSValueRef JSApplicationControl::getProperty(JSContextRef context, JSObjectRef o ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL_OPERATION)) { - LogDebug("JSApplicationControl::getProperty::operation " << appsvc->getOperation()); + LoggerD("JSApplicationControl::getProperty::operation " << appsvc->getOperation()); return converter->toJSValueRef(appsvc->getOperation()); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL_URI)) { std::string uri = appsvc->getUri(); - LogDebug("JSApplicationControl::getProperty::uri " << uri); + LoggerD("JSApplicationControl::getProperty::uri " << uri); if (uri.empty()) { return JSValueMakeNull(context); } else { @@ -233,7 +232,7 @@ JSValueRef JSApplicationControl::getProperty(JSContextRef context, JSObjectRef o } } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL_MIME)) { std::string mime = appsvc->getMime(); - LogDebug("JSApplicationControl::getProperty::mime " << mime); + LoggerD("JSApplicationControl::getProperty::mime " << mime); if (mime.empty()) { return JSValueMakeNull(context); } else { @@ -241,14 +240,14 @@ JSValueRef JSApplicationControl::getProperty(JSContextRef context, JSObjectRef o } } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL_CATEGORY)) { std::string category = appsvc->getCategory(); - LogDebug("JSApplicationControl::getProperty::category " << category); + LoggerD("JSApplicationControl::getProperty::category " << category); if (category.empty()) { return JSValueMakeNull(context); } else { return converter->toJSValueRef(category); } }else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL_DATA)) { - LogDebug("JSApplicationControl::getProperty::extraData "); + LoggerD("JSApplicationControl::getProperty::extraData "); return converter->toJSValueRef(appsvc->getAppControlDataArray()); } diff --git a/src/Application/JSApplicationControlData.cpp b/src/Application/JSApplicationControlData.cpp index 5c35008..67192d0 100644 --- a/src/Application/JSApplicationControlData.cpp +++ b/src/Application/JSApplicationControlData.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -26,11 +24,10 @@ //#include //#include #include -#include - #include "JSApplicationControlData.h" #include "ApplicationConverter.h" #include "ApplicationUtil.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -82,7 +79,7 @@ JSClassRef JSApplicationControlData::getClassRef() { JSObjectRef JSApplicationControlData::createJSObject(JSContextRef context, const ApplicationControlDataPtr &appdata) { - LogInfo(">> createJSObject"); + LoggerI(">> createJSObject"); JSApplicationControlDataPriv *priv = new JSApplicationControlDataPriv(context, appdata); if (!priv) { @@ -119,15 +116,15 @@ JSObjectRef JSApplicationControlData::constructor(JSContextRef context, JSObject void JSApplicationControlData::initialize(JSContextRef context, JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSApplicationControlData::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationControlDataPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting ApplicationControl object"); + LoggerD("Deleting ApplicationControl object"); delete priv; } @@ -138,7 +135,7 @@ bool JSApplicationControlData::isObjectOfClass(JSContextRef context, JSValueRef ApplicationControlDataPtr JSApplicationControlData::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSApplicationControlDataPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { throw TypeMismatchException("Private object is null"); diff --git a/src/Application/JSApplicationEventCallbackManager.cpp b/src/Application/JSApplicationEventCallbackManager.cpp old mode 100755 new mode 100644 index c26797c..c274eff --- a/src/Application/JSApplicationEventCallbackManager.cpp +++ b/src/Application/JSApplicationEventCallbackManager.cpp @@ -16,7 +16,7 @@ // #include "JSApplicationEventCallbackManager.h" -#include +#include namespace DeviceAPI { namespace Application { @@ -178,7 +178,7 @@ void JSApplicationEventCallbackManager::callOnInstalled( JSValueRef appInfo ) { if ( m_onInstalled == NULL ) { - //LogDebug("oninstalled callback is not set"); + //LoggerD("oninstalled callback is not set"); return; } JSValueRef objParam[1] = { appInfo }; @@ -189,7 +189,7 @@ void JSApplicationEventCallbackManager::callOnUpdated( JSValueRef appInfo ) { if ( m_onUpdated == NULL ) { - //LogDebug("onupdated callback is not set"); + //LoggerD("onupdated callback is not set"); return; } JSValueRef objParam[1] = { appInfo }; @@ -200,7 +200,7 @@ void JSApplicationEventCallbackManager::callOnUninstalled( JSValueRef appId ) { if ( m_onUninstalled == NULL ) { - //LogDebug("onuninstalled callback is not set"); + //LoggerD("onuninstalled callback is not set"); return; } JSValueRef objParam[1] = { appId }; @@ -211,7 +211,7 @@ void JSApplicationEventCallbackManager::callOnError( JSValueRef error ) { if ( m_onError == NULL ) { - //LogDebug("Error callback is not set"); + //LoggerD("Error callback is not set"); return; } JSValueRef objParam[1] = { error }; @@ -223,7 +223,7 @@ void JSApplicationEventCallbackManager::makeCallback(JSContextRef context, JSObj if (callback == NULL) { - LogError("callback is NULL"); + LoggerE("callback is NULL"); return; } @@ -231,12 +231,12 @@ void JSApplicationEventCallbackManager::makeCallback(JSContextRef context, JSObj { if (argc == 0) { - //LogDebug("Calling object directly, no arguments"); + //LoggerD("Calling object directly, no arguments"); JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL); } else { - //LogDebug("Calling object directly, one argument"); + //LoggerD("Calling object directly, one argument"); JSObjectCallAsFunction(context, callback, object, argc, argv, NULL); } return; diff --git a/src/Application/JSApplicationInformation.cpp b/src/Application/JSApplicationInformation.cpp index 07940c4..5385629 100644 --- a/src/Application/JSApplicationInformation.cpp +++ b/src/Application/JSApplicationInformation.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -28,6 +26,7 @@ #include "ApplicationInformation.h" #include "JSApplicationInformation.h" #include "AppManagerWrapper.h" +#include namespace DeviceAPI { namespace Application { @@ -104,7 +103,7 @@ JSValueRef JSApplicationInformation::createJSObject(JSContextRef context, JSObjectRef jsValueRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsValueRef) { - LogError("object creation error"); + LoggerE("object creation error"); return JSValueMakeUndefined(context); } @@ -113,15 +112,15 @@ JSValueRef JSApplicationInformation::createJSObject(JSContextRef context, void JSApplicationInformation::initialize(JSContextRef context, JSObjectRef object) { - //LogInfo(">> initialize"); + //LoggerI(">> initialize"); } void JSApplicationInformation::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSApplicationInformationPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting JSApplicationInformation object"); + LoggerD("Deleting JSApplicationInformation object"); delete priv; } @@ -187,7 +186,7 @@ JSValueRef JSApplicationInformation::getProperty(JSContextRef context, // below code is temporal. if package manager issue is solved, rollback this code. #if 1 // below code is used to fill attribute lazy if (!privateData->isInitialized()) { - //LogInfo(">> is Not Initialized"); + //LoggerI(">> is Not Initialized"); AppManagerWrapperSingleton::Instance().initializeAppInfo(privateData); } #endif diff --git a/src/Application/JSApplicationManager.cpp b/src/Application/JSApplicationManager.cpp index 7133eb5..309a35d 100644 --- a/src/Application/JSApplicationManager.cpp +++ b/src/Application/JSApplicationManager.cpp @@ -116,7 +116,7 @@ const JSClassDefinition* JSApplicationManager::getClassInfo() void JSApplicationManager::initialize(JSContextRef context, JSObjectRef object) { - LogDebug(">>> JSApplicationManager::initialize"); + LoggerD(">>> JSApplicationManager::initialize"); ApplicationController* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { @@ -124,11 +124,11 @@ void JSApplicationManager::initialize(JSContextRef context, JSObjectRef object) priv = new ApplicationController(context, applications); if (!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } else { - LogDebug("private date is already exist"); + LoggerD("private date is already exist"); } } @@ -155,7 +155,7 @@ JSValueRef JSApplicationManager::getCurrentApplication(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); IApplicationManagerPtr appmgr; ApplicationController *controller; @@ -177,7 +177,7 @@ JSValueRef JSApplicationManager::getCurrentApplication(JSContextRef context, throw UnknownException("Unknown exception occured"); } - LogError("get Current Application Successfully. convert application to JSValue"); + LoggerE("get Current Application Successfully. convert application to JSValue"); //return converter->toJSValueRefFromApplication(event->getApp()); TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -197,7 +197,7 @@ JSValueRef JSApplicationManager::launch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("launch(async)", 0); @@ -260,7 +260,7 @@ JSValueRef JSApplicationManager::kill(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("kill(async)", 0); @@ -324,7 +324,7 @@ JSValueRef JSApplicationManager::setUserAgent(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -355,7 +355,7 @@ JSValueRef JSApplicationManager::launchAppControl(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("launchAppControlReply", 0); TIME_TRACER_ITEM_BEGIN("launchAppControl(async)", 0); @@ -393,7 +393,7 @@ JSValueRef JSApplicationManager::launchAppControl(JSContextRef context, // id std::string id = validator.toString(1, true, ""); - LogWarning("id : " << id); + LoggerW("id : " << id); event->setAppId(id); // successCallback @@ -463,7 +463,7 @@ JSValueRef JSApplicationManager::findAppControl(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("findAppControl(async)", 0); try { @@ -532,7 +532,7 @@ JSValueRef JSApplicationManager::getAppsContext(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("getAppsContext(async)", 0); @@ -573,10 +573,10 @@ JSValueRef JSApplicationManager::getAppsContext(JSContextRef context, return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogDebug("BasePlatformException"); + LoggerD("BasePlatformException"); return JSWebAPIException::throwException(context, exception, err); } catch (...) { - LogDebug("etc..."); + LoggerD("etc..."); DeviceAPI::Common::UnknownException err("Unknown Error in ApplicationManager.getAppsContext()."); return JSWebAPIException::throwException(context, exception, err); } @@ -590,7 +590,7 @@ JSValueRef JSApplicationManager::getAppContext(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -609,7 +609,7 @@ JSValueRef JSApplicationManager::getAppContext(JSContextRef context, // contextId std::string contextId = validator.toString(0, true, ""); - LogDebug("contextId : " << contextId); + LoggerD("contextId : " << contextId); event->setAppContextId(contextId); event->setForSynchronousCall(); @@ -640,7 +640,7 @@ JSValueRef JSApplicationManager::getAppsInfo(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); TIME_TRACER_ITEM_BEGIN("getAppsInfo(async)", 0); @@ -697,7 +697,7 @@ JSValueRef JSApplicationManager::getAppInfo(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -747,7 +747,7 @@ JSValueRef JSApplicationManager::addAppInfoEventListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -824,7 +824,7 @@ JSValueRef JSApplicationManager::removeAppInfoEventListener(JSContextRef context const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -845,7 +845,7 @@ JSValueRef JSApplicationManager::removeAppInfoEventListener(JSContextRef context // watchId long watchId = validator.toLong(0); - LogDebug("watchId : " << watchId); + LoggerD("watchId : " << watchId); event->setWatchId(watchId); event->setForSynchronousCall(); @@ -882,7 +882,7 @@ JSValueRef JSApplicationManager::getAppCerts(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = APPLICATION_CHECK_ACCESS(APPLICATION_FUNCTION_API_GET_APP_CERTS); @@ -936,7 +936,7 @@ JSValueRef JSApplicationManager::getAppSharedURI(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try { @@ -980,7 +980,7 @@ JSValueRef JSApplicationManager::getAppSharedURI(JSContextRef context, } void JSApplicationManager::setTitleProperty(JSContextRef context, std::string propertyValue){ - LogDebug("<<>>"); + LoggerD(">>>"); } } diff --git a/src/Application/JSRequestedApplicationControl.cpp b/src/Application/JSRequestedApplicationControl.cpp index 4bc55a4..473158b 100644 --- a/src/Application/JSRequestedApplicationControl.cpp +++ b/src/Application/JSRequestedApplicationControl.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -29,10 +27,10 @@ #include #include "plugin_config.h" - #include "ApplicationConverter.h" #include "ApplicationUtil.h" #include "JSRequestedApplicationControl.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -91,7 +89,7 @@ JSClassRef JSRequestedApplicationControl::getClassRef() JSObjectRef JSRequestedApplicationControl::createJSObject(JSContextRef context, const RequestedApplicationControlPtr &appsvc) { - LogInfo(">> createJSObject"); + LoggerI(">> createJSObject"); JSRequestedApplicationControlPriv *priv = new JSRequestedApplicationControlPriv(context, appsvc); if (!priv) { @@ -105,15 +103,15 @@ JSObjectRef JSRequestedApplicationControl::createJSObject(JSContextRef context, void JSRequestedApplicationControl::initialize(JSContextRef context,JSObjectRef object) { - LogInfo(">> initialize"); + LoggerI(">> initialize"); } void JSRequestedApplicationControl::finalize(JSObjectRef object) { - LogInfo(">> finalize"); + LoggerI(">> finalize"); JSRequestedApplicationControlPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting ApplicationControl object"); + LoggerD("Deleting ApplicationControl object"); delete priv; } @@ -144,7 +142,7 @@ RequestedApplicationControlPtr JSRequestedApplicationControl::getRequestedApplic RequestedApplicationControlPtr JSRequestedApplicationControl::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSRequestedApplicationControlPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -168,14 +166,14 @@ JSValueRef JSRequestedApplicationControl::getProperty(JSContextRef context, JSOb ApplicationConverterFactory::ConverterType converter = ApplicationConverterFactory::getConverter(context); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_APPLICATION_CONTROL)) { - LogDebug("JSRequestedApplicationControl::getProperty::appControl " << providerMgr->getAppControl()); + LoggerD("JSRequestedApplicationControl::getProperty::appControl " << providerMgr->getAppControl()); return converter->toJSValueRef(providerMgr->getAppControl()); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALLER_APP_ID)) { - LogDebug("JSRequestedApplicationControl::getProperty::callerAppId " << providerMgr->getCallerAppId()); + LoggerD("JSRequestedApplicationControl::getProperty::callerAppId " << providerMgr->getCallerAppId()); return converter->toJSValueRef(providerMgr->getCallerAppId()); } } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSDOMExceptionFactory::UnknownException.make(context, exception); } @@ -196,7 +194,7 @@ JSValueRef JSRequestedApplicationControl::replyResult(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSRequestedApplicationControlPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); Try { @@ -213,16 +211,16 @@ JSValueRef JSRequestedApplicationControl::replyResult(JSContextRef context, } providerMgr->replyResult(resultArray); } Catch (ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -236,7 +234,7 @@ JSValueRef JSRequestedApplicationControl::replyFailure(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSRequestedApplicationControlPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); Try { @@ -247,13 +245,13 @@ JSValueRef JSRequestedApplicationControl::replyFailure(JSContextRef context, RequestedApplicationControlPtr providerMgr = priv->getObject(); providerMgr->replyFailure(); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception,JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } diff --git a/src/Application/RequestedApplicationControl.cpp b/src/Application/RequestedApplicationControl.cpp index 543a3f5..5358374 100644 --- a/src/Application/RequestedApplicationControl.cpp +++ b/src/Application/RequestedApplicationControl.cpp @@ -15,11 +15,11 @@ // limitations under the License. // - #include #include #include #include "RequestedApplicationControl.h" +#include namespace DeviceAPI { namespace Application { @@ -30,13 +30,13 @@ RequestedApplicationControl::RequestedApplicationControl() : m_appControl(NULL), m_appService(NULL) { - LogDebug("entered"); + LoggerD("entered"); } RequestedApplicationControl::~RequestedApplicationControl() { - LogDebug("entered"); + LoggerD("entered"); } ApplicationControlPtr RequestedApplicationControl::getAppControl() const @@ -70,7 +70,7 @@ void RequestedApplicationControl::replyResult(std::vector valueArray = appControlDataArray.at(i)->getValue(); @@ -79,7 +79,7 @@ void RequestedApplicationControl::replyResult(std::vectorgetKey().c_str(), arr, valueArray.size()); @@ -88,18 +88,18 @@ void RequestedApplicationControl::replyResult(std::vector #include -#include #include #include "ApplicationControl.h" diff --git a/src/Application/plugin_initializer.cpp b/src/Application/plugin_initializer.cpp old mode 100755 new mode 100644 index 60bd145..8a02d1a --- a/src/Application/plugin_initializer.cpp +++ b/src/Application/plugin_initializer.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -27,6 +25,7 @@ #include "JSApplicationControl.h" #include "ApplicationAsyncCallbackManager.h" #include "ApplicationListenerManager.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -46,17 +45,17 @@ class_definition_options_t ApplicationOptions = }; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen1_0\\Application] on_widget_start_callback ("<(context)); DeviceAPI::Application::ApplicationListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/Bluetooth/BluetoothAdapter.cpp b/src/Bluetooth/BluetoothAdapter.cpp index 87bc205..d39810e 100644 --- a/src/Bluetooth/BluetoothAdapter.cpp +++ b/src/Bluetooth/BluetoothAdapter.cpp @@ -36,11 +36,11 @@ namespace Bluetooth { void BluetoothAdapter::onStateChangedCB(int result, bt_adapter_state_e adapterState, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } object->mEnabled = (adapterState == BT_ADAPTER_ENABLED) ? true : false; @@ -48,7 +48,7 @@ void BluetoothAdapter::onStateChangedCB(int result, bt_adapter_state_e adapterSt if(object->mUserDataList[SET_POWERED] != NULL) { // requested event bool state = (adapterState == BT_ADAPTER_ENABLED) ? true : false; if(object->mRequestedState != state) { - LogWarning("Requested state is same to current state"); + LoggerW("Requested state is same to current state"); return; } @@ -75,17 +75,17 @@ void BluetoothAdapter::onStateChangedCB(int result, bt_adapter_state_e adapterSt } } else { // unexpected event - LogWarning("Bluetooth state is changed unexpectedly"); + LoggerW("Bluetooth state is changed unexpectedly"); } } void BluetoothAdapter::onNameChangedCB(char *name, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } @@ -98,24 +98,24 @@ void BluetoothAdapter::onNameChangedCB(char *name, void *userData) bt_adapter_unset_name_changed_cb(); } else { // unexpected event - LogWarning("Bluetooth name is changed unexpectedly"); + LoggerW("Bluetooth name is changed unexpectedly"); } } void BluetoothAdapter::onVisibilityChangedCB(int result, bt_adapter_visibility_mode_e visibilityMode, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } if(object->mUserDataList[SET_VISIBLE] != NULL) { // requested event //bool visibility = (visibilityMode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) ? false : true; if(object->mRequestedVisibility != visibilityMode) { - LogWarning("Requested visibility is not same to current visibility"); + LoggerW("Requested visibility is not same to current visibility"); return; } @@ -137,25 +137,25 @@ void BluetoothAdapter::onVisibilityChangedCB(int result, bt_adapter_visibility_m bt_adapter_unset_visibility_mode_changed_cb(); } else { // unexpected event - LogWarning("Bluetooth visibility is changed unexpectedly"); + LoggerW("Bluetooth visibility is changed unexpectedly"); } } void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_discovery_state_e discoveryState, bt_adapter_device_discovery_info_s *discoveryInfo, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } switch(discoveryState) { case BT_ADAPTER_DEVICE_DISCOVERY_STARTED: { - LogDebug("BT_ADAPTER_DEVICE_DISCOVERY_STARTED"); + LoggerD("BT_ADAPTER_DEVICE_DISCOVERY_STARTED"); if(object->mUserDataList[DISCOVER_DEVICES] != NULL) { // requested event MultiCallbackUserDataPtr callback = static_cast(object->mUserDataList[DISCOVER_DEVICES]); @@ -176,7 +176,7 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d } else { if(callback) { - LogDebug("Reset DISCOVER_DEVICES"); + LoggerD("Reset DISCOVER_DEVICES"); object->mUserDataList[DISCOVER_DEVICES].reset(); JSContextRef context = callback->getContext(); @@ -191,13 +191,13 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d } } else { // unexpected event - LogWarning("Unexpected discovery"); + LoggerW("Unexpected discovery"); } break; } case BT_ADAPTER_DEVICE_DISCOVERY_FINISHED: { - LogDebug("BT_ADAPTER_DEVICE_DISCOVERY_FINISHED"); + LoggerD("BT_ADAPTER_DEVICE_DISCOVERY_FINISHED"); if(result == BT_ERROR_NONE || result == BT_ERROR_CANCELLED) { // in case of discoverDevices() if(object->mUserDataList[DISCOVER_DEVICES] != NULL) { @@ -205,9 +205,9 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d static_cast(object->mUserDataList[DISCOVER_DEVICES]); if(callback) { - LogDebug("Call onfinished()"); + LoggerD("Call onfinished()"); if(object->mDisappearedDevices.size() > 0) { - LogDebug("There are disappeared devices"); + LoggerD("There are disappeared devices"); for(std::vector::iterator iter = object->mDisappearedDevices.begin(); iter != object->mDisappearedDevices.end(); iter++) { @@ -217,7 +217,7 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d } if(object->mFoundDevices.size() > 0) { // There are found devices - LogDebug("There are found devices"); + LoggerD("There are found devices"); int num = object->mFoundDevices.size(); JSObjectRef devices[num]; for(int i = 0; i < num; i++) { @@ -225,7 +225,7 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d devices[i] = deviceObj; } - LogDebug("Reset DISCOVER_DEVICES"); + LoggerD("Reset DISCOVER_DEVICES"); object->mUserDataList[DISCOVER_DEVICES].reset(); callback->invokeCallback( @@ -233,9 +233,9 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d JSObjectMakeArray(callback->getContext(), num, devices, NULL) ); } else { // There is no found device - LogDebug("There is no found device"); + LoggerD("There is no found device"); - LogDebug("Reset DISCOVER_DEVICES"); + LoggerD("Reset DISCOVER_DEVICES"); object->mUserDataList[DISCOVER_DEVICES].reset(); callback->invokeCallback( @@ -251,7 +251,7 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d static_cast(object->mUserDataList[STOP_DISCOVERY]); if(callback) { - LogDebug("Call successCallback of stopDiscovery()"); + LoggerD("Call successCallback of stopDiscovery()"); object->mUserDataList[STOP_DISCOVERY].reset(); callback->invokeCallback("success"); } @@ -260,15 +260,15 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d //bt_adapter_unset_device_discovery_state_changed_cb(); } else { - LogWarning("result MUST be BT_ERROR_NONE or BT_ERROR_CANCELLED when BT_ADAPTER_DEVICE_DISCOVERY_FINISHED"); + LoggerW("result MUST be BT_ERROR_NONE or BT_ERROR_CANCELLED when BT_ADAPTER_DEVICE_DISCOVERY_FINISHED"); } break; } case BT_ADAPTER_DEVICE_DISCOVERY_FOUND: { - LogDebug("BT_ADAPTER_DEVICE_DISCOVERY_FOUND"); + LoggerD("BT_ADAPTER_DEVICE_DISCOVERY_FOUND"); if(!discoveryInfo) { - LogWarning("discoveryInfo is NULL"); + LoggerW("discoveryInfo is NULL"); return; } @@ -287,7 +287,7 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d for(std::vector::iterator iter = object->mDisappearedDevices.begin(); iter != object->mDisappearedDevices.end(); iter++) { if(!strcmp(discoveryInfo->remote_address, (*iter).c_str())) { - LogDebug("This device is still found"); + LoggerD("This device is still found"); object->mDisappearedDevices.erase(iter); break; } @@ -297,33 +297,33 @@ void BluetoothAdapter::onDiscoveryStateChangedCB(int result, bt_adapter_device_d callback->invokeCallback("ondevicefound", deviceObj); } else { - LogWarning("result MUST be BT_ERROR_NONE when BT_ADAPTER_DEVICE_DISCOVERY_FOUND"); + LoggerW("result MUST be BT_ERROR_NONE when BT_ADAPTER_DEVICE_DISCOVERY_FOUND"); } } else { // unexpected event - LogWarning("Unexpected discovery"); + LoggerW("Unexpected discovery"); } break; } default: { - LogWarning("Unknown state"); + LoggerW("Unknown state"); } } } bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr adapter = static_cast(userData); if(!adapter) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return true; } if(deviceInfo == NULL) { - LogWarning("deviceInfo is NULL"); + LoggerW("deviceInfo is NULL"); return true; } @@ -332,14 +332,14 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void BluetoothDeviceSharedPtr foundDevice = *iter; if(!strcmp(foundDevice->getAddress().c_str(), deviceInfo->remote_address)) { - LogDebug("Already known device"); + LoggerD("Already known device"); foundDevice->updateInfo(deviceInfo); break; } } if(iter == adapter->knownDevices.end()) { - LogDebug("Add a device into foundDevices"); + LoggerD("Add a device into foundDevices"); BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo)); adapter->knownDevices.push_back(device); } @@ -349,16 +349,16 @@ bool BluetoothAdapter::foreachBondedDevicesCB(bt_device_info_s *deviceInfo, void void BluetoothAdapter::onBondCreatedCB(int result, bt_device_info_s *deviceInfo, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } if(!deviceInfo) { - LogWarning("deviceInfo is NULL"); + LoggerW("deviceInfo is NULL"); return; } @@ -388,17 +388,17 @@ void BluetoothAdapter::onBondCreatedCB(int result, bt_device_info_s *deviceInfo, object->mCreateBondingAddress.clear(); } else { // unexpected event - LogWarning("A bonding is created unexpectedly"); + LoggerW("A bonding is created unexpectedly"); } } void BluetoothAdapter::onBondDestroyedCB(int result, char *remoteAddress, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } @@ -424,29 +424,29 @@ void BluetoothAdapter::onBondDestroyedCB(int result, char *remoteAddress, void * object->mDestroyBondingAddress.clear(); } else { // unexpected event - LogWarning("A bonding is created unexpectedly"); + LoggerW("A bonding is created unexpectedly"); } } void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_e state, bt_socket_connection_s *connection, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } if(!connection) { - LogWarning("connection is NULL"); + LoggerW("connection is NULL"); return; } if(connection->local_role == BT_SOCKET_SERVER) { RegisteredUUIDMapT::iterator iter = object->mRegisteredUUID.find(connection->service_uuid); if(iter == object->mRegisteredUUID.end()) { - LogWarning("Connection state is changed unexpectedly"); + LoggerW("Connection state is changed unexpectedly"); return; } @@ -469,7 +469,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ bt_socket_set_data_received_cb(onSocketReceivedCB, userData); } else { - LogWarning("Establishing a connection failed"); + LoggerW("Establishing a connection failed"); } return; } @@ -482,7 +482,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ // call BluetoothSocket.onclose; ConnectedSocketMapT::iterator i = object->mConnectedSocket.find(connection->socket_fd); if(i == object->mConnectedSocket.end()) { - LogWarning("Unknown connected socket"); + LoggerW("Unknown connected socket"); return; } //BluetoothSocketSharedPtr socket = i->second; @@ -496,7 +496,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ object->mConnectedSocket.erase(i); } else { - LogWarning("Disconnecting a connection failed"); + LoggerW("Disconnecting a connection failed"); } } } @@ -508,13 +508,13 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ do { iter = object->mConnReqMap.find(remoteAddress); if(iter != object->mConnReqMap.end() && !strcmp(iter->second->mUUID.c_str(), connection->service_uuid)) { - LogDebug("Find"); + LoggerD("Find"); break; } } while(iter != object->mConnReqMap.end()); if(iter == object->mConnReqMap.end()) { - LogWarning("Connection state is changed unexpectedly"); + LoggerW("Connection state is changed unexpectedly"); return; } @@ -552,7 +552,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ // call BluetoothSocket.onclose; ConnectedSocketMapT::iterator i = object->mConnectedSocket.find(connection->socket_fd); if(i == object->mConnectedSocket.end()) { - LogWarning("Unknown connected socket"); + LoggerW("Unknown connected socket"); return; } @@ -566,12 +566,12 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ object->mConnectedSocket.erase(i); } else { - LogWarning("Disconnecting a connection failed"); + LoggerW("Disconnecting a connection failed"); } } } else { - LogWarning("Unknown role"); + LoggerW("Unknown role"); return; } @@ -580,7 +580,7 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ } if(object->mRegisteredUUID.size() == 0 && object->mConnReqMap.size() == 0 && object->mConnectedSocket.size() == 0) { - LogDebug("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", + LoggerD("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", object->mRegisteredUUID.size(), object->mConnReqMap.size(), object->mConnectedSocket.size()); bt_socket_unset_connection_state_changed_cb(); } @@ -588,22 +588,22 @@ void BluetoothAdapter::onSocketConnected(int result, bt_socket_connection_state_ void BluetoothAdapter::onSocketReceivedCB(bt_socket_received_data_s *data, void *userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothAdapterPtr object = static_cast(userData); if(!object) { - LogWarning("userData is NULL"); + LoggerW("userData is NULL"); return; } if(!data) { - LogWarning("data is NULL"); + LoggerW("data is NULL"); return; } ConnectedSocketMapT::iterator i = object->mConnectedSocket.find(data->socket_fd); if(i == object->mConnectedSocket.end()) { - LogWarning("Unknown connected socket"); + LoggerW("Unknown connected socket"); return; } @@ -620,10 +620,10 @@ void BluetoothAdapter::onSocketReceivedCB(bt_socket_received_data_s *data, void BluetoothAdapter::BluetoothAdapter(): mEnabled(false) { - LogDebug("Entered"); + LoggerD("Entered"); if(bt_initialize() != BT_ERROR_NONE) { - LogError("bt_initialize() failed"); + LoggerE("bt_initialize() failed"); } bt_adapter_state_e state; @@ -634,17 +634,17 @@ BluetoothAdapter::BluetoothAdapter(): } if(bt_adapter_set_state_changed_cb(onStateChangedCB, this) != BT_ERROR_NONE) { - LogError("bt_adapter_set_state_changed_cb() failed"); + LoggerE("bt_adapter_set_state_changed_cb() failed"); } if(bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this) != BT_ERROR_NONE) { - LogError("bt_adapter_set_device_discovery_state_changed_cb() failed"); + LoggerE("bt_adapter_set_device_discovery_state_changed_cb() failed"); } } BluetoothAdapter::~BluetoothAdapter() { - LogDebug("Entered"); + LoggerD("Entered"); // unset platform callback bt_adapter_unset_state_changed_cb(); @@ -668,25 +668,25 @@ BluetoothAdapter::~BluetoothAdapter() void BluetoothAdapter::unloadFrame(JSContextRef context) { - LogDebug("Entered"); + LoggerD("Entered"); - LogDebug("Clean mUserDataList"); + LoggerD("Clean mUserDataList"); for(int i = 0; i <= DESTROY_BONDING; i++) { if(mUserDataList[i]) { MultiCallbackUserDataPtr callback = mUserDataList[i]; if(!GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) { - LogDebug("reset an userData"); + LoggerD("reset an userData"); mUserDataList[i].reset(); } } } - LogDebug("Clean mConnReqMap"); + LoggerD("Clean mConnReqMap"); for(ConnReqMultiMapT::iterator iter = mConnReqMap.begin(); iter != mConnReqMap.end(); ) { ConnReqMultiMapT::iterator temp = iter++; MultiCallbackUserDataPtr callback = temp->second->mUserData; if(!callback && !GlobalContextManager::getInstance()->isAliveGlobalContext(callback->getContext())) { - LogDebug("erase a connectionRequest"); + LoggerD("erase a connectionRequest"); mConnReqMap.erase(temp); } } @@ -694,11 +694,11 @@ void BluetoothAdapter::unloadFrame(JSContextRef context) void BluetoothAdapter::unregisterUUID(std::string &uuid) { - LogDebug("Entered"); + LoggerD("Entered"); mRegisteredUUID.erase(mRegisteredUUID.find(uuid)); if(mRegisteredUUID.size() == 0 && mConnReqMap.size() == 0 && mConnectedSocket.size() == 0) { - LogDebug("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", + LoggerD("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", mRegisteredUUID.size(), mConnReqMap.size(), mConnectedSocket.size()); bt_socket_unset_connection_state_changed_cb(); } @@ -706,12 +706,12 @@ void BluetoothAdapter::unregisterUUID(std::string &uuid) bool BluetoothAdapter::closeConnectedSocket(int socket) { - LogDebug("Entered"); + LoggerD("Entered"); if(mEnabled == true) { ConnectedSocketMapT::iterator iter = mConnectedSocket.find(socket); if(iter == mConnectedSocket.end()) { - LogWarning("Already disconnected"); + LoggerW("Already disconnected"); return true; } @@ -721,7 +721,7 @@ bool BluetoothAdapter::closeConnectedSocket(int socket) } if(mRegisteredUUID.size() == 0 && mConnReqMap.size() == 0 && mConnectedSocket.size() == 0) { - LogDebug("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", + LoggerD("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", mRegisteredUUID.size(), mConnReqMap.size(), mConnectedSocket.size()); bt_socket_unset_connection_state_changed_cb(); } @@ -729,29 +729,29 @@ bool BluetoothAdapter::closeConnectedSocket(int socket) return true; } else { - LogError("Bluetooth is not powered"); + LoggerE("Bluetooth is not powered"); return false; } } void BluetoothAdapter::removeConnReq(std::string &remoteAddress) { - LogDebug("Entered"); + LoggerD("Entered"); mConnReqMap.erase(remoteAddress); if(mRegisteredUUID.size() == 0 && mConnReqMap.size() == 0 && mConnectedSocket.size() == 0) { - LogDebug("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", + LoggerD("mRegisteredUUID.size()=%d, mConnReqMap.size()=%d, mConnectedSocket.size()=%d", mRegisteredUUID.size(), mConnReqMap.size(), mConnectedSocket.size()); if(bt_socket_unset_connection_state_changed_cb() != BT_ERROR_NONE) { - LogWarning("Unsetting connection event callback failed"); + LoggerW("Unsetting connection event callback failed"); } } } BluetoothAdapter* BluetoothAdapter::getInstance() { - LogDebug("Entered"); + LoggerD("Entered"); static BluetoothAdapter instance; return &instance; @@ -762,7 +762,7 @@ bool BluetoothAdapter::isBluetoothSupported() bool isSupported = false; if(system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &isSupported) != SYSTEM_INFO_ERROR_NONE) { - LogError("Can't know whether Bluetooth is supported or not"); + LoggerE("Can't know whether Bluetooth is supported or not"); } return isSupported; @@ -770,19 +770,19 @@ bool BluetoothAdapter::isBluetoothSupported() bool BluetoothAdapter::isValidAddress(std::string &address) { - LogDebug("Entered"); + LoggerD("Entered"); pcrecpp::RE re("(([0-9a-zA-Z]+):)+([0-9a-zA-Z]+)"); std::string compareAddress = "00:12:47:08:9A:A6"; if (!re.FullMatch(address)) { - LogError("Invalid address"); + LoggerE("Invalid address"); return false; } if (address.size() != compareAddress.size()) { - LogError("Invalid size"); + LoggerE("Invalid size"); return false; } @@ -796,13 +796,13 @@ bool BluetoothAdapter::isValidUUID(std::string &uuid) if (!re.FullMatch(uuid)) { - LogError("Invalid UUID"); + LoggerE("Invalid UUID"); return false; } if (uuid.size() != compareUUID.size()) { - LogError("Invalid size"); + LoggerE("Invalid size"); return false; } @@ -811,7 +811,7 @@ bool BluetoothAdapter::isValidUUID(std::string &uuid) std::string BluetoothAdapter::getName() const { - LogDebug("Entered"); + LoggerD("Entered"); char* name = NULL; std::string str = ""; @@ -821,11 +821,11 @@ std::string BluetoothAdapter::getName() const { str = name; free(name); - LogDebug("name" << str); + LoggerD("name" << str); } } else { - LogError("bt_adapter_get_name() failed"); + LoggerE("bt_adapter_get_name() failed"); } return str; @@ -833,12 +833,12 @@ std::string BluetoothAdapter::getName() const void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(mEnabled == true) { std::string adapterName = getName(); if(adapterName == name) { // in case of same name - LogDebug("same name"); + LoggerD("same name"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); return; } @@ -847,7 +847,7 @@ void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userD bt_adapter_set_name_changed_cb(onNameChangedCB, this); mUserDataList[SET_NAME] = userData; } else { - LogError("Already requested"); + LoggerE("Already requested"); UnknownException *error = new UnknownException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -858,20 +858,20 @@ void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userD switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_set_name() succeeded"); + LoggerD("bt_adapter_set_name() succeeded"); mRequestedName = name; return; } case BT_ERROR_INVALID_PARAMETER: { - LogError("Invalid value"); + LoggerE("Invalid value"); InvalidValuesException *error = new InvalidValuesException("Invalid value"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); break; } default: { - LogError("Invalid value"); + LoggerE("Invalid value"); UnknownException *error = new UnknownException("Unknown exception"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -880,7 +880,7 @@ void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userD bt_adapter_unset_name_changed_cb(); mUserDataList[SET_NAME].reset(); } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Bluetooth device is turned off"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -888,7 +888,7 @@ void BluetoothAdapter::setName(std::string &name, MultiCallbackUserDataPtr userD std::string BluetoothAdapter::getAddress() const { - LogDebug("Entered"); + LoggerD("Entered"); char* address = NULL; std::string str = ""; @@ -897,14 +897,14 @@ std::string BluetoothAdapter::getAddress() const if (address != NULL) { str = address; free(address); - LogDebug("address: " << str); + LoggerD("address: " << str); } else { - LogWarning("address is NULL"); + LoggerW("address is NULL"); } } else { - LogError("bt_adapter_get_address() failed"); + LoggerE("bt_adapter_get_address() failed"); } return str; @@ -912,17 +912,17 @@ std::string BluetoothAdapter::getAddress() const bool BluetoothAdapter::getPowered() const { - LogDebug("Entered"); + LoggerD("Entered"); return mEnabled; } void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(powered == mEnabled) { - LogDebug("same state"); + LoggerD("same state"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); return; } @@ -931,7 +931,7 @@ void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userDat mUserDataList[SET_POWERED] = userData; } else { // Already requested - LogError("Already requested"); + LoggerE("Already requested"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -944,26 +944,26 @@ void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userDat switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_enable() succeeded"); + LoggerD("bt_adapter_enable() succeeded"); return; } case BT_ERROR_ALREADY_DONE: { // call successCallback - LogDebug("BT_ERROR_ALREADY_DONE"); + LoggerD("BT_ERROR_ALREADY_DONE"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); break; } case BT_ERROR_NOW_IN_PROGRESS: { - LogDebug("BT_ERROR_NOW_IN_PROGRESS"); + LoggerD("BT_ERROR_NOW_IN_PROGRESS"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Bluetooth device is busy"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); break; } default: { - LogDebug("Unknown error"); + LoggerD("Unknown error"); UnknownException *error = new UnknownException("Unknown error"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -974,26 +974,26 @@ void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userDat switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_disable() succeeded"); + LoggerD("bt_adapter_disable() succeeded"); return; } case BT_ERROR_NOT_ENABLED: { // call successCallback - LogDebug("Already disabled"); + LoggerD("Already disabled"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); break; } case BT_ERROR_NOW_IN_PROGRESS: { - LogDebug("BT_ERROR_NOW_IN_PROGRESS"); + LoggerD("BT_ERROR_NOW_IN_PROGRESS"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Bluetooth device is busy"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); break; } default: { - LogDebug("Unknown error"); + LoggerD("Unknown error"); UnknownException *error = new UnknownException("Unknown error"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -1005,7 +1005,7 @@ void BluetoothAdapter::setPowered(bool powered, MultiCallbackUserDataPtr userDat bool BluetoothAdapter::getVisible() const { - LogDebug("Entered"); + LoggerD("Entered"); bt_adapter_visibility_mode_e mode; @@ -1020,7 +1020,7 @@ bool BluetoothAdapter::getVisible() const void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(mEnabled == true) { bt_adapter_visibility_mode_e discoverable_mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; @@ -1034,7 +1034,7 @@ void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallb bt_adapter_visibility_mode_e current = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE; int time = 0; if(bt_adapter_get_visibility(¤t , &time) != BT_ERROR_NONE) { - LogError("bt_adapter_get_visibility() failed"); + LoggerE("bt_adapter_get_visibility() failed"); UnknownException *error = new UnknownException("Can't get current visibility"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1042,12 +1042,12 @@ void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallb if(discoverable_mode == current) { if(discoverable_mode != BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE) { - LogDebug("same visibility"); + LoggerD("same visibility"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); return; } else if((unsigned int)time == timeout) { - LogDebug("same visibility"); + LoggerD("same visibility"); BluetoothCallbackUtil::syncToAsyncSuccessCallback(userData); return; } @@ -1067,7 +1067,7 @@ void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallb switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_set_visibility() succeeded"); + LoggerD("bt_adapter_set_visibility() succeeded"); return; } case BT_ERROR_INVALID_PARAMETER: @@ -1094,7 +1094,7 @@ void BluetoothAdapter::setVisible(bool visible, unsigned int timeout, MultiCallb void BluetoothAdapter::discoverDevices(MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(mUserDataList[DISCOVER_DEVICES] == NULL) { mUserDataList[DISCOVER_DEVICES] = userData; @@ -1104,7 +1104,7 @@ void BluetoothAdapter::discoverDevices(MultiCallbackUserDataPtr userData) bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this); */ } else { - LogError("Already requested"); + LoggerE("Already requested"); UnknownException *error = new UnknownException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1115,18 +1115,18 @@ void BluetoothAdapter::discoverDevices(MultiCallbackUserDataPtr userData) switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_start_device_discovery() succeeded"); + LoggerD("bt_adapter_start_device_discovery() succeeded"); return; } default: { - LogError("Unknown exception"); + LoggerE("Unknown exception"); UnknownException *error = new UnknownException("Unknown error"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } } } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Bluetooth device is turned off"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -1141,7 +1141,7 @@ void BluetoothAdapter::discoverDevices(MultiCallbackUserDataPtr userData) void BluetoothAdapter::stopDiscovery(MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(mEnabled == true) { @@ -1160,7 +1160,7 @@ void BluetoothAdapter::stopDiscovery(MultiCallbackUserDataPtr userData) bt_adapter_set_device_discovery_state_changed_cb(onDiscoveryStateChangedCB, this); */ } else { - LogDebug("Already requested"); + LoggerD("Already requested"); UnknownException *error = new UnknownException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1170,7 +1170,7 @@ void BluetoothAdapter::stopDiscovery(MultiCallbackUserDataPtr userData) switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_adapter_stop_device_discovery() succeeded"); + LoggerD("bt_adapter_stop_device_discovery() succeeded"); return; } default: @@ -1194,22 +1194,22 @@ void BluetoothAdapter::stopDiscovery(MultiCallbackUserDataPtr userData) void BluetoothAdapter::getKnownDevices(MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothCallbackUtil::syncToAsyncDeviceArrayCallback(userData); } void BluetoothAdapter::getDevice(std::string &address, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothCallbackUtil::syncToAsyncDeviceCallback(userData, address); } void BluetoothAdapter::createBonding(std::string &address, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(!isValidAddress(address)) { - LogError("Wrong address"); + LoggerE("Wrong address"); NotFoundException *error = new NotFoundException("Wrong address"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1220,7 +1220,7 @@ void BluetoothAdapter::createBonding(std::string &address, MultiCallbackUserData mCreateBondingAddress = address; mUserDataList[CREATE_BONDING] = userData; } else { - LogError("Already requested"); + LoggerE("Already requested"); UnknownException *error = new UnknownException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1232,25 +1232,25 @@ void BluetoothAdapter::createBonding(std::string &address, MultiCallbackUserData switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_device_create_bond() succeeded"); + LoggerD("bt_device_create_bond() succeeded"); return; } case BT_ERROR_INVALID_PARAMETER: { - LogError("Not found"); + LoggerE("Not found"); NotFoundException *error = new NotFoundException("Not found"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); break; } default: { - LogError("Unknown exception"); + LoggerE("Unknown exception"); UnknownException *error = new UnknownException("Unknown error"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } } } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); ServiceNotAvailableException *error = new ServiceNotAvailableException("Bluetooth device is turned off"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -1262,10 +1262,10 @@ void BluetoothAdapter::createBonding(std::string &address, MultiCallbackUserData void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(!isValidAddress(address)) { - LogError("Wrong address"); + LoggerE("Wrong address"); NotFoundException *error = new NotFoundException("Wrong address"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1276,7 +1276,7 @@ void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDat mDestroyBondingAddress = address; mUserDataList[DESTROY_BONDING] = userData; } else { - LogDebug("Already requested"); + LoggerD("Already requested"); UnknownException *error = new UnknownException("Already requested"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1285,7 +1285,7 @@ void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDat if(mEnabled == true) { bt_device_info_s *deviceInfo = NULL; if(bt_adapter_get_bonded_device_info(address.c_str(), &deviceInfo) != BT_ERROR_NONE || deviceInfo == NULL) { - LogDebug("There is no bonding"); + LoggerD("There is no bonding"); NotFoundException *error = new NotFoundException("Not found"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); } @@ -1296,7 +1296,7 @@ void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDat switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_device_destroy_bond() succeeded"); + LoggerD("bt_device_destroy_bond() succeeded"); return; } case BT_ERROR_INVALID_PARAMETER: @@ -1324,16 +1324,16 @@ void BluetoothAdapter::destroyBonding(std::string &address, MultiCallbackUserDat void BluetoothAdapter::registerRFCOMMServiceByUUID(std::string &uuid, std::string &name, MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); BluetoothCallbackUtil::syncToAsyncServiceCallback(userData, uuid, name); } void BluetoothAdapter::connectToServiceByUUID(std::string &remoteAddress, std::string &uuid, Common::MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(!isValidUUID(uuid)) { - LogError("Wrong UUID"); + LoggerE("Wrong UUID"); InvalidValuesException *error = new InvalidValuesException("Wrong UUID"); BluetoothCallbackUtil::syncToAsyncErrorCallback(userData, error); return; @@ -1346,7 +1346,7 @@ void BluetoothAdapter::connectToServiceByUUID(std::string &remoteAddress, std::s switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_socket_connect_rfcomm() succeeded"); + LoggerD("bt_socket_connect_rfcomm() succeeded"); bt_socket_set_connection_state_changed_cb(onSocketConnected, this); BluetoothConnReqPtr connReq = new BluetoothConnReq(uuid, userData); @@ -1374,13 +1374,13 @@ void BluetoothAdapter::connectToServiceByUUID(std::string &remoteAddress, std::s void BluetoothAdapter::returnKnownDevices(Common::MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(mEnabled == true) { knownDevices = mFoundDevices; if(bt_adapter_foreach_bonded_device(foreachBondedDevicesCB, this) == BT_ERROR_NONE) { if(knownDevices.size() > 0) { // There are found devices - LogDebug("There are found devices"); + LoggerD("There are found devices"); int num = knownDevices.size(); JSObjectRef devices[num]; for(int i = 0; i < num; i++) { @@ -1388,23 +1388,23 @@ void BluetoothAdapter::returnKnownDevices(Common::MultiCallbackUserDataPtr userD devices[i] = deviceObj; } - LogDebug("invoke successCallback"); + LoggerD("invoke successCallback"); userData->invokeCallback("success", JSObjectMakeArray(userData->getContext(), num, devices, NULL)); } else { // There is no found device - LogDebug("There is no found device"); + LoggerD("There is no found device"); userData->invokeCallback("success", JSObjectMakeArray(userData->getContext(), 0, NULL, NULL) ); } } else { - LogError("Unknown exception"); + LoggerE("Unknown exception"); userData->invokeCallback( "error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), UnknownException("Unknown exception")) ); } } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); userData->invokeCallback( "error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), ServiceNotAvailableException("Bluetooth device is turned off")) @@ -1414,10 +1414,10 @@ void BluetoothAdapter::returnKnownDevices(Common::MultiCallbackUserDataPtr userD void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(!isValidAddress(address)) { - LogError("Wrong address"); + LoggerE("Wrong address"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), NotFoundException("Wrong address"))); return; } @@ -1429,7 +1429,7 @@ void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackU BluetoothDeviceSharedPtr device(new BluetoothDevice(deviceInfo)); bt_adapter_free_device_info(deviceInfo); - LogDebug("invoke successCallback"); + LoggerD("invoke successCallback"); userData->invokeCallback("success", JSBluetoothDevice::createJSObject(userData->getContext(), device)); return; } @@ -1438,14 +1438,14 @@ void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackU for(iter = mFoundDevices.begin(); iter != mFoundDevices.end(); ++iter) { BluetoothDeviceSharedPtr foundDevice = *iter; if(!strcmp(foundDevice->getAddress().c_str(), address.c_str())) { - LogDebug("Found in mFoundDevices"); + LoggerD("Found in mFoundDevices"); userData->invokeCallback("success", JSBluetoothDevice::createJSObject(userData->getContext(), foundDevice)); break; } } if(iter == mFoundDevices.end()) { - LogError("Can't find this device"); + LoggerE("Can't find this device"); userData->invokeCallback( "error", @@ -1454,7 +1454,7 @@ void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackU } } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); userData->invokeCallback( "error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), ServiceNotAvailableException("Bluetooth device is turned off")) @@ -1464,10 +1464,10 @@ void BluetoothAdapter::returnDevice(std::string &address, Common::MultiCallbackU void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &name, Common::MultiCallbackUserDataPtr userData) { - LogDebug("Entered"); + LoggerD("Entered"); if(!isValidUUID(uuid)) { - LogError("Wrong UUID"); + LoggerE("Wrong UUID"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), InvalidValuesException("Wrong UUID"))); return; } @@ -1476,7 +1476,7 @@ void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &n bool isRegistered; if(bt_adapter_is_service_used(uuid.c_str(), &isRegistered) == BT_ERROR_NONE && isRegistered == true) { - LogDebug("Already registered"); + LoggerD("Already registered"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), InvalidValuesException("Already registered"))); return; } @@ -1487,12 +1487,12 @@ void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &n switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_socket_create_rfcomm() succeeded"); + LoggerD("bt_socket_create_rfcomm() succeeded"); int ret = bt_socket_listen_and_accept_rfcomm(socket, 0); switch(ret) { case BT_ERROR_NONE: { - LogDebug("bt_socket_listen() succeeded"); + LoggerD("bt_socket_listen() succeeded"); bt_socket_set_connection_state_changed_cb(onSocketConnected, this); BluetoothServiceHandlerPtr serviceHandler = new BluetoothServiceHandler(uuid, name, socket); @@ -1504,13 +1504,13 @@ void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &n } case BT_ERROR_INVALID_PARAMETER: { - LogDebug("Invalid value"); + LoggerD("Invalid value"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), InvalidValuesException("Invalid value"))); break; } default: { - LogDebug("Unknown exception"); + LoggerD("Unknown exception"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), UnknownException("Unknown exception"))); } } @@ -1519,18 +1519,18 @@ void BluetoothAdapter::returnRegisteredService(std::string &uuid, std::string &n } case BT_ERROR_INVALID_PARAMETER: { - LogDebug("Invalid value"); + LoggerD("Invalid value"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), InvalidValuesException("Invalid value"))); break; } default: { - LogDebug("Unknown exception"); + LoggerD("Unknown exception"); userData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), UnknownException("Unknown exception"))); } } } else { // Not enabled - LogError("Bluetooth device is turned off"); + LoggerE("Bluetooth device is turned off"); userData->invokeCallback( "error", JSWebAPIError::makeJSWebAPIError(userData->getContext(), ServiceNotAvailableException("Bluetooth device is turned off")) diff --git a/src/Bluetooth/BluetoothCallbackUtil.cpp b/src/Bluetooth/BluetoothCallbackUtil.cpp index 769a12a..1ecc03b 100644 --- a/src/Bluetooth/BluetoothCallbackUtil.cpp +++ b/src/Bluetooth/BluetoothCallbackUtil.cpp @@ -31,17 +31,17 @@ namespace DeviceAPI { namespace Bluetooth { static Eina_Bool jobCompleteCB(void *userData){ - LogDebug("Entered"); + LoggerD("Entered"); BluetoothCallbackUserDataPtr data = static_cast(userData); if(!data) { - LogWarning("BluetoothCallbackUserDataPtr is NULL"); + LoggerW("BluetoothCallbackUserDataPtr is NULL"); return false; } if(!(data->mUserData)) { - LogWarning("MulticallbackUserData is NULL"); + LoggerW("MulticallbackUserData is NULL"); delete data; return false; } @@ -49,37 +49,37 @@ static Eina_Bool jobCompleteCB(void *userData){ switch(data->mCBType) { case BluetoothCallbackUserData::BT_CB_SUCCESS: { - LogDebug("BT_CB_SUCCESS"); + LoggerD("BT_CB_SUCCESS"); data->mUserData->invokeCallback("success"); break; } case BluetoothCallbackUserData::BT_CB_ERROR: { - LogDebug("BT_CB_ERROR"); + LoggerD("BT_CB_ERROR"); data->mUserData->invokeCallback("error", JSWebAPIError::makeJSWebAPIError(data->mUserData->getContext(), *(data->mError))); break; } case BluetoothCallbackUserData::BT_CB_DEVICE: { - LogDebug("BT_CB_DEVICE"); + LoggerD("BT_CB_DEVICE"); BluetoothAdapter::getInstance()->returnDevice(data->mAddress, data->mUserData); break; } case BluetoothCallbackUserData::BT_CB_DEVICES: { - LogDebug("BT_CB_DEVICES"); + LoggerD("BT_CB_DEVICES"); BluetoothAdapter::getInstance()->returnKnownDevices(data->mUserData); break; } case BluetoothCallbackUserData::BT_CB_SERVICE: { - LogDebug("BT_CB_SERVICE"); + LoggerD("BT_CB_SERVICE"); BluetoothAdapter::getInstance()->returnRegisteredService(data->mUUID, data->mName, data->mUserData); break; } default: { - LogWarning("Unknown callback type"); + LoggerW("Unknown callback type"); } } diff --git a/src/Bluetooth/BluetoothClass.cpp b/src/Bluetooth/BluetoothClass.cpp index bb7b353..eebc839 100644 --- a/src/Bluetooth/BluetoothClass.cpp +++ b/src/Bluetooth/BluetoothClass.cpp @@ -34,7 +34,7 @@ namespace Bluetooth { BluetoothClass::BluetoothClass(bt_class_s bluetoothClass) { - LogDebug("Enter"); + LoggerD("Enter"); mMajor = BluetoothClassDeviceMajor::getInstance()->getMajorValue(bluetoothClass.major_device_class); mMinor = BluetoothClassDeviceMinor::getInstance()->getMinorValue(bluetoothClass.minor_device_class); mServices= BluetoothClassDeviceService::getInstance()->getServiceValues(bluetoothClass.major_service_class_mask); @@ -42,24 +42,24 @@ BluetoothClass::BluetoothClass(bt_class_s bluetoothClass) BluetoothClass::~BluetoothClass() { - LogDebug("Enter"); + LoggerD("Enter"); } unsigned long BluetoothClass::getMajor() const { - LogDebug("Enter"); + LoggerD("Enter"); return mMajor; } unsigned long BluetoothClass::getMinor() const { - LogDebug("Enter"); + LoggerD("Enter"); return mMinor; } JSValueRef BluetoothClass::getServices(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); /* JSValueRef service = mLocalProperty.getProperty(context, BLUETOOTH_CLASS_SERVICES); if(service == NULL) { @@ -74,7 +74,7 @@ JSValueRef BluetoothClass::getServices(JSContextRef context) bool BluetoothClass::hasService(unsigned long service) { - LogDebug("Enter"); + LoggerD("Enter"); for(std::vector::iterator iter = mServices.begin(); iter != mServices.end(); ++iter) { if((*iter) == service) { diff --git a/src/Bluetooth/BluetoothClassDeviceMajor.cpp b/src/Bluetooth/BluetoothClassDeviceMajor.cpp index 4696461..11a5736 100644 --- a/src/Bluetooth/BluetoothClassDeviceMajor.cpp +++ b/src/Bluetooth/BluetoothClassDeviceMajor.cpp @@ -26,7 +26,7 @@ namespace Bluetooth { BluetoothClassDeviceMajor::BluetoothClassDeviceMajor() { - LogDebug("Enter"); + LoggerD("Enter"); mMajorStringMap.insert(std::pair("MISC", 0x00)); mMajorStringMap.insert(std::pair("COMPUTER", 0x01)); @@ -55,25 +55,25 @@ BluetoothClassDeviceMajor::BluetoothClassDeviceMajor() BluetoothClassDeviceMajor::~BluetoothClassDeviceMajor() { - LogDebug("Enter"); + LoggerD("Enter"); } BluetoothClassDeviceMajor* BluetoothClassDeviceMajor::getInstance() { - LogDebug("Enter"); + LoggerD("Enter"); static BluetoothClassDeviceMajor instance; return &instance; } unsigned long BluetoothClassDeviceMajor::getMajorValue(std::string major) { - LogDebug("Enter"); + LoggerD("Enter"); return mMajorStringMap.find(major)->second; } unsigned long BluetoothClassDeviceMajor::getMajorValue(bt_major_device_class_e major) { - LogDebug("Enter"); + LoggerD("Enter"); return mMajorEnumMap.find(major)->second; } diff --git a/src/Bluetooth/BluetoothClassDeviceMinor.cpp b/src/Bluetooth/BluetoothClassDeviceMinor.cpp index 8b4d590..f9d1ab2 100644 --- a/src/Bluetooth/BluetoothClassDeviceMinor.cpp +++ b/src/Bluetooth/BluetoothClassDeviceMinor.cpp @@ -26,7 +26,7 @@ namespace Bluetooth { BluetoothClassDeviceMinor::BluetoothClassDeviceMinor() { - LogDebug("Enter"); + LoggerD("Enter"); mMinorStringMap.insert(std::pair("COMPUTER_UNCATEGORIZED", 0x00)); mMinorStringMap.insert(std::pair("COMPUTER_DESKTOP", 0x01)); @@ -176,25 +176,25 @@ BluetoothClassDeviceMinor::BluetoothClassDeviceMinor() BluetoothClassDeviceMinor::~BluetoothClassDeviceMinor() { - LogDebug("Enter"); + LoggerD("Enter"); } BluetoothClassDeviceMinor* BluetoothClassDeviceMinor::getInstance() { - LogDebug("Enter"); + LoggerD("Enter"); static BluetoothClassDeviceMinor instance; return &instance; } unsigned long BluetoothClassDeviceMinor::getMinorValue(std::string minor) { - LogDebug("Enter"); + LoggerD("Enter"); return mMinorStringMap.find(minor)->second; } unsigned long BluetoothClassDeviceMinor::getMinorValue(bt_minor_device_class_e minor) { - LogDebug("Enter"); + LoggerD("Enter"); // F/W provides more minor deivce class std::map::iterator iter = mMinorEnumMap.find(minor); diff --git a/src/Bluetooth/BluetoothClassDeviceService.cpp b/src/Bluetooth/BluetoothClassDeviceService.cpp index 369e4af..636e2ed 100644 --- a/src/Bluetooth/BluetoothClassDeviceService.cpp +++ b/src/Bluetooth/BluetoothClassDeviceService.cpp @@ -26,7 +26,7 @@ namespace Bluetooth { BluetoothClassDeviceService::BluetoothClassDeviceService() { - LogDebug("Enter"); + LoggerD("Enter"); mServiceStringMap.insert(std::pair("LIMITED_DISCOVERABILITY", 0x0001)); mServiceStringMap.insert(std::pair("POSITIONING", 0x0008)); @@ -51,31 +51,31 @@ BluetoothClassDeviceService::BluetoothClassDeviceService() BluetoothClassDeviceService::~BluetoothClassDeviceService() { - LogDebug("Enter"); + LoggerD("Enter"); } BluetoothClassDeviceService* BluetoothClassDeviceService::getInstance() { - LogDebug("Enter"); + LoggerD("Enter"); static BluetoothClassDeviceService instance; return &instance; } unsigned long BluetoothClassDeviceService::getServiceValue(std::string service) { - LogDebug("Enter"); + LoggerD("Enter"); return mServiceStringMap.find(service)->second; } unsigned long BluetoothClassDeviceService::getServiceValue(bt_major_service_class_e service) { - LogDebug("Enter"); + LoggerD("Enter"); return mServiceEnumMap.find(service)->second; } std::vector BluetoothClassDeviceService::getServiceValues(int serviceMask) { - LogDebug("Enter"); + LoggerD("Enter"); std::vector ret; for(std::map::iterator iter = mServiceEnumMap.begin(); iter != mServiceEnumMap.end(); iter++) { diff --git a/src/Bluetooth/BluetoothDevice.cpp b/src/Bluetooth/BluetoothDevice.cpp index f1a4260..6a96bd7 100644 --- a/src/Bluetooth/BluetoothDevice.cpp +++ b/src/Bluetooth/BluetoothDevice.cpp @@ -32,7 +32,7 @@ namespace Bluetooth { BluetoothDevice::BluetoothDevice(bt_adapter_device_discovery_info_s *discoveryInfo) { - LogDebug("Enter"); + LoggerD("Enter"); mName = std::string(discoveryInfo->remote_name); mAddress = std::string(discoveryInfo->remote_address); @@ -45,7 +45,7 @@ BluetoothDevice::BluetoothDevice(bt_adapter_device_discovery_info_s *discoveryIn BluetoothDevice::BluetoothDevice(bt_device_info_s *deviceInfo) { - LogDebug("Enter"); + LoggerD("Enter"); mName = std::string(deviceInfo->remote_name); mAddress = std::string(deviceInfo->remote_address); @@ -58,13 +58,13 @@ BluetoothDevice::BluetoothDevice(bt_device_info_s *deviceInfo) BluetoothDevice::~BluetoothDevice() { - LogDebug("Enter"); + LoggerD("Enter"); BluetoothAdapter::getInstance()->removeConnReq(mAddress); } void BluetoothDevice::updateInfo(bt_device_info_s *deviceInfo) { - LogDebug("Enter"); + LoggerD("Enter"); mName = std::string(deviceInfo->remote_name); mUUIDs.clear(); @@ -76,19 +76,19 @@ void BluetoothDevice::updateInfo(bt_device_info_s *deviceInfo) std::string BluetoothDevice::getName() const { - LogDebug("Enter"); + LoggerD("Enter"); return mName; } std::string BluetoothDevice::getAddress() const { - LogDebug("Enter"); + LoggerD("Enter"); return mAddress; } JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); /* JSValueRef deviceClass = mLocalProperty.getProperty(context, BLUETOOTH_DEVICE_DEVICE_CLASS); if(deviceClass == NULL) { @@ -103,7 +103,7 @@ JSValueRef BluetoothDevice::getDeviceClass(JSContextRef context) bool BluetoothDevice::isBonded() const { - LogDebug("Enter"); + LoggerD("Enter"); bool ret = false; bt_device_info_s *deviceInfo = NULL; @@ -117,7 +117,7 @@ bool BluetoothDevice::isBonded() const bool BluetoothDevice::isTrusted() const { - LogDebug("Enter"); + LoggerD("Enter"); bool ret = false; bt_device_info_s *deviceInfo = NULL; @@ -131,7 +131,7 @@ bool BluetoothDevice::isTrusted() const bool BluetoothDevice::isConnected() const { - LogDebug("Enter"); + LoggerD("Enter"); bool ret = false; bt_device_info_s *deviceInfo = NULL; @@ -145,7 +145,7 @@ bool BluetoothDevice::isConnected() const JSValueRef BluetoothDevice::getUUIDs(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); /* if(isUpdated == true) { mLocalProperty.setProperty(context, BLUETOOTH_DEVICE_UUIDS, JSUtil::toJSValueRef(context, mUUIDs)); diff --git a/src/Bluetooth/BluetoothServiceHandler.cpp b/src/Bluetooth/BluetoothServiceHandler.cpp index cc69e98..b63748f 100644 --- a/src/Bluetooth/BluetoothServiceHandler.cpp +++ b/src/Bluetooth/BluetoothServiceHandler.cpp @@ -41,24 +41,24 @@ BluetoothServiceHandler::BluetoothServiceHandler(std::string uuid, std::string n BluetoothServiceHandler::~BluetoothServiceHandler() { - LogDebug("Enter"); + LoggerD("Enter"); if(mIsRegistered) { BluetoothAdapter::getInstance()->unregisterUUID(mUUID); if(bt_socket_destroy_rfcomm(mRegisteredSocket) != BT_ERROR_NONE) { - LogWarning("Already destroyed"); + LoggerW("Already destroyed"); } } } bool BluetoothServiceHandler::setOnConnect(JSContextRef context, JSObjectRef onConnect) { - LogDebug("Enter"); + LoggerD("Enter"); MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); return false; } callback->setCallback("onconnect", onConnect); @@ -89,11 +89,11 @@ MultiCallbackUserDataPtr BluetoothServiceHandler::getOnConnect() const JSValueRef BluetoothServiceHandler::getOnConnect(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); JSValueRef onConnect = mLocalProperty.getProperty(context, BLUETOOTH_SERVICE_HANDLER_ONCONNECT); if(onConnect == NULL) { - LogDebug("onconnect is null"); + LoggerD("onconnect is null"); return JSValueMakeNull(context); } @@ -112,7 +112,7 @@ bool BluetoothServiceHandler::getConnectionState() void BluetoothServiceHandler::unregister(MultiCallbackUserDataPtr userData) { - LogDebug("Enter"); + LoggerD("Enter"); if(BluetoothAdapter::getInstance()->getPowered() == true) { if(bt_socket_destroy_rfcomm(mRegisteredSocket) == BT_ERROR_NONE) { diff --git a/src/Bluetooth/BluetoothSocket.cpp b/src/Bluetooth/BluetoothSocket.cpp index 4684a62..a3f3f4b 100644 --- a/src/Bluetooth/BluetoothSocket.cpp +++ b/src/Bluetooth/BluetoothSocket.cpp @@ -32,7 +32,7 @@ namespace Bluetooth { BluetoothSocket::BluetoothSocket(bt_socket_connection_s *connection) { - LogDebug("Enter"); + LoggerD("Enter"); mConnectedSocket = connection->socket_fd; mUUID = std::string(connection->service_uuid); mIsConnected = true; @@ -47,25 +47,25 @@ BluetoothSocket::BluetoothSocket(bt_socket_connection_s *connection) BluetoothSocket::~BluetoothSocket() { - LogDebug("Enter"); + LoggerD("Enter"); if(mIsConnected) { if(bt_socket_disconnect_rfcomm(mConnectedSocket) != BT_ERROR_NONE) { - LogWarning("Already disconnected"); + LoggerW("Already disconnected"); } if(!BluetoothAdapter::getInstance()->closeConnectedSocket(mConnectedSocket)) { - LogWarning("Already done"); + LoggerW("Already done"); } } } bool BluetoothSocket::setOnMessage(JSContextRef context, JSObjectRef onMessage) { - LogDebug("Enter"); + LoggerD("Enter"); MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); return false; } callback->setCallback("onmessage", onMessage); @@ -76,11 +76,11 @@ bool BluetoothSocket::setOnMessage(JSContextRef context, JSObjectRef onMessage) bool BluetoothSocket::setOnClose(JSContextRef context, JSObjectRef onClose) { - LogDebug("Enter"); + LoggerD("Enter"); MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); return false; } callback->setCallback("onclose", onClose); @@ -91,11 +91,11 @@ bool BluetoothSocket::setOnClose(JSContextRef context, JSObjectRef onClose) bool BluetoothSocket::setOnError(JSContextRef context, JSObjectRef onError) { - LogDebug("Enter"); + LoggerD("Enter"); MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); return false; } callback->setCallback("onerror", onError); @@ -106,25 +106,25 @@ bool BluetoothSocket::setOnError(JSContextRef context, JSObjectRef onError) std::string BluetoothSocket::getUUID() const { - LogDebug("Enter"); + LoggerD("Enter"); return mUUID; } void BluetoothSocket::setConnectionState(bool isConnected) { - LogDebug("Enter"); + LoggerD("Enter"); mIsConnected = isConnected; } bool BluetoothSocket::getConnectionState() { - LogDebug("Enter"); + LoggerD("Enter"); return mIsConnected; } JSValueRef BluetoothSocket::getPeer(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); /* JSValueRef peer = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_PEER); if(peer == NULL && mPeer != NULL) { @@ -144,10 +144,10 @@ MultiCallbackUserDataPtr BluetoothSocket::getOnMessage() const JSValueRef BluetoothSocket::getOnMessage(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); JSValueRef onMessage = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_ONMESSAGE); if(onMessage == NULL) { - LogDebug("onmessage is null"); + LoggerD("onmessage is null"); return JSValueMakeNull(context); } @@ -161,11 +161,11 @@ MultiCallbackUserDataPtr BluetoothSocket::getOnClose() const JSValueRef BluetoothSocket::getOnClose(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); JSValueRef onClose = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_ONCLOSE); if(onClose == NULL) { - LogDebug("onclose is null"); + LoggerD("onclose is null"); return JSValueMakeNull(context); } @@ -179,11 +179,11 @@ MultiCallbackUserDataPtr BluetoothSocket::getOnError() const JSValueRef BluetoothSocket::getOnError(JSContextRef context) { - LogDebug("Enter"); + LoggerD("Enter"); JSValueRef onError = mLocalProperty.getProperty(context, BLUETOOTH_SOCKET_ONERROR); if(onError == NULL) { - LogDebug("onerror is null"); + LoggerD("onerror is null"); return JSValueMakeNull(context); } @@ -192,11 +192,11 @@ JSValueRef BluetoothSocket::getOnError(JSContextRef context) unsigned long BluetoothSocket::writeData(char* data, unsigned long size) { - LogDebug("Enter"); + LoggerD("Enter"); unsigned long ret = 0; if(bt_socket_send_data(mConnectedSocket, data, static_cast(size)) == BT_ERROR_NONE) { - LogDebug("bt_socket_send_data() succeeded"); + LoggerD("bt_socket_send_data() succeeded"); ret = size; } else { @@ -209,7 +209,7 @@ unsigned long BluetoothSocket::writeData(char* data, unsigned long size) void BluetoothSocket::storeRecivedData(char *data, unsigned long size) { - LogDebug("Enter"); + LoggerD("Enter"); for(unsigned long i = 0; i < size; i++) { mReceivedData.push_back(static_cast(data[i])); @@ -218,7 +218,7 @@ void BluetoothSocket::storeRecivedData(char *data, unsigned long size) std::vector BluetoothSocket::readData() { - LogDebug("Enter"); + LoggerD("Enter"); std::vector result (mReceivedData); mReceivedData.clear(); @@ -228,15 +228,15 @@ std::vector BluetoothSocket::readData() void BluetoothSocket::close() { - LogDebug("Enter"); + LoggerD("Enter"); if(!mIsConnected) { - LogDebug("Already disconnected"); + LoggerD("Already disconnected"); return; } if(bt_socket_disconnect_rfcomm(mConnectedSocket) != BT_ERROR_NONE) { - LogError("bt_socket_disconnect_rfcomm() failed"); + LoggerE("bt_socket_disconnect_rfcomm() failed"); throw UnknownException("Unknown error"); } diff --git a/src/Bluetooth/JSBluetoothAdapter.cpp b/src/Bluetooth/JSBluetoothAdapter.cpp index dfd44da..9286caf 100644 --- a/src/Bluetooth/JSBluetoothAdapter.cpp +++ b/src/Bluetooth/JSBluetoothAdapter.cpp @@ -100,14 +100,14 @@ JSObjectRef JSBluetoothAdapter::createJSObject(JSContextRef context) void JSBluetoothAdapter::initialize(JSContextRef context, JSObjectRef object) { // do nothing - LogDebug("Enter"); + LoggerD("Enter"); } void JSBluetoothAdapter::finalize(JSObjectRef object) { // do nothing - LogDebug("Enter"); + LoggerD("Enter"); } JSValueRef JSBluetoothAdapter::getProperty(JSContextRef context, @@ -115,11 +115,11 @@ JSValueRef JSBluetoothAdapter::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { if (JSStringIsEqualToUTF8CString(propertyName, BLUETOOTH_ADAPTER_NAME)) { std::string name = BluetoothAdapter::getInstance()->getName(); - LogDebug("name: " << name); + LoggerD("name: " << name); return JSUtil::toJSValueRef(context, name); } else if (JSStringIsEqualToUTF8CString(propertyName, BLUETOOTH_ADAPTER_POWERED)) { @@ -130,11 +130,11 @@ JSValueRef JSBluetoothAdapter::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, BLUETOOTH_DEVICE_ADDRESS)) { std::string address = BluetoothAdapter::getInstance()->getAddress(); - LogDebug("address: " << address); + LoggerD("address: " << address); return JSUtil::toJSValueRef(context, address); } } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed" << err.getMessage().c_str()); + LoggerW("Getting property is failed" << err.getMessage().c_str()); } return NULL; @@ -147,7 +147,7 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -169,7 +169,7 @@ JSValueRef JSBluetoothAdapter::setName(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -195,7 +195,7 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -218,7 +218,7 @@ JSValueRef JSBluetoothAdapter::setPowered(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -244,7 +244,7 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -270,7 +270,7 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -296,7 +296,7 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -321,34 +321,34 @@ JSValueRef JSBluetoothAdapter::discoverDevices(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiMultiCallbackUserData"); + LoggerW("Can't create MultiMultiCallbackUserData"); } else { // onstarted JSValueRef onstartedValue = JSUtil::getProperty(context , successCallback, "onstarted"); if(!JSValueIsUndefined(context, onstartedValue)) { - LogDebug("There is a onstarted()"); + LoggerD("There is a onstarted()"); callback->setCallback("onstarted", JSUtil::JSValueToObject(context, onstartedValue)); } // ondevicefound JSValueRef ondevicefoundValue = JSUtil::getProperty(context , successCallback, "ondevicefound"); if(!JSValueIsUndefined(context, ondevicefoundValue)) { - LogDebug("There is a ondevicefound()"); + LoggerD("There is a ondevicefound()"); callback->setCallback("ondevicefound", JSUtil::JSValueToObject(context, ondevicefoundValue)); } // ondevicedisappeared JSValueRef ondevicedisappearedValue = JSUtil::getProperty(context , successCallback, "ondevicedisappeared"); if(!JSValueIsUndefined(context, ondevicedisappearedValue)) { - LogDebug("There is a ondevicedisappeared()"); + LoggerD("There is a ondevicedisappeared()"); callback->setCallback("ondevicedisappeared", JSUtil::JSValueToObject(context, ondevicedisappearedValue)); } // onfinished JSValueRef onfinishedValue = JSUtil::getProperty(context , successCallback, "onfinished"); if(!JSValueIsUndefined(context, onfinishedValue)) { - LogDebug("There is a onfinished()"); + LoggerD("There is a onfinished()"); callback->setCallback("onfinished", JSUtil::JSValueToObject(context, onfinishedValue)); } @@ -375,7 +375,7 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -397,7 +397,7 @@ JSValueRef JSBluetoothAdapter::stopDiscovery(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -423,7 +423,7 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -445,7 +445,7 @@ JSValueRef JSBluetoothAdapter::getKnownDevices(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -471,7 +471,7 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -494,7 +494,7 @@ JSValueRef JSBluetoothAdapter::getDevice(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -520,7 +520,7 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -543,7 +543,7 @@ JSValueRef JSBluetoothAdapter::createBonding(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -569,7 +569,7 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -592,7 +592,7 @@ JSValueRef JSBluetoothAdapter::destroyBonding(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); @@ -618,7 +618,7 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -642,7 +642,7 @@ JSValueRef JSBluetoothAdapter::registerRFCOMMServiceByUUID(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); diff --git a/src/Bluetooth/JSBluetoothClass.cpp b/src/Bluetooth/JSBluetoothClass.cpp index f685b03..a80c3d2 100644 --- a/src/Bluetooth/JSBluetoothClass.cpp +++ b/src/Bluetooth/JSBluetoothClass.cpp @@ -92,7 +92,7 @@ JSObjectRef JSBluetoothClass::createJSObject(JSContextRef context, BluetoothClas void JSBluetoothClass::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); + LoggerD("Enter"); // do nothing } @@ -126,7 +126,7 @@ JSValueRef JSBluetoothClass::getProperty(JSContextRef context, return priv->mClass->getServices(context); } } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; @@ -139,7 +139,7 @@ JSValueRef JSBluetoothClass::hasService(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check diff --git a/src/Bluetooth/JSBluetoothClassDeviceMajor.cpp b/src/Bluetooth/JSBluetoothClassDeviceMajor.cpp index 7272303..84bc269 100644 --- a/src/Bluetooth/JSBluetoothClassDeviceMajor.cpp +++ b/src/Bluetooth/JSBluetoothClassDeviceMajor.cpp @@ -86,13 +86,13 @@ JSObjectRef JSBluetoothClassDeviceMajor::createJSObject(JSContextRef context) void JSBluetoothClassDeviceMajor::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); + LoggerD("Enter"); // Do nothing } void JSBluetoothClassDeviceMajor::finalize(JSObjectRef object) { - LogDebug("Enter"); + LoggerD("Enter"); // Do nothing } @@ -105,7 +105,7 @@ JSValueRef JSBluetoothClassDeviceMajor::getProperty(JSContextRef context, std::string name = JSUtil::JSStringToString(context, propertyName); return JSUtil::toJSValueRef(context, BluetoothClassDeviceMajor::getInstance()->getMajorValue(name)); } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; diff --git a/src/Bluetooth/JSBluetoothClassDeviceMinor.cpp b/src/Bluetooth/JSBluetoothClassDeviceMinor.cpp index 81541d8..33cbd68 100644 --- a/src/Bluetooth/JSBluetoothClassDeviceMinor.cpp +++ b/src/Bluetooth/JSBluetoothClassDeviceMinor.cpp @@ -147,12 +147,12 @@ JSObjectRef JSBluetoothClassDeviceMinor::createJSObject(JSContextRef context) void JSBluetoothClassDeviceMinor::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } void JSBluetoothClassDeviceMinor::finalize(JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } JSValueRef JSBluetoothClassDeviceMinor::getProperty(JSContextRef context, @@ -164,7 +164,7 @@ JSValueRef JSBluetoothClassDeviceMinor::getProperty(JSContextRef context, std::string name = JSUtil::JSStringToString(context, propertyName); return JSUtil::toJSValueRef(context, BluetoothClassDeviceMinor::getInstance()->getMinorValue(name)); } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; diff --git a/src/Bluetooth/JSBluetoothClassDeviceService.cpp b/src/Bluetooth/JSBluetoothClassDeviceService.cpp index 18d894e..592a4f8 100644 --- a/src/Bluetooth/JSBluetoothClassDeviceService.cpp +++ b/src/Bluetooth/JSBluetoothClassDeviceService.cpp @@ -85,12 +85,12 @@ JSObjectRef JSBluetoothClassDeviceService::createJSObject(JSContextRef context) void JSBluetoothClassDeviceService::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } void JSBluetoothClassDeviceService::finalize(JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } JSValueRef JSBluetoothClassDeviceService::getProperty(JSContextRef context, @@ -102,7 +102,7 @@ JSValueRef JSBluetoothClassDeviceService::getProperty(JSContextRef context, std::string name = JSUtil::JSStringToString(context, propertyName); return JSUtil::toJSValueRef(context, BluetoothClassDeviceService::getInstance()->getServiceValue(name)); } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; diff --git a/src/Bluetooth/JSBluetoothDevice.cpp b/src/Bluetooth/JSBluetoothDevice.cpp index c9306af..38fb9e1 100644 --- a/src/Bluetooth/JSBluetoothDevice.cpp +++ b/src/Bluetooth/JSBluetoothDevice.cpp @@ -97,7 +97,7 @@ JSObjectRef JSBluetoothDevice::createJSObject(JSContextRef context, BluetoothDev void JSBluetoothDevice::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); + LoggerD("Enter"); // Do nothing } @@ -143,7 +143,7 @@ JSValueRef JSBluetoothDevice::getProperty(JSContextRef context, return priv->mDevice->getUUIDs(context); } } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; @@ -156,7 +156,7 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -185,7 +185,7 @@ JSValueRef JSBluetoothDevice::connectToServiceByUUID(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); diff --git a/src/Bluetooth/JSBluetoothManager.cpp b/src/Bluetooth/JSBluetoothManager.cpp index 5fb9c1d..9ddc5aa 100644 --- a/src/Bluetooth/JSBluetoothManager.cpp +++ b/src/Bluetooth/JSBluetoothManager.cpp @@ -107,16 +107,16 @@ void JSBluetoothManager::initialize(JSContextRef context, JSObjectRef object) JSBluetoothClassDeviceService::createJSObject(context)); if (!JSObjectSetPrivate(object, static_cast(priv))) { - LogWarning("Failed to set private data"); + LoggerW("Failed to set private data"); delete priv; } } else { - LogWarning("Failed to create private data"); + LoggerW("Failed to create private data"); } } else { - LogWarning("Private data already exists"); + LoggerW("Private data already exists"); } } @@ -132,7 +132,7 @@ void JSBluetoothManager::finalize(JSObjectRef object) JSValueRef JSBluetoothManager::getReadOnlyProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { PropertyBag *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { - LogWarning("There is no private data"); + LoggerW("There is no private data"); return NULL; } @@ -147,7 +147,7 @@ JSValueRef JSBluetoothManager::getDefaultAdapter(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check diff --git a/src/Bluetooth/JSBluetoothServiceHandler.cpp b/src/Bluetooth/JSBluetoothServiceHandler.cpp index 6079c5a..aacc633 100644 --- a/src/Bluetooth/JSBluetoothServiceHandler.cpp +++ b/src/Bluetooth/JSBluetoothServiceHandler.cpp @@ -87,18 +87,18 @@ const JSClassDefinition* JSBluetoothServiceHandler::getClassInfo() JSObjectRef JSBluetoothServiceHandler::createJSObject(JSContextRef context, BluetoothServiceHandlerPtr service) { - LogDebug("Enter"); + LoggerD("Enter"); return JSObjectMake(context, getClassRef(), static_cast(service)); } void JSBluetoothServiceHandler::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } void JSBluetoothServiceHandler::finalize(JSObjectRef object) { - LogDebug("Enter"); + LoggerD("Enter"); BluetoothServiceHandlerPtr priv = static_cast(JSObjectGetPrivate(object)); if (priv) { @@ -112,7 +112,7 @@ JSValueRef JSBluetoothServiceHandler::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { BluetoothServiceHandlerPtr priv = static_cast(JSObjectGetPrivate(object)); @@ -133,7 +133,7 @@ JSValueRef JSBluetoothServiceHandler::getProperty(JSContextRef context, return priv->getOnConnect(context); } } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; @@ -145,7 +145,7 @@ bool JSBluetoothServiceHandler::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { BluetoothServiceHandlerPtr priv = static_cast(JSObjectGetPrivate(object)); @@ -171,7 +171,7 @@ bool JSBluetoothServiceHandler::setProperty(JSContextRef context, } } else { - LogDebug("onconnect() is NULL"); + LoggerD("onconnect() is NULL"); } return priv->setOnConnect(context, object); @@ -190,7 +190,7 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -217,7 +217,7 @@ JSValueRef JSBluetoothServiceHandler::unregister(JSContextRef context, MultiCallbackUserDataPtr callback( new MultiCallbackUserData(GlobalContextManager::getInstance()->getGlobalContext(context))); if(!callback){ - LogWarning("Can't create MultiCallbackUserData"); + LoggerW("Can't create MultiCallbackUserData"); } else { callback->setCallback("success", successCallback); diff --git a/src/Bluetooth/JSBluetoothSocket.cpp b/src/Bluetooth/JSBluetoothSocket.cpp index 2230903..c467b25 100644 --- a/src/Bluetooth/JSBluetoothSocket.cpp +++ b/src/Bluetooth/JSBluetoothSocket.cpp @@ -98,7 +98,7 @@ JSObjectRef JSBluetoothSocket::createJSObject(JSContextRef context, BluetoothSoc void JSBluetoothSocket::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Enter"); // do nothing + LoggerD("Enter"); // do nothing } void JSBluetoothSocket::finalize(JSObjectRef object) @@ -115,7 +115,7 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { BluetoothSocketPtr priv = static_cast(JSObjectGetPrivate(object)); @@ -127,7 +127,7 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context, return JSUtil::toJSValueRef(context, priv->getUUID()); } else if (JSStringIsEqualToUTF8CString(propertyName, BLUETOOTH_SOCKET_STATE)) { - LogDebug("get state"); + LoggerD("get state"); std::string state; if(priv->getConnectionState()) { state = "OPEN"; @@ -135,7 +135,7 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context, else { state = "CLOSED"; } - LogDebug("state: " << state); + LoggerD("state: " << state); return JSUtil::toJSValueRef(context, state); } else if (JSStringIsEqualToUTF8CString(propertyName, BLUETOOTH_SOCKET_PEER)) { @@ -151,7 +151,7 @@ JSValueRef JSBluetoothSocket::getProperty(JSContextRef context, return priv->getOnError(context); } } catch (const BasePlatformException &err) { - LogWarning("Getting property is failed: " << err.getMessage().c_str()); + LoggerW("Getting property is failed: " << err.getMessage().c_str()); } return NULL; @@ -187,7 +187,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context, } } else { - LogDebug("onmessage() is NULL"); + LoggerD("onmessage() is NULL"); } return priv->setOnMessage(context, object); @@ -210,7 +210,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context, } } else { - LogDebug("onclose() is NULL"); + LoggerD("onclose() is NULL"); } return priv->setOnClose(context, object); @@ -233,7 +233,7 @@ bool JSBluetoothSocket::setProperty(JSContextRef context, } } else { - LogDebug("onerror() is NULL"); + LoggerD("onerror() is NULL"); } return priv->setOnError(context, object); @@ -252,7 +252,7 @@ JSValueRef JSBluetoothSocket::writeData(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -298,7 +298,7 @@ JSValueRef JSBluetoothSocket::readData(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check @@ -336,7 +336,7 @@ JSValueRef JSBluetoothSocket::close(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); // Access Check diff --git a/src/Bluetooth/plugin_initializer.cpp b/src/Bluetooth/plugin_initializer.cpp index ed41c11..e98bb1f 100644 --- a/src/Bluetooth/plugin_initializer.cpp +++ b/src/Bluetooth/plugin_initializer.cpp @@ -37,36 +37,36 @@ namespace Bluetooth { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Bluetooth] on_widget_start_callback (%d)", widgetId); + LoggerD("[Tizen\\Bluetooth] on_widget_start_callback (%d)", widgetId); TIME_TRACER_INIT(); try { WrtAccessSingleton::Instance().initialize(widgetId); } catch (...) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Bluetooth] on_widget_stop_callback (%d)", widgetId); + LoggerD("[Tizen\\Bluetooth] on_widget_stop_callback (%d)", widgetId); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Bluetooth"); TIME_TRACER_RELEASE(); try { WrtAccessSingleton::Instance().deinitialize(widgetId); } catch (...) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void *context) { - LogDebug("[Tizen\\Bluetooth] on_frame_load_callback (%p)", context); + LoggerD("[Tizen\\Bluetooth] on_frame_load_callback (%p)", context); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void *context) { - LogDebug("[Tizen\\Bluetooth] on_frame_unload_callback (%p)", context); + LoggerD("[Tizen\\Bluetooth] on_frame_unload_callback (%p)", context); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); BluetoothAdapter::getInstance()->unloadFrame(static_cast(context)); } diff --git a/src/Bookmark/BookmarkManager.cpp b/src/Bookmark/BookmarkManager.cpp old mode 100755 new mode 100644 index 5b37002..3b22439 --- a/src/Bookmark/BookmarkManager.cpp +++ b/src/Bookmark/BookmarkManager.cpp @@ -20,11 +20,11 @@ #include "JSBookmarkItem.h" #include #include -#include #include #include #include #include +#include using namespace WrtDeviceApis::CommonsJavaScript; using namespace DeviceAPI::Common; @@ -32,7 +32,7 @@ using namespace DeviceAPI::Common; namespace DeviceAPI { namespace Bookmark{ static bool favorites_bookmark_foreach_cb(favorites_bookmark_entry_s *entry, void *user_data) { - LogDebug("Entered"); + LoggerD("Entered"); if (user_data) { BookmarkSearchData *searchData = static_cast(user_data); int parentId = 0; @@ -41,17 +41,17 @@ static bool favorites_bookmark_foreach_cb(favorites_bookmark_entry_s *entry, voi else parentId = BookmarkManager::getInstance()->getRootFolderId(); - LogDebug("parentId : " << parentId); - LogDebug("m_reculsive : " << searchData->m_reculsive); - LogDebug("entry title : " << entry->title); - LogDebug("entry id : " << entry->id); + LoggerD("parentId : " << parentId); + LoggerD("m_reculsive : " << searchData->m_reculsive); + LoggerD("entry title : " << entry->title); + LoggerD("entry id : " << entry->id); if (!(searchData->isAlive) && (entry->id == parentId)) searchData->isAlive = true; - LogDebug("isAlive : " << searchData->isAlive); + LoggerD("isAlive : " << searchData->isAlive); if ((searchData->m_reculsive) || (entry->folder_id == parentId)) { - LogDebug("found subitem : " << entry->title); + LoggerD("found subitem : " << entry->title); BookmarkDataPtr bookmark; if (entry->is_folder) bookmark = BookmarkDataPtr(new BookmarkData(BOOKMARKFOLDER_TYPE, entry->title, "", entry->id, entry->folder_id)); @@ -63,40 +63,40 @@ static bool favorites_bookmark_foreach_cb(favorites_bookmark_entry_s *entry, voi if (!(searchData->isAlive) || (searchData->m_reculsive) || (parentId == BookmarkManager::getInstance()->getRootFolderId()) || ((searchData->m_bookmark)->m_type == BOOKMARKFOLDER_TYPE)) return true; } else - LogDebug("user_data is null"); + LoggerD("user_data is null"); - LogDebug("stop "); + LoggerD("stop "); return false; } static bool favorites_bookmark_parent_search_cb(favorites_bookmark_entry_s *entry, void *user_data) { if (user_data){ BookmarkParentSearchData *parentSearchData = static_cast(user_data); - LogDebug("entry->id : " << entry->id); + LoggerD("entry->id : " << entry->id); if (entry->id == parentSearchData->m_id) { parentSearchData->isAlive = true; } else if (entry->id == parentSearchData->m_parentId){ - LogDebug("Found parent"); + LoggerD("Found parent"); parentSearchData->isParentAlive = true; parentSearchData->m_parent = BookmarkDataPtr(new BookmarkData(BOOKMARKFOLDER_TYPE, entry->title, "", entry->id, entry->folder_id)); } else return true; if (parentSearchData->isAlive && parentSearchData->isParentAlive) { - LogDebug("Found parent.Stop."); + LoggerD("Found parent.Stop."); return false; } else return true; } - LogDebug("user_data is null"); + LoggerD("user_data is null"); return false; } std::vector BookmarkManager::get(BookmarkSearchDataPtr &searchData){ - LogDebug("Entered"); + LoggerD("Entered"); int count; std::vector bookmarkArray; if (favorites_bookmark_get_count(&count) == FAVORITES_ERROR_NONE) { @@ -124,7 +124,7 @@ std::vector BookmarkManager::get(BookmarkSearchDataPtr &searchD } std::vector BookmarkManager::_getCompleteCB(BookmarkSearchDataPtr &searchData){ - LogDebug("Enter"); + LoggerD("Enter"); std::vector bookmarkArray; //check if searchData->m_bookmark is in db or not if (searchData->isAlive) { @@ -138,25 +138,25 @@ std::vector BookmarkManager::_getCompleteCB(BookmarkSearchDataP BookmarkData *parent = searchData->m_bookmark; for (it=(searchData->m_results).begin(); it!=(searchData->m_results).end(); ++it) - LogDebug("it->first:"<first << " it->second:" <<(it->second)->m_id); + LoggerD("it->first:"<first << " it->second:" <<(it->second)->m_id); int lastItemId = (((searchData->m_results).rbegin())->second)->m_id; - LogDebug("end's first:"<<((searchData->m_results).rbegin())->first << "end's second:"<m_results).rbegin())->first << "end's second:"<m_results).find(parent->m_id); - LogDebug("it->first:"<first << " parent->m_id:" <m_id); + LoggerD("it->first:"<first << " parent->m_id:" <m_id); while (it->first == parent->m_id) { - LogDebug("it->second:"<<(it->second)->m_id); + LoggerD("it->second:"<<(it->second)->m_id); bookmarkArray.push_back(it->second); - LogDebug("m_type:"<<(it->second)->m_type); + LoggerD("m_type:"<<(it->second)->m_type); //if it is folder, it will be pushed in folders vector if ((it->second)->m_type == BOOKMARKFOLDER_TYPE) folders.push((it->second).get()); if ((it->second)->m_id != lastItemId) { - LogDebug("not last item"); + LoggerD("not last item"); it++; - LogDebug("it->first:"<first << " it->second:" <<(it->second)->m_id); + LoggerD("it->first:"<first << " it->second:" <<(it->second)->m_id); } else break; @@ -164,7 +164,7 @@ std::vector BookmarkManager::_getCompleteCB(BookmarkSearchDataP if (folders.size()) { parent = folders.front(); - LogDebug("parent->m_id:" <m_id); + LoggerD("parent->m_id:" <m_id); folders.pop(); } else break; @@ -179,12 +179,12 @@ std::vector BookmarkManager::_getCompleteCB(BookmarkSearchDataP } else { // Not found Error because it is not in db throw NotFoundException("Can't find the parent folder"); } - LogDebug("Success!"); + LoggerD("Success!"); return bookmarkArray; } int BookmarkManager::add(bookmarkType type, const int parent_id, const std::string& title, const std::string& url) { - LogDebug("Entered"); + LoggerD("Entered"); int id = UNDEFINED_ID; int result = favorites_bookmark_add(title.c_str(), url.c_str(), parent_id, static_cast(type), &id); if (result == FAVORITES_ERROR_NONE) @@ -202,7 +202,7 @@ int BookmarkManager::add(bookmarkType type, const int parent_id, const std::stri } void BookmarkManager::remove(BookmarkSearchDataPtr &searchData) { - LogDebug("Entered"); + LoggerD("Entered"); int result = FAVORITES_ERROR_NONE; if (searchData->m_bookmark == NULL) result = favorites_bookmark_delete_all_bookmarks(); @@ -223,7 +223,7 @@ void BookmarkManager::remove(BookmarkSearchDataPtr &searchData) { } } } catch( const NotFoundException& err) { - LogDebug("Not Found"); + LoggerD("Not Found"); return; } } diff --git a/src/Bookmark/JSBookmarkFolder.cpp b/src/Bookmark/JSBookmarkFolder.cpp old mode 100755 new mode 100644 index 44cac31..88a2f53 --- a/src/Bookmark/JSBookmarkFolder.cpp +++ b/src/Bookmark/JSBookmarkFolder.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -25,6 +24,7 @@ #include "JSBookmarkFolder.h" #include "BookmarkManager.h" #include "BookmarkData.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::CommonsJavaScript; @@ -80,12 +80,12 @@ const JSClassDefinition* JSBookmarkFolder::getClassInfo() void JSBookmarkFolder::initialize(JSContextRef ctx, JSObjectRef object) { - LogDebug("JSBookmarkFolder::initialize()\n"); + LoggerD("JSBookmarkFolder::initialize()\n"); } void JSBookmarkFolder::finalize(JSObjectRef object) { - LogDebug("JSBookmarkFolder::finalize()\n"); + LoggerD("JSBookmarkFolder::finalize()\n"); BookmarkData * priv = static_cast(JSObjectGetPrivate(object)); if( priv ){ JSObjectSetPrivate(object, NULL); @@ -94,7 +94,7 @@ void JSBookmarkFolder::finalize(JSObjectRef object) } JSObjectRef JSBookmarkFolder::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception){ - LogDebug("Enter"); + LoggerD("Enter"); try{ ArgumentValidator validator(ctx, argumentCount, arguments); @@ -120,7 +120,7 @@ JSObjectRef JSBookmarkFolder::createJSObject(JSContextRef context, const std::st } JSObjectRef JSBookmarkFolder::createJSObject(JSContextRef context, const std::string &title, const int id, const int parentId) { - LogDebug("Enter"); + LoggerD("Enter"); if (title == "") throw InvalidValuesException("Title is empty"); BookmarkData *priv = new BookmarkData(BOOKMARKFOLDER_TYPE, title, "", id, parentId); @@ -135,14 +135,14 @@ JSObjectRef JSBookmarkFolder::createJSObject(JSContextRef context, void *priv) { } #endif JSValueRef JSBookmarkFolder::getParent(JSContextRef context, JSObjectRef object) { - LogDebug("Enter");; + LoggerD("Enter");; BookmarkData * priv = static_cast(JSObjectGetPrivate(object)); if (!priv) throw TypeMismatchException("Private data is null"); - LogDebug("bookmark id:" << priv->m_id); - LogDebug("bookmark parent id:" << priv->m_parentId); + LoggerD("bookmark id:" << priv->m_id); + LoggerD("bookmark parent id:" << priv->m_parentId); if (priv->m_id != UNDEFINED_ID) { BookmarkParentSearchDataPtr parentSearchData(new BookmarkParentSearchData(priv->m_id, priv->m_parentId)); bool isAlive = BookmarkManager::getInstance()->findParent(parentSearchData); @@ -159,7 +159,7 @@ JSValueRef JSBookmarkFolder::getParent(JSContextRef context, JSObjectRef object) JSValueRef JSBookmarkFolder::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_BOOKMARKFOLDER_PARENT)) { diff --git a/src/Bookmark/JSBookmarkItem.cpp b/src/Bookmark/JSBookmarkItem.cpp old mode 100755 new mode 100644 index 51edb4a..55d0c06 --- a/src/Bookmark/JSBookmarkItem.cpp +++ b/src/Bookmark/JSBookmarkItem.cpp @@ -18,13 +18,13 @@ #include "JSBookmarkItem.h" #include "JSBookmarkFolder.h" #include "BookmarkData.h" -#include #include #include #include #include #include #include +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::CommonsJavaScript; @@ -83,12 +83,12 @@ const JSClassDefinition* JSBookmarkItem::getClassInfo() void JSBookmarkItem::initialize(JSContextRef ctx, JSObjectRef object) { - LogDebug("JSBookmarkItem::initialize()"); + LoggerD("JSBookmarkItem::initialize()"); } void JSBookmarkItem::finalize(JSObjectRef object) { - LogDebug("JSBookmarkItem::finalize()"); + LoggerD("JSBookmarkItem::finalize()"); BookmarkData *priv = static_cast(JSObjectGetPrivate(object)); if( priv ){ JSObjectSetPrivate(object, NULL); @@ -97,7 +97,7 @@ void JSBookmarkItem::finalize(JSObjectRef object) } JSObjectRef JSBookmarkItem::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception){ - LogDebug("JSBookmarkItem::constructor()"); + LoggerD("JSBookmarkItem::constructor()"); ArgumentValidator validator(ctx, argumentCount, arguments); try{ std::string title = validator.toString(0); @@ -119,11 +119,11 @@ JSObjectRef JSBookmarkItem::constructor(JSContextRef ctx, JSObjectRef constructo } JSObjectRef JSBookmarkItem::createJSObject(JSContextRef context, const std::string &title, const std::string &url) { - LogDebug("Enter"); + LoggerD("Enter"); return createJSObject(context, title, url, UNDEFINED_ID, UNDEFINED_ID); } JSObjectRef JSBookmarkItem::createJSObject(JSContextRef context, const std::string &title, const std::string &url, const int id, const int parentId) { - LogDebug("Enter"); + LoggerD("Enter"); if (title == "") throw InvalidValuesException("Title is empty"); if (url == "") @@ -141,7 +141,7 @@ JSObjectRef JSBookmarkItem::createJSObject(JSContextRef context, void *priv) { #endif JSValueRef JSBookmarkItem::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); try { Converter convert(context); BookmarkData *priv = static_cast(JSObjectGetPrivate(object)); diff --git a/src/Bookmark/JSBookmarkManager.cpp b/src/Bookmark/JSBookmarkManager.cpp old mode 100755 new mode 100644 index 637c546..b5ab4a2 --- a/src/Bookmark/JSBookmarkManager.cpp +++ b/src/Bookmark/JSBookmarkManager.cpp @@ -32,11 +32,8 @@ #include #include -#include #include - -#undef LOG_TAG -#define LOG_TAG "TIZEN_DEVICEAPI" +#include using namespace std; using namespace WrtDeviceApis::CommonsJavaScript; @@ -103,7 +100,7 @@ bool JSBookmarkManager::hasInstance(JSContextRef context, JSObjectRef constructo } JSValueRef JSBookmarkManager::get(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception){ - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = BOOKMARK_CHECK_ACCESS(BOOKMARK_FUNCTION_API_READ_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception); @@ -128,12 +125,12 @@ JSValueRef JSBookmarkManager::get(JSContextRef ctx, JSObjectRef object, JSObject BookmarkSearchDataPtr searchData(new BookmarkSearchData(parentFolder,reculsive)); std::vector bookmarkList = BookmarkManager::getInstance()->get(searchData); unsigned short bookmarksCount = bookmarkList.size(); - LogDebug("count : " << bookmarksCount); + LoggerD("count : " << bookmarksCount); std::vector bookmarksArray; Converter converter(ctx); for (int i = 0; i < bookmarksCount; i++) { JSValueRef bookmark; - LogDebug("bookmarkList["<m_title)); + LoggerD("bookmarkList["<m_title)); if (bookmarkList[i]->m_type == BOOKMARKITEM_TYPE) bookmark = static_cast(JSBookmarkItem::createJSObject(ctx, bookmarkList[i]->m_title, bookmarkList[i]->m_url, bookmarkList[i]->m_id, bookmarkList[i]->m_parentId)); else @@ -149,7 +146,7 @@ JSValueRef JSBookmarkManager::get(JSContextRef ctx, JSObjectRef object, JSObject } JSValueRef JSBookmarkManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception){ - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = BOOKMARK_CHECK_ACCESS(BOOKMARK_FUNCTION_API_WRITE_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception); @@ -161,7 +158,7 @@ JSValueRef JSBookmarkManager::add(JSContextRef ctx, JSObjectRef object, JSObject try { bookmarkobj = validator.toObject(0, JSBookmarkItem::getClassRef()); } catch (const TypeMismatchException& err){ - LogDebug("Bookmark's type is not BookmarkItem"); + LoggerD("Bookmark's type is not BookmarkItem"); bookmarkobj = validator.toObject(0, JSBookmarkFolder::getClassRef()); } BookmarkData * bookmark = static_cast(JSObjectGetPrivate(bookmarkobj)); @@ -192,8 +189,8 @@ JSValueRef JSBookmarkManager::add(JSContextRef ctx, JSObjectRef object, JSObject bookmark->m_id = BookmarkManager::getInstance()->add(bookmark->m_type, parentId, bookmark->m_title, bookmark->m_url); bookmark->m_parentId = parentId; - LogDebug("bookmark id:" << bookmark->m_id); - LogDebug("bookmark parent id:" << bookmark->m_parentId); + LoggerD("bookmark id:" << bookmark->m_id); + LoggerD("bookmark parent id:" << bookmark->m_parentId); }catch( const BasePlatformException& err){ return JSWebAPIException::throwException(ctx, exception, err); @@ -204,7 +201,7 @@ JSValueRef JSBookmarkManager::add(JSContextRef ctx, JSObjectRef object, JSObject } JSValueRef JSBookmarkManager::remove(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception){ - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = BOOKMARK_CHECK_ACCESS(BOOKMARK_FUNCTION_API_WRITE_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception); @@ -216,7 +213,7 @@ JSValueRef JSBookmarkManager::remove(JSContextRef ctx, JSObjectRef object, JSObj try { bookmarkobj = validator.toObject(0, JSBookmarkItem::getClassRef(), true); } catch (const TypeMismatchException& err){ - LogDebug("Bookmark's type is not BookmarkItem"); + LoggerD("Bookmark's type is not BookmarkItem"); bookmarkobj = validator.toObject(0, JSBookmarkFolder::getClassRef(), true); } diff --git a/src/Bookmark/plugin_initializer.cpp b/src/Bookmark/plugin_initializer.cpp old mode 100755 new mode 100644 index 99c0ce7..8215819 --- a/src/Bookmark/plugin_initializer.cpp +++ b/src/Bookmark/plugin_initializer.cpp @@ -14,9 +14,6 @@ * limitations under the License. */ - -#include - #include #include #include @@ -25,6 +22,7 @@ #include "JSBookmarkManager.h" #include "JSBookmarkFolder.h" #include "JSBookmarkItem.h" +#include namespace DeviceAPI { namespace Bookmark { @@ -35,38 +33,38 @@ using namespace DeviceAPI::Common; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Bookmark] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Bookmark] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch (Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Bookmark] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Bookmark] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Bookmark"); TIME_TRACER_RELEASE(); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch (Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\Bookmark] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\Bookmark] on_frame_load_callback (" << context << ")"); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Bookmark] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\Bookmark] on_frame_unload_callback (" << context << ")"); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 983e7bb..7e0c62f 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,9 +18,10 @@ SET(LIBS_COMMON ) add_subdir(Common/StandaloneConsole) -add_subdir(Common/TimeTracer) IF(ENABLE_TIME_TRACER) +add_subdir(Common/TimeTracer) + SET(LIBS_COMMON ${LIBS_COMMON} "timetracer" diff --git a/src/Calendar/Calendar.cpp b/src/Calendar/Calendar.cpp old mode 100755 new mode 100644 index 55e4e9d..ad11cdf --- a/src/Calendar/Calendar.cpp +++ b/src/Calendar/Calendar.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include -#include #include #include "Calendar.h" #include "CalendarManager.h" @@ -32,6 +30,7 @@ #include #include #include +#include using namespace WrtDeviceApis::Commons; @@ -54,14 +53,14 @@ void Calendar::OnRequestReceived(const IEventAddEventPtr &event) ThrowMsg(NullPointerException, "Item parameter is NULL."); } if (event->getEvent()->getIdIsSet()) { - LogWarning("Non-null item id."); + LoggerW("Non-null item id."); event->getEvent()->resetId(); } DPL::ScopedPtr eventWrapper(new EventWrapper(event->getEvent(), getType())); if(getIsUnified()) { - LogDebug("Set the default calendar id for a unified calendar item."); + LoggerD("Set the default calendar id for a unified calendar item."); event->getEvent()->setCalendarId(DEFAULT_EVENT_CALENDAR_BOOK_ID); } else { std::stringstream ss(getId()); @@ -78,7 +77,7 @@ void Calendar::OnRequestReceived(const IEventAddEventPtr &event) } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -106,13 +105,13 @@ void Calendar::OnRequestReceived(const IEventAddEventsPtr &event) for(unsigned int i=0; igetEvents()->size(); i++) { CalendarEventPtr theItem = event->getEvents()->at(i); if (theItem->getIdIsSet()) { - LogWarning("Item has index: " << i << ". Resetting it."); + LoggerW("Item has index: " << i << ". Resetting it."); theItem->resetId(); } DPL::ScopedPtr eventWrapper(new EventWrapper(theItem, getType())); if(getIsUnified()) { - LogDebug("Set the default calendar id for a unified calendar item."); + LoggerD("Set the default calendar id for a unified calendar item."); theItem->setCalendarId(DEFAULT_EVENT_CALENDAR_BOOK_ID); } else { std::stringstream ss(getId()); @@ -140,7 +139,7 @@ void Calendar::OnRequestReceived(const IEventAddEventsPtr &event) if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't insert the item list: "<setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -193,11 +192,11 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) DPL::ScopedPtr eventWrapper(new EventWrapper(theItem, getType())); eventWrapper->convertAbstractEventToPlatformEvent(true); - if ( event->getUpdateAllInstances() || 0>=theItem->getRecurrenceRule()->getFrequency()) { + if ( event->getUpdateAllInstances() || 0>=theItem->getRecurrenceRule()->getFrequency() || UNDEFINED_TIME==theItem->getRecurrenceId()) { // Platform detects the detached events and uptates all instances. eventWrapper->saveEvent(); } else { - LogDebug("Update the exdate for a recurring parent event and add a new child event."); + LoggerD("Update the exdate for a recurring parent event and add a new child event."); // First update the parent event. EventRecurrenceRulePtr rrule = theItem->getRecurrenceRule(); @@ -216,7 +215,7 @@ void Calendar::OnRequestReceived(const IEventUpdateEventPtr &event) if(ret!=CALENDAR_ERROR_NONE) { ThrowMsg(PlatformException, "Can't update the exdate: "<setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -314,22 +313,22 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &event) if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't add the detached item to the list: "<getId()); + LoggerD("Added the detached event to the update list: "<getId()); } - } else if (event->getUpdateAllInstances() || 0>=thisEvent->getRecurrenceRule()->getFrequency()) { + } else if (event->getUpdateAllInstances() || 0>=thisEvent->getRecurrenceRule()->getFrequency() || UNDEFINED_TIME==thisEvent->getRecurrenceId()) { // Platform detects the detached events and uptates all instances. - record = NULL; + record = NULL; ret = calendar_record_clone(eventWrapper->getPlatformEvent(), &record); - if(CALENDAR_ERROR_NONE!=ret) { - ThrowMsg(PlatformException, "Clonning failed: "< eventWrapperChild(new EventWrapper(thisEvent, getType())); eventWrapperChild->convertAbstractEventToPlatformEvent(true); @@ -339,7 +338,7 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &event) if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Cannot set event recurrence id: "<getRecurrenceId()); + LoggerD("Saved the rid for the child: "<getRecurrenceId()); } ret = calendar_record_set_int(eventWrapperChild->getPlatformEvent(), _calendar_event.original_event_id, thisEvent->getId()); @@ -382,7 +381,7 @@ void Calendar::OnRequestReceived(const IEventUpdateEventsPtr &event) if(ret!=CALENDAR_ERROR_NONE) { ThrowMsg(PlatformException, "Can't update the exdate: "<0) { ret = calendar_db_insert_records(listForAdd, NULL, NULL); if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't insert the item list: "<0) { ret = calendar_db_update_records(listForUpdate); if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't update the item list: "<setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -473,7 +472,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventPtr &event) long long int rid; ss>>rid; - LogDebug("id: " << id << ", rid: " << rid); + LoggerD("id: " << id << ", rid: " << rid); eventWrapper->loadEvent(id); @@ -485,13 +484,13 @@ void Calendar::OnRequestReceived(const IEventDeleteEventPtr &event) } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -517,13 +516,13 @@ void Calendar::OnRequestReceived(const IEventGetPtr &event) } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -571,7 +570,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &event) eventWrapper->getAbstractEvent()->setRecurrenceId(rid); // If the recurrenceId is set, delete the instance of recurring event only. - LogDebug("id to delete: " << id << ", rid: " << rid << ", type: " << getType()); + LoggerD("id to delete: " << id << ", rid: " << rid << ", type: " << getType()); dataType = NULL; if(getType() == CalendarEvent::TASK_TYPE) { @@ -593,7 +592,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &event) ThrowMsg(PlatformException, "Can't get the parent id: "<getAbstractEvent()->getRecurrenceRule(); (*rrule->getExceptions()).push_back(rid); @@ -611,7 +610,7 @@ void Calendar::OnRequestReceived(const IEventDeleteEventsPtr &event) if(ret!=CALENDAR_ERROR_NONE) { ThrowMsg(PlatformException, "Can't delete the instance: "<0) { ret = calendar_db_update_records(listForUpdate); if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't update the item list: "<::iterator it; it = std::find(listForDelete.begin(), listForDelete.end(), listForDetachedParent.at(count)); if(listForDelete.end()==it) { listForDelete.push_back(listForDetached.at(count)); - LogDebug("Add the detached event id to the delete list: "<0) { ret = calendar_db_delete_records(dataType, &listForDelete[0], count); if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't delete the records: "<setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -704,7 +703,7 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) CalendarFilterPtr calendarFilter( new CalendarFilter() ); calendarFilter->setType(getType()); - LogDebug("Default filter created with type "<(calendarFilter); @@ -719,24 +718,24 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) if(!success) { ThrowMsg(InvalidArgumentException, "Invalid filter arguments."); } else { - LogDebug("Filter validation has passed."); + LoggerD("Filter validation has passed."); } genericFilter->travel(filterTraversal, 0); if(getIsUnified()) { - LogDebug("Set all calendars flag for a unified calendar."); + LoggerD("Set all calendars flag for a unified calendar."); calendarFilter->setCalendarId(CALENDAR_BOOK_FILTER_ALL, true); } else { - LogDebug("Set additional calendar id: "<setCalendarId(calendarId, true); } } else { if(getIsUnified()) { - LogDebug("Set all calendars flag for a unified calendar."); + LoggerD("Set all calendars flag for a unified calendar."); calendarFilter->setCalendarId(CALENDAR_BOOK_FILTER_ALL, false); } else { - LogDebug("Set calendar id: "<setCalendarId(calendarId, false); } } @@ -747,7 +746,7 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) calendarFilter->executeQuery(); - LogDebug("Return the query result after conversion."); + LoggerD("Return the query result after conversion."); calendar_list_h resultList = calendarFilter->getResultRecordList(); int ret; @@ -768,14 +767,14 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) calendar_list_next(resultList); } - LogDebug("Length of found items: "<getEvents()->size()); + LoggerD("Length of found items: "<getEvents()->size()); // Handle the recurring event range filter corner case. int id = -1, parentCount = -1; bool found = false; resultList = calendarFilter->getNormalInstanceResultRecordList(); count = calendarFilter->getNormalInstanceResultRecordCount(); - LogDebug("Number of found normal instances: "<getEvents()->at(parentCount)->getId()) { - LogDebug("Found the id: "< eventWrapper(new EventWrapper(getType())); eventWrapper->loadEvent(id); event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent()); @@ -812,11 +811,11 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) calendar_list_next(resultList); } - LogDebug("Length of found items including normal instances: "<getEvents()->size()); + LoggerD("Length of found items including normal instances: "<getEvents()->size()); resultList = calendarFilter->getAlldayInstanceResultRecordList(); count = calendarFilter->getAlldayInstanceResultRecordCount(); - LogDebug("Number of found allday instances: "<getEvents()->at(parentCount)->getId()) { - LogDebug("Found the id: "< eventWrapper(new EventWrapper(getType())); eventWrapper->loadEvent(id); event->addEvent(eventWrapper->convertPlatformEventToAbstractEvent()); @@ -853,25 +852,25 @@ void Calendar::OnRequestReceived(const IEventFindEventsPtr &event) calendar_list_next(resultList); } - LogDebug("Length of found items including allday instances: "<getEvents()->size()); + LoggerD("Length of found items including allday instances: "<getEvents()->size()); event->setResult(true); } Catch (InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -889,15 +888,15 @@ void Calendar::OnRequestReceived(const IEventCreateEventFromStringPtr &event) } Catch(PlatformException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); - LogDebug("eventString: " + event->getEventString()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); + LoggerD("eventString: " + event->getEventString()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); - LogDebug("eventString: " + event->getEventString()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); + LoggerD("eventString: " + event->getEventString()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -919,7 +918,7 @@ void Calendar::OnRequestReceived(const IEventExportEventToStringPtr &event) } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -927,7 +926,7 @@ void Calendar::OnRequestReceived(const IEventExportEventToStringPtr &event) static void eventChangedCb(const char *view_uri, void *user_data) { - LogDebug("Items change cb with view_uri: "<getIsUnified()) { - LogDebug("Set the all calendar id for a unified calendar."); + LoggerD("Set the all calendar id for a unified calendar."); calendarId = CALENDAR_BOOK_FILTER_ALL; } else { std::stringstream ss(thisCalendar->getId()); ss>>calendarId; } - LogDebug("Getting items with calendar id: "<getLastChangedVersion()<<", type: "<getType()); + LoggerD("Getting items with calendar id: "<getLastChangedVersion()<<", type: "<getType()); if (CalendarEvent::TASK_TYPE==thisCalendar->getType()) { ret = calendar_db_get_changes_by_version(_calendar_todo._uri, calendarId, thisCalendar->getLastChangedVersion(), &list, &updatedVersion); } else { @@ -966,7 +965,7 @@ static void eventChangedCb(const char *view_uri, void *user_data) if( CALENDAR_ERROR_NONE!=ret ) { ThrowMsg(PlatformException, "Can't get the item count: "<setStatus(OnEventsChanged::ON_ADD); } else if ( CALENDAR_EVENT_MODIFIED_STATUS_UPDATED==type ) { @@ -998,7 +997,7 @@ static void eventChangedCb(const char *view_uri, void *user_data) } else if ( CALENDAR_EVENT_MODIFIED_STATUS_DELETED==type ) { eventPtr->setStatus(OnEventsChanged::ON_DELETE); } else { - LogWarning("Wrong change type."); + LoggerW("Wrong change type."); calendar_list_next(list); continue; } @@ -1007,7 +1006,7 @@ static void eventChangedCb(const char *view_uri, void *user_data) Try { eventWrapper->loadEvent(id); } Catch (NotFoundException){ - LogDebug("Handling deleted event with index: "<addEvent(eventWrapper->getAbstractEvent()); @@ -1020,7 +1019,7 @@ static void eventChangedCb(const char *view_uri, void *user_data) } thisCalendar->setLastChangedVersion(updatedVersion); - LogDebug("Last change fetch version: "<getLastChangedVersion()); + LoggerD("Last change fetch version: "<getLastChangedVersion()); eventPtr->setResult(true); eventPtr->setCalendarType(thisCalendar->getType()); @@ -1028,12 +1027,12 @@ static void eventChangedCb(const char *view_uri, void *user_data) if( eventPtr->getEventList()->size() > 0 ) { thisCalendar->m_changeEmitters.emit(eventPtr); } else { - LogDebug("No actual changes. Skip signal emission."); + LoggerD("No actual changes. Skip signal emission."); } } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } if( list ) { @@ -1067,7 +1066,7 @@ void Calendar::OnRequestReceived(const IEventWatchChangesPtr &event) ThrowMsg(PlatformException, "Can't get version: "<setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -1100,18 +1099,18 @@ void Calendar::OnRequestReceived(const IEventClearWatchPtr &event) if( CALENDAR_ERROR_NONE!=calendar_db_remove_changed_cb(dataType, eventChangedCb, this) ) { ThrowMsg(PlatformException, "Can't remove change cb."); } else { - LogDebug("Platform watch cleared successfully."); + LoggerD("Platform watch cleared successfully."); } } event->setResult(true); } else { - LogDebug("Wrong watch Id."); + LoggerD("Wrong watch Id."); event->setResult(false); } } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -1206,7 +1205,7 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) if( CALENDAR_ERROR_NONE!=ret ) { ThrowMsg(PlatformException, "Can't get the item count: "<getAbstractEvent()->getRecurrenceId()); + LoggerD("Found a valid event instance with rid: "<getAbstractEvent()->getRecurrenceId()); event->addExpandedEvent(recurringEventWrapper->getAbstractEvent()); } else { - LogDebug("Skip unmatched instance with event_id: "<getId()); + LoggerD("Skip unmatched instance with event_id: "<getId()); } calendar_list_next(list); } - LogDebug("Length of expanded events from parent: "<getExpandedEventList()->size()); + LoggerD("Length of expanded events from parent: "<getExpandedEventList()->size()); if(query) { calendar_query_destroy(query); @@ -1318,7 +1317,7 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) if( CALENDAR_ERROR_NONE!=ret ) { ThrowMsg(PlatformException, "Can't get the item count: "<=startDate && et.time.utime<=endDate) { - LogDebug("Found a valid detached event: "< detachedEventWrapper(new EventWrapper(getType())); detachedEventWrapper->loadEvent(currentRecordIndex); @@ -1366,7 +1365,7 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) calendar_list_next(list); } - LogDebug("Length of total expanded events: "<getExpandedEventList()->size()); + LoggerD("Length of total expanded events: "<getExpandedEventList()->size()); event->setResult(true); @@ -1385,13 +1384,13 @@ void Calendar::OnRequestReceived(const IEventExpandEventRecurrencePtr &event) } Catch (InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } diff --git a/src/Calendar/CalendarConverter.cpp b/src/Calendar/CalendarConverter.cpp old mode 100755 new mode 100644 index 6260ee0..1c67755 --- a/src/Calendar/CalendarConverter.cpp +++ b/src/Calendar/CalendarConverter.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include "JSCalendarEvent.h" @@ -34,7 +32,7 @@ #include #include #include - +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -149,7 +147,7 @@ StringArrayPtr CalendarConverter::toStringArray(const JSValueRef &jsValue) { StringArrayPtr result = StringArrayPtr(new StringArray()); if(!JSIsArrayValue(m_context, jsValue)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid string array type."); } @@ -165,7 +163,7 @@ NumberArrayPtr CalendarConverter::toNumberArray(const JSValueRef &jsValue) { NumberArrayPtr result = NumberArrayPtr(new NumberArray()); if(!JSIsArrayValue(m_context, jsValue)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid number array type."); } @@ -181,7 +179,7 @@ NumberArrayPtr CalendarConverter::toTZDateArray(const JSValueRef &jsValue) { NumberArrayPtr result = NumberArrayPtr(new NumberArray()); if(!JSIsArrayValue(m_context, jsValue)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid TZDate array type."); } @@ -655,14 +653,14 @@ EventAttendeePtr CalendarConverter::toAttendee(JSValueRef attendee) EventAttendeeListPtr CalendarConverter::toVectorOfAttendeesFromDictionary(JSValueRef attendees) { if(!JSIsArrayValue(m_context, attendees)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } EventAttendeeListPtr result(new EventAttendeeList()); JSObjectRef objArg = toJSObjectRef(attendees); - LogDebug("array length "<push_back(toAttendee(element)); @@ -674,20 +672,20 @@ EventAttendeeListPtr CalendarConverter::toVectorOfAttendeesFromDictionary(JSValu EventAttendeeListPtr CalendarConverter::toVectorOfAttendeesFromReference(JSValueRef attendees) { if(!JSIsArrayValue(m_context, attendees)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } EventAttendeeListPtr result(new EventAttendeeList()); JSObjectRef objArg = toJSObjectRef(attendees); - LogDebug("array length "<push_back(JSCalendarAttendee::getPrivateObject(JSValueToObject(m_context, element, NULL))); } else { - LogDebug("Invalid attendee type. Skip this with index: "<push_back(toEventAlarm(element)); @@ -750,20 +748,20 @@ EventAlarmListPtr CalendarConverter::toVectorOfEventAlarmsFromDictionary(JSValue EventAlarmListPtr CalendarConverter::toVectorOfEventAlarmsFromReference(JSValueRef alarms) { if(!JSIsArrayValue(m_context, alarms)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } EventAlarmListPtr result(new EventAlarmList()); JSObjectRef objArg = toJSObjectRef(alarms); - LogDebug("array length "<push_back(JSCalendarAlarm::getPrivateObject(JSValueToObject(m_context, element, NULL))); } else { - LogDebug("Invalid alarm type. Skip this with index: "<setRecurrenceId(oldItem->getRecurrenceId()); result->setCalendarType(oldItem->getCalendarType()); } else { - LogDebug("Constructor mode."); + LoggerD("Constructor mode."); CalendarEventPtr resultPtr(new CalendarEvent()); result = resultPtr; } @@ -850,15 +848,15 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo if (!JSValueIsUndefined(m_context, startTimeData) && !JSValueIsNull(m_context, startTimeData)) { result->setStartTime((long long int) (timeUtilConverter.getTimeInMilliseconds(startTimeData)/1000)); result->setTimeZone(timeUtilConverter.getPropertiesInTZDate(startTimeData).timezone); - LogInfo("start time converted from TZDate: "<getStartTime()<<", time zone: "<getTimeZone()); + LoggerI("start time converted from TZDate: "<getStartTime()<<", time zone: "<getTimeZone()); } else { - LogDebug("Start time undefined."); + LoggerD("Start time undefined."); } if (!JSValueIsUndefined(m_context, durationData) && !JSValueIsNull(m_context, durationData)) { long long length = timeUtilConverter.getDurationLength(durationData); int unit = timeUtilConverter.getDurationUnit(durationData); - LogDebug("duration length: "<setEndTime(result->getStartTime() + length/1000); } else if( SECONDS_UNIT==unit ) { @@ -941,7 +939,7 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo if (!JSValueIsUndefined(m_context, progressData)) { result->setProgress(toInt(progressData)); } - LogDebug("timezone: "<getTimeZone()); + LoggerD("timezone: "<getTimeZone()); return result; } @@ -949,14 +947,14 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo CalendarEventListPtr CalendarConverter::toVectorOfItems(JSValueRef items) { if(!JSIsArrayValue(m_context, items)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } CalendarEventListPtr result(new CalendarEventList()); JSObjectRef objArg = toJSObjectRef(items); - LogDebug("array length "<push_back(JSCalendarTask::getPrivateObject(arg)); } else { - LogDebug("Invalid item type. Skip this with index: "<push_back(toItem(JSGetArrayElement(m_context, objArg, i), true)); } @@ -1016,14 +1014,14 @@ EventIdPtr CalendarConverter::toEventId(JSValueRef eventId) EventIdListPtr CalendarConverter::toVectorOfEventIds(JSValueRef eventIds) { if(!JSIsArrayValue(m_context, eventIds)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } EventIdListPtr result(new EventIdList()); JSObjectRef objArg = toJSObjectRef(eventIds); - LogDebug("array length "<setCalendarType(CalendarEvent::EVENT_TYPE); result->push_back(idPtr); } else { - LogDebug("Invalid event id type. Skip this index: "< CalendarConverter::toVectorOfTimeFromTZDate(JSValueRef dates) { if(!JSIsArrayValue(m_context, dates)) { - LogWarning("JSValue is not an array."); + LoggerW("JSValue is not an array."); ThrowMsg(ConversionException, "Invalid array type."); } @@ -1051,7 +1049,7 @@ std::vector CalendarConverter::toVectorOfTimeFromTZDate(JSValueRe TimeUtilConverter converter(m_context); JSObjectRef objArg = toJSObjectRef(dates); - LogDebug("array length "< #include #include "CalendarEvent.h" +#include namespace DeviceAPI { namespace Calendar { @@ -55,7 +54,7 @@ CalendarEvent::CalendarEvent(): CalendarEvent::CalendarEvent(const CalendarEvent &original) { - LogDebug("Copy constructor called."); + LoggerD("Copy constructor called."); m_id = original.getId(); m_parentId = original.getParentId(); @@ -85,7 +84,7 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original) m_status = original.getStatus(); - LogDebug("Copying alarms..."); + LoggerD("Copying alarms..."); EventAlarmListPtr alarmsPtr( new EventAlarmList() ); m_alarms = alarmsPtr; for( unsigned int i=0; isize(); i++) { @@ -111,7 +110,7 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original) m_uid = original.getUId(); m_recurrenceId = original.getRecurrenceId(); - LogDebug("Copying attendees..."); + LoggerD("Copying attendees..."); EventAttendeeListPtr attendeesPtr( new EventAttendeeList() ); m_attendees = attendeesPtr; for( unsigned int i=0; isize(); i++) { @@ -142,13 +141,13 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original) m_progress = original.getProgress(); m_calendarType = original.getCalendarType(); - LogDebug("Copying done."); + LoggerD("Copying done."); } CalendarEvent::~CalendarEvent() { if(m_categoriesJSRef) { - LogDebug("Unprotect JS categories."); + LoggerD("Unprotect JS categories."); JSValueUnprotect(m_context, m_categoriesJSRef); } } @@ -166,7 +165,7 @@ void CalendarEvent::setId(int value) std::stringstream ss; ss<getFrequency()!=EventRecurrenceRule::NO_RECURRENCE) { - LogDebug("recurrence frequency " << m_recurrence->getFrequency()); - LogDebug("recurrence interval " << m_recurrence->getInterval()); - LogDebug("recurrence recurrenceCount " << m_recurrence->getOccurrenceCount()); - LogDebug("recurrence endDate " << m_recurrence->getEndDate()); + LoggerD("recurrence frequency " << m_recurrence->getFrequency()); + LoggerD("recurrence interval " << m_recurrence->getInterval()); + LoggerD("recurrence recurrenceCount " << m_recurrence->getOccurrenceCount()); + LoggerD("recurrence endDate " << m_recurrence->getEndDate()); } } bool CalendarEvent::validate() const { - LogInfo("Nothing to validate."); + LoggerI("Nothing to validate."); return true; } diff --git a/src/Calendar/CalendarFilter.cpp b/src/Calendar/CalendarFilter.cpp old mode 100755 new mode 100644 index 260f6db..0f27ff5 --- a/src/Calendar/CalendarFilter.cpp +++ b/src/Calendar/CalendarFilter.cpp @@ -15,15 +15,11 @@ // limitations under the License. // - -#include #include "CalendarFilter.h" #include -#include -#include #include - #include "CalendarUtility.h" +#include using namespace WrtDeviceApis::Commons; @@ -141,7 +137,7 @@ CalendarFilter::CalendarFilter() CalendarFilter::~CalendarFilter() { - LogDebug("Clear internal structs for filters."); + LoggerD("Clear internal structs for filters."); if(m_query) { calendar_query_destroy(m_query); } @@ -180,7 +176,7 @@ void CalendarFilter::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int d void CalendarFilter::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth) { - LogDebug("Composite type: "<toString()<<", matchFlag: "<toString()<<", matchFlag: "<getString().c_str()); calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], strMatchFlag, matchValue->getString().c_str()); } - LogDebug("Added str filter with value: "<getString()); + LoggerD("Added str filter with value: "<getString()); } else if(CALENDAR_FILTER_ATTRIBUTE_IS_ALL_DAY==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_EQUAL, matchValue->getBool() ? 1 : 0); @@ -306,7 +302,7 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[CALENDAR_FILTER_ATTRIBUTE_ID_UID], CALENDAR_MATCH_EQUAL, -999); } } - LogDebug("Added int filter with value: "<getBool()); + LoggerD("Added int filter with value: "<getBool()); } else if(CALENDAR_FILTER_ATTRIBUTE_START_DATE==attrName || CALENDAR_FILTER_ATTRIBUTE_DUE_DATE==attrName || CALENDAR_FILTER_ATTRIBUTE_END_DATE==attrName) { @@ -320,7 +316,7 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat calendar_filter_add_caltime(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], intMatchFlag, calTime); calendar_filter_add_caltime(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, calTime); } - LogDebug("Added caltime filter with value: "<getDouble()); calendar_filter_add_double(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], intMatchFlag, matchValue->getDouble()); } - LogDebug("Added double filter with value: "<getDouble()); + LoggerD("Added double filter with value: "<getDouble()); } else if(CALENDAR_FILTER_ATTRIBUTE_ALARMS==attrName || CALENDAR_FILTER_ATTRIBUTE_ATTENDEES==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { @@ -361,7 +357,7 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat calendar_filter_add_int(m_alldayInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_EQUAL, 1); } } - LogDebug("Added int filter."); + LoggerD("Added int filter."); } else if(CALENDAR_FILTER_ATTRIBUTE_CATEGORIES==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { calendar_filter_add_str(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str()); @@ -370,19 +366,19 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat calendar_filter_add_str(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str()); calendar_filter_add_str(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_CONTAINS, matchValue->getString().c_str()); } - LogDebug("Added str filter for categories with value: "<getString()); + LoggerD("Added str filter for categories with value: "<getString()); } else if(CALENDAR_FILTER_ATTRIBUTE_IS_DETACHED==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { - LogWarning("isDetached not supported for a task."); + LoggerW("isDetached not supported for a task."); } else { calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); } - LogDebug("Added int filter for isDetached with value 0."); + LoggerD("Added int filter for isDetached with value 0."); } else if(CALENDAR_FILTER_ATTRIBUTE_RECURRENCE_RULE==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { - LogWarning("rrule not supported for a task."); + LoggerW("rrule not supported for a task."); } else { if( DeviceAPI::Tizen::MATCH_EXACTLY==matchFlag ) { if( matchValue->isNullOrUndefined() ) { @@ -394,29 +390,29 @@ void CalendarFilter::visitAttribute(std::string& attrName, DeviceAPI::Tizen::Mat calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); } - LogDebug("Added int filter for rrule EXACTLY flag."); + LoggerD("Added int filter for rrule EXACTLY flag."); } else { calendar_filter_add_int(m_filter, m_eventAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); calendar_filter_add_int(m_normalInstanceFilter, m_normalInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); calendar_filter_add_int(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_GREATER_THAN, 0); - LogDebug("Added int filter for rrule."); + LoggerD("Added int filter for rrule."); } } } else { - LogWarning("Not supported filter attribute: "<toString()<<", endValue: " <toString()<<", depth: "<toString()<<", endValue: " <toString()<<", depth: "<getDouble()); } } - LogDebug("Added double range filter with initial value: "<getDouble()<<", end value: "<getDouble()); + LoggerD("Added double range filter with initial value: "<getDouble()<<", end value: "<getDouble()); } else if(CALENDAR_FILTER_ATTRIBUTE_COMPLETED_DATE==attrName || CALENDAR_FILTER_ATTRIBUTE_LAST_MODIFIED_DATE==attrName) { if(CalendarEvent::TASK_TYPE==m_type) { @@ -591,7 +587,7 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen calendar_filter_add_lli(m_alldayInstanceFilter, m_alldayInstanceAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, getTimeTFromTZDateAny(endValue)); } } - LogDebug("Added lli range filter with initial value: "<isNullOrUndefined()) { @@ -604,14 +600,14 @@ void CalendarFilter::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen calendar_filter_add_int(m_filter, m_taskAttributeMap[attrName], CALENDAR_MATCH_LESS_THAN_OR_EQUAL, endValue->getLong()); } } else { - LogWarning("progress not supported for an event"); + LoggerW("progress not supported for an event"); } - LogDebug("Added double range filter with initial value: "<getLong()<<", end value: "<getLong()); + LoggerD("Added double range filter with initial value: "<getLong()<<", end value: "<getLong()); } else { - LogWarning("Not supported filter attribute: "<getAttributeName(); if (attrName.compare("") != 0) { - LogDebug("Setting the sort mode with attrName: "<getOrder()==DeviceAPI::Tizen::ASCENDING_SORT_ORDER) { if(CalendarEvent::TASK_TYPE==m_type) { calendar_query_set_sort(m_query, m_taskAttributeMap[attrName], true); @@ -711,7 +707,7 @@ void CalendarFilter::setSortMode(DeviceAPI::Tizen::SortModeArrayPtr attr) } } } else { - LogWarning("Empty attribute name."); + LoggerW("Empty attribute name."); } } @@ -732,11 +728,11 @@ void CalendarFilter::executeQuery() if( CALENDAR_ERROR_NONE!=ret ) { ThrowMsg(PlatformException, "Can't get the item count: "< +#include #include #include #include diff --git a/src/Calendar/CalendarFilterConverter.cpp b/src/Calendar/CalendarFilterConverter.cpp index 915c76a..3736d55 100755 --- a/src/Calendar/CalendarFilterConverter.cpp +++ b/src/Calendar/CalendarFilterConverter.cpp @@ -18,10 +18,10 @@ #include "CalendarFilterConverter.h" -#include #include #include -#include "CalendarFilter.h" +#include "CalendarFilter.h" +#include namespace DeviceAPI { namespace Calendar { diff --git a/src/Calendar/CalendarListenerManager.h b/src/Calendar/CalendarListenerManager.h old mode 100755 new mode 100644 index d50db48..5509a62 --- a/src/Calendar/CalendarListenerManager.h +++ b/src/Calendar/CalendarListenerManager.h @@ -21,13 +21,13 @@ #include #include -#include #include #include #include #include "CalendarResponseDispatcher.h" #include "JSCalendar.h" #include "ICalendar.h" +#include namespace DeviceAPI { namespace Calendar { @@ -63,21 +63,21 @@ public: { CalendarPrivObject *privateObject = static_cast(JSObjectGetPrivate(m_object)); if (!privateObject) { - LogWarning("Object is null."); + LoggerW("Object is null."); return; } ICalendarPtr calendar = privateObject->getObject(); Try { - LogDebug("Remove change listeners for calendar."); + LoggerD("Remove change listeners for calendar."); IEventClearWatchPtr dplEvent(new IEventClearWatch()); dplEvent->setWatchId(m_watchId); dplEvent->setForSynchronousCall(); calendar->clearWatch(dplEvent); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Calendar/CalendarManager.cpp b/src/Calendar/CalendarManager.cpp old mode 100755 new mode 100644 index cd1b943..2c55eed --- a/src/Calendar/CalendarManager.cpp +++ b/src/Calendar/CalendarManager.cpp @@ -19,8 +19,8 @@ #include "CalendarManager.h" #include #include -#include #include +#include using namespace WrtDeviceApis::Commons; @@ -33,9 +33,9 @@ CalendarManager::CalendarManager() { DPL::Mutex::ScopedLock mx(&m_constructorMutex); if (m_instanceCount == 0) { - LogDebug("Connect to the calendar DB."); + LoggerD("Connect to the calendar DB."); if (CALENDAR_ERROR_NONE != calendar_connect()) { - LogError("Calendar DB connection failed."); + LoggerE("Calendar DB connection failed."); } } m_instanceCount++; @@ -46,9 +46,9 @@ CalendarManager::~CalendarManager() DPL::Mutex::ScopedLock mx(&m_constructorMutex); m_instanceCount--; if (m_instanceCount == 0) { - LogDebug("Disconnect calendar DB."); + LoggerD("Disconnect calendar DB."); if (CALENDAR_ERROR_NONE != calendar_disconnect()) { - LogError("Calendar DB disconnect failed."); + LoggerE("Calendar DB disconnect failed."); } } } @@ -68,7 +68,7 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarsPtr &event) if(CALENDAR_ERROR_NONE!=ret){ ThrowMsg(PlatformException, "Getting calendar list count failed: "<getType()) || (CALENDAR_BOOK_TYPE_TODO==storeType && CalendarEvent::TASK_TYPE==event->getType()) ) { @@ -113,11 +113,11 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarsPtr &event) newCalendar->setType(event->getType()); event->addCalendar(newCalendar); } else { - LogDebug("Different calendar type."); + LoggerD("Different calendar type."); } free(name); } else { - LogError("Calendar contains invalid parameters"); + LoggerE("Calendar contains invalid parameters"); } calendar = NULL; @@ -132,7 +132,7 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarsPtr &event) } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -153,7 +153,7 @@ void CalendarManager::OnRequestReceived(const IEventGetDefaultCalendarPtr &event if(CALENDAR_ERROR_NONE!=ret){ ThrowMsg(PlatformException, "Getting calendar list count failed: "<getType()) || (CALENDAR_BOOK_TYPE_TODO==storeType && CalendarEvent::TASK_TYPE==event->getType()) ) { @@ -197,11 +197,11 @@ void CalendarManager::OnRequestReceived(const IEventGetDefaultCalendarPtr &event event->setCalendar(newCalendar); break; } else { - LogDebug("Different calendar type."); + LoggerD("Different calendar type."); } free(name); } else { - LogError("Calendar contains invalid parameters"); + LoggerE("Calendar contains invalid parameters"); } calendar = NULL; @@ -217,7 +217,7 @@ void CalendarManager::OnRequestReceived(const IEventGetDefaultCalendarPtr &event } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -231,7 +231,7 @@ void CalendarManager::OnRequestReceived(const IEventGetUnifiedCalendarPtr &event newCalendar->setType(event->getType()); newCalendar->setIsUnified(true); - LogDebug("Setting empty values, id: "<getId()<<", name: "<getName()<<", account id: "<getAccountId()<<", type: "<getType()); + LoggerD("Setting empty values, id: "<getId()<<", name: "<getName()<<", account id: "<getAccountId()<<", type: "<getType()); event->setCalendar(newCalendar); @@ -239,7 +239,7 @@ void CalendarManager::OnRequestReceived(const IEventGetUnifiedCalendarPtr &event } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -253,7 +253,7 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarPtr &event) int calendarId = -1; ss>>calendarId; - LogInfo("Given id: "<getId()<<", converted id: "<getId()<<", converted id: "<getType()) || (CALENDAR_BOOK_TYPE_TODO==storeType && CalendarEvent::TASK_TYPE==event->getType()) ) { @@ -314,11 +314,11 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarPtr &event) break; } } else { - LogDebug("Different calendar type."); + LoggerD("Different calendar type."); } free(name); } else { - LogError("Calendar contains invalid parameters"); + LoggerE("Calendar contains invalid parameters"); } calendar = NULL; @@ -334,7 +334,7 @@ void CalendarManager::OnRequestReceived(const IEventGetCalendarPtr &event) } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } diff --git a/src/Calendar/CalendarResponseDispatcher.cpp b/src/Calendar/CalendarResponseDispatcher.cpp old mode 100755 new mode 100644 index c991530..902632d --- a/src/Calendar/CalendarResponseDispatcher.cpp +++ b/src/Calendar/CalendarResponseDispatcher.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include "CalendarResponseDispatcher.h" -#include #include #include #include @@ -25,9 +23,8 @@ #include "JSCalendarEventId.h" #include "CalendarMultiCallback.h" #include "EventId.h" - #include "CalendarAsyncCallbackManager.h" - +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -60,7 +57,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventGetCalendarsPtr &e { JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } @@ -71,7 +68,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventGetCalendarsPtr &e if (event->getResult()) { CalendarConverter converter(cbm->getContext()); const std::vector &results = event->getCalendars(); - LogDebug("found calendars: " << results.size()); + LoggerD("found calendars: " << results.size()); JSValueRef result = converter.toJSValueRef(results); cbm->callOnSuccess(result); return; @@ -79,7 +76,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventGetCalendarsPtr &e } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); } JSValueRef errorObject = DeviceAPI::Common::JSTizenExceptionFactory::makeErrorObject( cbm->getContext(), DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); @@ -92,14 +89,14 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventAddEventsPtr &even Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } CalendarAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); CalendarConverter converter(cbm->getContext()); JSValueRef result; @@ -112,11 +109,11 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventAddEventsPtr &even cbm->callOnSuccess(result); return; } - LogDebug("result fail"); + LoggerD("result fail"); } Catch(ConversionException) { - LogError("cannot convert event"); + LoggerE("cannot convert event"); } JSValueRef errorObject = DeviceAPI::Common::JSTizenExceptionFactory::makeErrorObject( cbm->getContext(), DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); @@ -127,7 +124,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventUpdateEventsPtr &e { JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -146,7 +143,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventDeleteEventsPtr &e { JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -172,7 +169,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventFindEventsPtr &eve { JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } Try @@ -208,7 +205,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventFindEventsPtr &eve } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); JSValueRef errorObject = DeviceAPI::Common::JSTizenExceptionFactory::makeErrorObject( cbm->getContext(), DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); cbm->callOnError(errorObject); @@ -221,7 +218,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventExpandEventRecurre Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -249,7 +246,7 @@ void CalendarResponseDispatcher::OnAnswerReceived(const IEventExpandEventRecurre } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); JSValueRef errorObject = DeviceAPI::Common::JSTizenExceptionFactory::makeErrorObject( cbm->getContext(), DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); cbm->callOnError(errorObject); @@ -318,18 +315,18 @@ void CalendarResponseDispatcher::onAnswerReceived(const OnEventsChangedPtr& even //case OnEventsChanged::ON_CALENDAR_RESET: default: { - LogDebug("Invalid status!"); + LoggerD("Invalid status!"); break; } } } Catch(ConversionException) { - LogError("cannot convert change event"); + LoggerE("cannot convert change event"); } Catch(Exception) { - LogError("exception occurred while handling change noti callback!"); + LoggerE("exception occurred while handling change noti callback!"); } } diff --git a/src/Calendar/CalendarUtility.cpp b/src/Calendar/CalendarUtility.cpp old mode 100755 new mode 100644 index 5dd59a2..b1c4c70 --- a/src/Calendar/CalendarUtility.cpp +++ b/src/Calendar/CalendarUtility.cpp @@ -17,13 +17,11 @@ #include "CalendarUtility.h" - -#include - #include #include #include #include +#include namespace DeviceAPI { namespace Calendar { @@ -56,22 +54,22 @@ calendar_time_s CalendarUtility::LLIToCalTime(const char* tzid, const long long _tzid = (UChar*)calloc(strlen(tzid) + 1, sizeof(UChar)); if (_tzid == NULL) { - LogError("Failed to calloc"); + LoggerE("Failed to calloc"); return ct; } u_uastrcpy(_tzid, tzid); - LogDebug("tzid: "< +#include namespace DeviceAPI { namespace Calendar { diff --git a/src/Calendar/EventAttendee.cpp b/src/Calendar/EventAttendee.cpp index f907525..bd9898e 100755 --- a/src/Calendar/EventAttendee.cpp +++ b/src/Calendar/EventAttendee.cpp @@ -15,9 +15,8 @@ // limitations under the License. // - #include "EventAttendee.h" -#include +#include namespace DeviceAPI { namespace Calendar { diff --git a/src/Calendar/EventRecurrenceRule.cpp b/src/Calendar/EventRecurrenceRule.cpp old mode 100755 new mode 100644 index 4f7bf52..4bd8744 --- a/src/Calendar/EventRecurrenceRule.cpp +++ b/src/Calendar/EventRecurrenceRule.cpp @@ -18,7 +18,7 @@ #include "EventRecurrenceRule.h" #include -#include +#include namespace DeviceAPI { namespace Calendar { @@ -45,15 +45,15 @@ EventRecurrenceRule::EventRecurrenceRule() EventRecurrenceRule::~EventRecurrenceRule() { if(m_daysOfTheWeekJSRef) { - LogDebug("Unprotect JS daysOfTheWeek."); + LoggerD("Unprotect JS daysOfTheWeek."); JSValueUnprotect(m_context, m_daysOfTheWeekJSRef); } if(m_setPositionsJSRef) { - LogDebug("Unprotect JS setPositions."); + LoggerD("Unprotect JS setPositions."); JSValueUnprotect(m_context, m_setPositionsJSRef); } if(m_exceptionsJSRef) { - LogDebug("Unprotect JS exceptions."); + LoggerD("Unprotect JS exceptions."); JSValueUnprotect(m_context, m_exceptionsJSRef); } } diff --git a/src/Calendar/EventWrapper.cpp b/src/Calendar/EventWrapper.cpp old mode 100755 new mode 100644 index 2af7e10..02ad327 --- a/src/Calendar/EventWrapper.cpp +++ b/src/Calendar/EventWrapper.cpp @@ -15,15 +15,14 @@ // limitations under the License. // - #include #include #include -#include #include #include "EventWrapper.h" #include "Calendar.h" #include "CalendarUtility.h" +#include using namespace WrtDeviceApis::Commons; @@ -71,7 +70,7 @@ void EventWrapper::saveEvent() } int itemId = m_abstractEvent->getId(); - LogDebug("Before saving/update eventId: " << itemId); + LoggerD("Before saving/update eventId: " << itemId); //displayPlatformEvent(); @@ -82,19 +81,19 @@ void EventWrapper::saveEvent() ThrowMsg(PlatformException, "Can't insert new item: "<setId(itemId); - LogDebug("New calendar item inserted with id: "<getId(); long long int recurrenceId = m_abstractEvent->getRecurrenceId(); - LogDebug("itemId to delete: " << itemId << ", recurrenceId: " << recurrenceId << ", type: " << getType()); + LoggerD("itemId to delete: " << itemId << ", recurrenceId: " << recurrenceId << ", type: " << getType()); calendar_record_h item = NULL; const char *dataType; @@ -196,14 +195,14 @@ void EventWrapper::deleteEvent() if(ret!=CALENDAR_ERROR_NONE) { ThrowMsg(PlatformException, "Can't delete the instance: "<getId()<<", error code: "<getId()); + LoggerD("Item loaded with id: "<getId()); } } else { ret = calendar_record_create(dataType, &m_platformEvent); if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't create platform record: "<getCalendarId()); } if (CALENDAR_ERROR_NONE!=ret) { - LogWarning("Can't set calendarId."); + LoggerW("Can't set calendarId."); } } @@ -415,7 +414,7 @@ void EventWrapper::setDescriptionToPlatformEvent() ret = calendar_record_set_str(m_platformEvent, _calendar_event.description, m_abstractEvent->getDescription().c_str()); } if (CALENDAR_ERROR_NONE!=ret) { - LogWarning("Can't set item description."); + LoggerW("Can't set item description."); } } @@ -428,7 +427,7 @@ void EventWrapper::setSummaryToPlatformEvent() ret = calendar_record_set_str(m_platformEvent, _calendar_event.summary, m_abstractEvent->getSubject().c_str()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set item subject."); + LoggerW("Can't set item subject."); } } @@ -459,7 +458,7 @@ void EventWrapper::setStartTimeToPlatformEvent() if (CALENDAR_ERROR_NONE != ret) { ThrowMsg(PlatformException, "Can't set start time: "<getLocation().c_str()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set location."); + LoggerW("Can't set location."); } } void EventWrapper::setRecurrenceRuleToPlatformEvent() { if (CalendarEvent::TASK_TYPE==getType()) { - LogDebug("No need to set rrule for a task."); + LoggerD("No need to set rrule for a task."); return; } EventRecurrenceRulePtr rrule = m_abstractEvent->getRecurrenceRule(); if (NULL==rrule) { - LogWarning("No way! Rrule is not set!"); + LoggerW("No way! Rrule is not set!"); return; } else if(EventRecurrenceRule::NO_RECURRENCE==rrule->getFrequency()) { - LogDebug("No recurrence frequency."); + LoggerD("No recurrence frequency."); } else if(EventRecurrenceRule::UNDEFINED_RECURRENCE==rrule->getFrequency()) { - LogDebug("Undefined recurrence frequency."); + LoggerD("Undefined recurrence frequency."); } else { - LogDebug("frequency "<getFrequency()); + LoggerD("frequency "<getFrequency()); } // set frequency @@ -538,37 +537,37 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent() case EventRecurrenceRule::NO_RECURRENCE: case EventRecurrenceRule::UNDEFINED_RECURRENCE: if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_NONE)) { - LogWarning("Failed setting frequency."); + LoggerW("Failed setting frequency."); } break; case EventRecurrenceRule::DAILY_RECURRENCE: if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_DAILY)) { - LogWarning("Failed setting frequency."); + LoggerW("Failed setting frequency."); } break; case EventRecurrenceRule::WEEKLY_RECURRENCE: { if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_WEEKLY)) { - LogWarning("Failed setting frequency."); + LoggerW("Failed setting frequency."); } break; } case EventRecurrenceRule::MONTHLY_RECURRENCE: { if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_MONTHLY)) { - LogWarning("Failed setting frequency."); + LoggerW("Failed setting frequency."); } break; } case EventRecurrenceRule::YEARLY_RECURRENCE: { if(CALENDAR_ERROR_NONE!=calendar_record_set_int(m_platformEvent, _calendar_event.freq, CALENDAR_RECURRENCE_YEARLY)) { - LogWarning("Failed setting frequency."); + LoggerW("Failed setting frequency."); } break; } default: - LogWarning("Invalid reccurence rule frequency "<getFrequency()); + LoggerW("Invalid reccurence rule frequency "<getFrequency()); break; } @@ -583,29 +582,29 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent() } } - LogDebug("byday: "<getOccurrenceCount()) { - LogDebug("Set the occurrence count: "<getOccurrenceCount()); + LoggerD("Set the occurrence count: "<getOccurrenceCount()); if (CALENDAR_ERROR_NONE != calendar_record_set_int(m_platformEvent, _calendar_event.range_type, CALENDAR_RANGE_COUNT)) { - LogWarning("Can't set rrule range type."); + LoggerW("Can't set rrule range type."); } if (CALENDAR_ERROR_NONE != calendar_record_set_int(m_platformEvent, _calendar_event.count, rrule->getOccurrenceCount())) { - LogWarning("Can't set occurrence count."); + LoggerW("Can't set occurrence count."); } } // set the exceptions if ( !rrule->getExceptions()->empty() ) { - LogDebug("Set the exceptions of length: "<getExceptions()->size()); + LoggerD("Set the exceptions of length: "<getExceptions()->size()); std::string exdate = ""; for( unsigned int i=0; igetExceptions()->size(); i++ ) @@ -617,16 +616,16 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent() exdate.append(","); } } - LogDebug("exdate: "<getSetPositions()->empty() ) { - LogDebug("Set the setPositions of length: "<getSetPositions()->size()); + LoggerD("Set the setPositions of length: "<getSetPositions()->size()); std::string bysetpos = ""; for( unsigned int i=0; igetSetPositions()->size(); i++ ) @@ -638,9 +637,9 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent() bysetpos.append(","); } } - LogDebug("bysetpos: "<getInterval())) { - LogWarning("Can't set interval."); + LoggerW("Can't set interval."); } // set the recurrence end date. This is automatically calculated by platform if empty. if (UNDEFINED_TIME!=rrule->getEndDate()) { - LogDebug("Setting the end date: "<getEndDate()); + LoggerD("Setting the end date: "<getEndDate()); if (CALENDAR_ERROR_NONE != calendar_record_set_int(m_platformEvent, _calendar_event.range_type, CALENDAR_RANGE_UNTIL)) { - LogWarning("Can't set rrule range type."); + LoggerW("Can't set rrule range type."); } int ret; @@ -666,7 +665,7 @@ void EventWrapper::setRecurrenceRuleToPlatformEvent() cal.time.utime = m_abstractEvent->getRecurrenceRule()->getEndDate(); ret = calendar_record_set_caltime(m_platformEvent, _calendar_event.until_time, cal); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set rrule until time: "<getAlarms()->size() ) { for( i=0; igetAlarms()->size(); i++ ) { - LogDebug("Set the alarms #"<getDuration().length; } else { - LogWarning("Wrong alarm time unit: "<getDuration().unit); + LoggerW("Wrong alarm time unit: "<getDuration().unit); } } if( CALENDAR_ALARM_TIME_UNIT_SPECIFIC==tickUnit ) { long long int time = theAlarm->getAbsoluteDate(); - LogDebug("Save absolute date: "<getMethod()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set alarm type: "<getDescription().c_str()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set alarm description: "<getRecurrenceId(); ret = calendar_record_set_str(m_platformEvent, _calendar_event.recurrence_id, ss.str().c_str()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set recurrence id."); + LoggerW("Can't set recurrence id."); } else { - LogDebug("Set the recurrence id: "<getParentId()) { ret = calendar_record_set_int(m_platformEvent, _calendar_event.original_event_id, m_abstractEvent->getParentId()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set parent Id."); + LoggerW("Can't set parent Id."); } else { - LogDebug("Set the parent id: "<getParentId()); + LoggerD("Set the parent id: "<getParentId()); } } else { - LogDebug("Parent id not defined."); + LoggerD("Parent id not defined."); } } void EventWrapper::setIsAllDayToPlatformEvent() { - LogDebug("All day flag is set in the start time struct: "<getIsAllDay()); + LoggerD("All day flag is set in the start time struct: "<getIsAllDay()); } void EventWrapper::setOrganizerToPlatformEvent() @@ -936,7 +935,7 @@ void EventWrapper::setOrganizerToPlatformEvent() ret = calendar_record_set_str(m_platformEvent, _calendar_event.organizer_name, m_abstractEvent->getOrganizer().c_str()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set item organizer."); + LoggerW("Can't set item organizer."); } } @@ -956,7 +955,7 @@ void EventWrapper::setVisibilityToPlatformEvent() visibility = CALENDAR_SENSITIVITY_CONFIDENTIAL; break; default: - LogDebug("Use the default visibility"); + LoggerD("Use the default visibility"); break; } @@ -966,14 +965,14 @@ void EventWrapper::setVisibilityToPlatformEvent() ret = calendar_record_set_int(m_platformEvent, _calendar_event.sensitivity, visibility); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set visibility."); + LoggerW("Can't set visibility."); } } void EventWrapper::setAvailabilityToPlatformEvent() { if(CalendarEvent::TASK_TYPE==getType()) { - LogDebug("No need to set availability for a task."); + LoggerD("No need to set availability for a task."); return; } @@ -992,13 +991,13 @@ void EventWrapper::setAvailabilityToPlatformEvent() availability = CALENDAR_EVENT_BUSY_STATUS_TENTATIVE; break; default: - LogDebug("Use the default availability"); + LoggerD("Use the default availability"); break; } int ret = calendar_record_set_int(m_platformEvent, _calendar_event.busy_status, availability); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set availability."); + LoggerW("Can't set availability."); } } @@ -1011,7 +1010,7 @@ void EventWrapper::setUIdToPlatformEvent() ret = calendar_record_set_str(m_platformEvent, _calendar_event.uid, m_abstractEvent->getUId().c_str()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set item uid."); + LoggerW("Can't set item uid."); } } @@ -1027,13 +1026,13 @@ void EventWrapper::setAttendeesToPlatformEvent() ret = calendar_record_get_child_record_count(m_platformEvent, _calendar_event.calendar_attendee, &count); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get attendees count: "<size() ) { for (i = 0; i < attendeeList->size(); ++i) { - LogDebug("Adding attendee "<size()); + LoggerD("Adding attendee "<size()); attendee = NULL; ret = calendar_record_create(_calendar_attendee._uri, &attendee); if(CALENDAR_ERROR_NONE!=ret) { - LogWarning("Attendee creation failed: "<getName().c_str()); if (CALENDAR_ERROR_NONE!=ret) { - LogWarning("Cannot set attendee name: "<getURI().c_str()); if (CALENDAR_ERROR_NONE!=ret) { - LogWarning("Cannot set attendee URI: "<getRSVP()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot set attendee RSVP: "<getType()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot set attendee type: "<getGroup().c_str()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot set attendee group: "<getDelegatorURI().c_str()); if (CALENDAR_ERROR_NONE != ret ) { - LogWarning("Cannot set attendee delegator uri "<getDelegateURI().c_str()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot set attendee delegate uri: "<getContactId().c_str()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot set attendee uid: "<at(i)->getAddressBookId()); int addressBookId; ss>>addressBookId; - LogDebug("addressBookId: "<getGeolocation()->getLatitude()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set latitude: "<getCreatedDate()); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set createde time: "<getCompletedDate()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning( "Can't set createde time: "<getProgress()); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't set progress: "<setCalendarId(calendarId); @@ -1381,7 +1380,7 @@ void EventWrapper::setDescriptionFromPlatformEvent() ret = calendar_record_get_str(m_platformEvent, _calendar_event.description, &description); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get description: "<setTimeZone(std::string(timeZone)); } @@ -1436,7 +1435,7 @@ void EventWrapper::setStartTimeFromPlatformEvent() ret = calendar_record_get_caltime(m_platformEvent, _calendar_event.start_time, &cal); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get start time: "<setFrequency(EventRecurrenceRule::NO_RECURRENCE); @@ -1531,7 +1530,7 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent() rrule->setFrequency(EventRecurrenceRule::YEARLY_RECURRENCE); break; default: - LogWarning("Unknown recurrence frequency."); + LoggerW("Unknown recurrence frequency."); rrule->setFrequency(EventRecurrenceRule::NO_RECURRENCE); return; break; @@ -1542,9 +1541,9 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent() char* byday = NULL; ret = calendar_record_get_str(m_platformEvent, _calendar_event.byday, &byday); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get byday: "<setDaysOfTheWeek(daysOfTheWeek); - LogDebug("Number of daysOfTheWeek: "<getDaysOfTheWeek()->size()); + LoggerD("Number of daysOfTheWeek: "<getDaysOfTheWeek()->size()); // load the recurrence interval int interval; ret = calendar_record_get_int(m_platformEvent, _calendar_event.interval, &interval); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get interval: "<setInterval(interval); @@ -1569,7 +1568,7 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent() int occurrrenceCount; ret = calendar_record_get_int(m_platformEvent, _calendar_event.count, &occurrrenceCount); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get occurrrence count: "<setOccurrenceCount(occurrrenceCount); @@ -1577,7 +1576,7 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent() calendar_time_s cal = {CALENDAR_TIME_UTIME, {0}}; ret = calendar_record_get_caltime(m_platformEvent, _calendar_event.until_time, &cal); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get recurrence end date: "<0) { if(CALENDAR_RECORD_NO_UNTIL==cal.time.utime) { @@ -1588,16 +1587,16 @@ void EventWrapper::setRecurrenceRuleFromPlatformEvent() } else { rrule->setEndDate(UNDEFINED_TIME); } - LogDebug("endDate from platform = "<getEndDate()); + LoggerD("endDate from platform = "<getEndDate()); // load the exceptions NumberArrayPtr exceptions(new NumberArray()); char* exdate = NULL; ret = calendar_record_get_str(m_platformEvent, _calendar_event.exdate, &exdate); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get exdate: "<setExceptions(exceptions); - LogDebug("Number of exceptions: "<getExceptions()->size()); + LoggerD("Number of exceptions: "<getExceptions()->size()); // load the setPositions NumberArrayPtr setPositions(new NumberArray()); char* bysetpos = NULL; ret = calendar_record_get_str(m_platformEvent, _calendar_event.bysetpos, &bysetpos); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get bysetpos: "<setSetPositions(setPositions); - LogDebug("Number of setPositions: "<getSetPositions()->size()); + LoggerD("Number of setPositions: "<getSetPositions()->size()); // set the loaded recurrence rule m_abstractEvent->setRecurrenceRule(rrule); @@ -1652,14 +1651,14 @@ void EventWrapper::setAlarmsFromPlatformEvent() ret = calendar_record_get_child_record_count(m_platformEvent, _calendar_event.calendar_alarm, &count); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get alarms count: "<setAbsoluteDate(time); - LogDebug("Loaded absolute date: "<getAbsoluteDate()); + LoggerD("Loaded absolute date: "<getAbsoluteDate()); } else { ret = calendar_record_get_int(alarm, _calendar_alarm.tick, &tick); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read alarm tick. Stop processing alarms."); + LoggerW("Cannot read alarm tick. Stop processing alarms."); continue; } @@ -1730,7 +1729,7 @@ void EventWrapper::setAlarmsFromPlatformEvent() duration.unit = Time::DAYS_UNIT; duration.length = tick*30; } else { - LogWarning("Wrong tick unit: "<setDuration(duration); @@ -1739,7 +1738,7 @@ void EventWrapper::setAlarmsFromPlatformEvent() int type; ret = calendar_record_get_int(alarm, _calendar_alarm.type, &type); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read alarm type: "<setMethod((EventAlarm::EventAlarmType)type); @@ -1747,11 +1746,11 @@ void EventWrapper::setAlarmsFromPlatformEvent() char* description = NULL; ret = calendar_record_get_str(alarm, _calendar_alarm.description, &description); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read alarm description: "<setDescription(""); free(description); } else { - LogDebug("Alarm description: "<setDescription(description); } @@ -1764,7 +1763,7 @@ void EventWrapper::setAlarmsFromPlatformEvent() if(list) { calendar_list_destroy(list, true); } - LogDebug("Number of alarms: "<getAlarms()->size()); + LoggerD("Number of alarms: "<getAlarms()->size()); } void EventWrapper::setStatusFromPlatformEvent() @@ -1777,7 +1776,7 @@ void EventWrapper::setStatusFromPlatformEvent() ret = calendar_record_get_int(m_platformEvent, _calendar_event.event_status, &status); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get status: "<getCategories()->size()); + LoggerD("Number of categories: "<getCategories()->size()); } void EventWrapper::setIdFromPlatformEvent() @@ -1864,7 +1863,7 @@ void EventWrapper::setIdFromPlatformEvent() void EventWrapper::setRecurrenceIdFromPlatformEvent() { if(CalendarEvent::TASK_TYPE==getType()) { - LogDebug("No need to set the recurrence id for a task."); + LoggerD("No need to set the recurrence id for a task."); return; } @@ -1872,7 +1871,7 @@ void EventWrapper::setRecurrenceIdFromPlatformEvent() char* recurrenceId = NULL; ret = calendar_record_get_str(m_platformEvent, _calendar_event.recurrence_id, &recurrenceId); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get recurrence id: "<>rid; m_abstractEvent->setRecurrenceId(rid); - LogDebug("Set the recurrence id: "<setRecurrenceId(UNDEFINED_TIME); } @@ -1890,14 +1889,14 @@ void EventWrapper::setRecurrenceIdFromPlatformEvent() void EventWrapper::setParentIdFromPlatformEvent() { if(CalendarEvent::TASK_TYPE==getType()) { - LogDebug("No need to set the parent id for a task."); + LoggerD("No need to set the parent id for a task."); return; } int ret, parentId; ret = calendar_record_get_int(m_platformEvent, _calendar_event.original_event_id, &parentId); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get parent id: "<getIsAllDay()); + LoggerD("All day flag is set when getting the start time: "<getIsAllDay()); } void EventWrapper::setOrganizerFromPlatformEvent() @@ -1923,7 +1922,7 @@ void EventWrapper::setOrganizerFromPlatformEvent() ret = calendar_record_get_str(m_platformEvent, _calendar_event.organizer_name, &organizer); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get organizer: "<setName(""); } else { if(attendeeName) { @@ -2102,7 +2101,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() char* attendeeURI = NULL; ret = calendar_record_get_str(attendee, _calendar_attendee.email, &attendeeURI); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee URI. Setting an empty string."); + LoggerW("Cannot read attendee URI. Setting an empty string."); attendeePtr->setURI(""); } else { if(attendeeURI) { @@ -2115,7 +2114,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() int attendeeRole; ret = calendar_record_get_int(attendee, _calendar_attendee.role, &attendeeRole); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee role. Setting the default value."); + LoggerW("Cannot read attendee role. Setting the default value."); } switch (attendeeRole) { case CALENDAR_ATTENDEE_ROLE_REQ_PARTICIPANT: @@ -2139,7 +2138,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() int attendeeStatus; ret = calendar_record_get_int(attendee, _calendar_attendee.status, &attendeeStatus); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee status. Setting the default value."); + LoggerW("Cannot read attendee status. Setting the default value."); } switch (attendeeStatus) { case CALENDAR_ATTENDEE_STATUS_PENDING: @@ -2172,7 +2171,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() int attendeeRSVP; ret = calendar_record_get_int(attendee, _calendar_attendee.rsvp, &attendeeRSVP); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee RSVP. Setting the default value."); + LoggerW("Cannot read attendee RSVP. Setting the default value."); } attendeePtr->setRSVP(attendeeRSVP>0 ? true : false); @@ -2180,7 +2179,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() int attendeeType; ret = calendar_record_get_int(attendee, _calendar_attendee.type, &attendeeType); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee type. Setting the default value."); + LoggerW("Cannot read attendee type. Setting the default value."); } attendeePtr->setType((EventAttendee::EventAttendeeType)attendeeType); @@ -2188,7 +2187,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() char* attendeeGroup = NULL; ret = calendar_record_get_str(attendee, _calendar_attendee.group, &attendeeGroup); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee group. Setting an empty string."); + LoggerW("Cannot read attendee group. Setting an empty string."); attendeePtr->setGroup(""); } else { if(attendeeGroup) { @@ -2201,7 +2200,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() char* attendeeDelegatorURI = NULL; ret = calendar_record_get_str(attendee, _calendar_attendee.delegator_uri, &attendeeDelegatorURI); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee delegatorURI. Setting an empty string."); + LoggerW("Cannot read attendee delegatorURI. Setting an empty string."); attendeePtr->setDelegatorURI(""); } else { if(attendeeDelegatorURI) { @@ -2214,7 +2213,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() char* attendeeDelegateURI = NULL; ret = calendar_record_get_str(attendee, _calendar_attendee.delegate_uri, &attendeeDelegateURI); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee delegateURI. Setting an empty string."); + LoggerW("Cannot read attendee delegateURI. Setting an empty string."); attendeePtr->setDelegateURI(""); } else { if(attendeeDelegateURI) { @@ -2227,7 +2226,7 @@ void EventWrapper::setAttendeesFromPlatformEvent() char* attendeeContactId = NULL; ret = calendar_record_get_str(attendee, _calendar_attendee.uid, &attendeeContactId); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Cannot read attendee UId. Setting an empty string."); + LoggerW("Cannot read attendee UId. Setting an empty string."); attendeePtr->setContactId(""); } else { if(attendeeContactId) { @@ -2239,9 +2238,9 @@ void EventWrapper::setAttendeesFromPlatformEvent() // load addressBookId int attendeeAddressBookId; ret = calendar_record_get_int(attendee, _calendar_attendee.person_id, &attendeeAddressBookId); - LogDebug("attendeeAddressBookId: "<getGeolocation()->setLatitude(value); @@ -2282,7 +2281,7 @@ void EventWrapper::setPositionFromPlatformEvent() ret = calendar_record_get_double(m_platformEvent, _calendar_event.longitude, &value); } if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get item longitude."); + LoggerW("Can't get item longitude."); return; } m_abstractEvent->getGeolocation()->setLongitude(value); @@ -2296,7 +2295,7 @@ void EventWrapper::setPriorityFromPlatformEvent() if(CalendarEvent::TASK_TYPE==getType()) { ret = calendar_record_get_int(m_platformEvent, _calendar_todo.priority, &priority); if (CALENDAR_ERROR_NONE != ret) { - LogWarning("Can't get task priority: "<0) { m_abstractEvent->setIsDetached(true); - LogDebug("This is a detached event."); + LoggerD("This is a detached event."); } else { m_abstractEvent->setIsDetached(false); } @@ -2423,7 +2422,7 @@ void EventWrapper::displayAbstractEvent() void EventWrapper::displayPlatformEvent() { - LogDebug("Displaying platform itemt disabled."); + LoggerD("Displaying platform itemt disabled."); } CalendarEvent::CalendarType EventWrapper::getType() diff --git a/src/Calendar/ICalendar.cpp b/src/Calendar/ICalendar.cpp index f58c596..51126fd 100755 --- a/src/Calendar/ICalendar.cpp +++ b/src/Calendar/ICalendar.cpp @@ -18,6 +18,7 @@ #include "ICalendar.h" #include +#include namespace DeviceAPI { namespace Calendar { diff --git a/src/Calendar/ICalendar.h b/src/Calendar/ICalendar.h index 42e5a39..7ac6a93 100755 --- a/src/Calendar/ICalendar.h +++ b/src/Calendar/ICalendar.h @@ -21,7 +21,6 @@ #include #include -#include #include #include "CalendarEvent.h" #include "IEventAddEvent.h" diff --git a/src/Calendar/JSCalendar.cpp b/src/Calendar/JSCalendar.cpp old mode 100755 new mode 100644 index 61646cb..35e7651 --- a/src/Calendar/JSCalendar.cpp +++ b/src/Calendar/JSCalendar.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include "ICalendar.h" #include "EventId.h" #include "CalendarFactory.h" @@ -47,7 +45,7 @@ #include "CalendarAsyncCallbackManager.h" #include "CalendarListenerManager.h" - +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -105,14 +103,14 @@ JSClassRef JSCalendar::m_jsClassRef = JSClassCreate(JSCalendar::getClassInfo()); void JSCalendar::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar private object."); + LoggerD("Create calendar private object."); ICalendarPtr calendar = CalendarFactory::getInstance().createCalendarObject(); CalendarPrivObject *priv = new CalendarPrivObject(context, calendar); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -189,7 +187,7 @@ JSValueRef JSCalendar::add(JSContextRef context, calendar->addEvent(dplEvent); if (dplEvent->getResult()) { - LogDebug("Add result successful."); + LoggerD("Add result successful."); TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } else { @@ -198,22 +196,22 @@ JSValueRef JSCalendar::add(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -267,7 +265,7 @@ JSValueRef JSCalendar::addBatch(JSContextRef context, cbm->setObject(thisObject); - LogDebug("Proceed the event to the platform."); + LoggerD("Proceed the event to the platform."); IEventAddEventsPtr dplEvent(new IEventAddEvents()); dplEvent->setCalendarType(calendar->getType()); @@ -283,22 +281,22 @@ JSValueRef JSCalendar::addBatch(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -366,27 +364,27 @@ JSValueRef JSCalendar::update(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -448,7 +446,7 @@ JSValueRef JSCalendar::updateBatch(JSContextRef context, cbm->setObject(thisObject); - LogDebug("Proceed the event to the platform."); + LoggerD("Proceed the event to the platform."); IEventUpdateEventsPtr dplEvent(new IEventUpdateEvents()); dplEvent->setEvents(items); @@ -464,27 +462,27 @@ JSValueRef JSCalendar::updateBatch(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -545,7 +543,7 @@ JSValueRef JSCalendar::remove(JSContextRef context, calendar->deleteEvent(dplEvent); if (dplEvent->getResult()) { - LogInfo("Successfully deleted."); + LoggerI("Successfully deleted."); TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } else { @@ -558,27 +556,27 @@ JSValueRef JSCalendar::remove(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -632,7 +630,7 @@ JSValueRef JSCalendar::removeBatch(JSContextRef context, if (!itemIds) { ThrowMsg(ConversionException, "Parameter conversion failed."); } else { - LogDebug("Array length: "<size()); + LoggerD("Array length: "<size()); } } else if (JSValueIsString(context, element)) { std::vector idStrings = converter.toVectorOfStrings(arguments[0]); @@ -660,7 +658,7 @@ JSValueRef JSCalendar::removeBatch(JSContextRef context, cbm->setObject(thisObject); - LogDebug("Proceed the event to the platform."); + LoggerD("Proceed the event to the platform."); IEventDeleteEventsPtr dplEvent(new IEventDeleteEvents()); dplEvent->setEventIds(itemIds); @@ -674,27 +672,27 @@ JSValueRef JSCalendar::removeBatch(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -745,7 +743,7 @@ JSValueRef JSCalendar::find(JSContextRef context, cbm->setObject(thisObject); - LogDebug("Proceed the find event to the platform."); + LoggerD("Proceed the find event to the platform."); IEventFindEventsPtr dplEvent(new IEventFindEvents()); dplEvent->setCalendarType(calendar->getType()); @@ -756,7 +754,7 @@ JSValueRef JSCalendar::find(JSContextRef context, if (JSValueIsObject(context, arguments[2])) { dplEvent->setGenericFilter(filterConverter->toFilter(arguments[2])); } else if (JSValueIsNull(context, arguments[2]) || JSValueIsUndefined(context, arguments[2])) { - LogDebug("Use default filter."); + LoggerD("Use default filter."); } else { ThrowMsg(ConversionException, "Wrong third parameter type."); } @@ -768,7 +766,7 @@ JSValueRef JSCalendar::find(JSContextRef context, sortModes->push_back(filterConverter->toSortMode(arguments[3])); dplEvent->setSortModes(sortModes); } else if (JSValueIsNull(context, arguments[3]) || JSValueIsUndefined(context, arguments[3])) { - LogDebug("Use default sort mode."); + LoggerD("Use default sort mode."); } else { ThrowMsg(ConversionException, "Wrong fourth parameter type."); } @@ -782,27 +780,27 @@ JSValueRef JSCalendar::find(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -865,7 +863,7 @@ JSValueRef JSCalendar::get(JSContextRef context, // Process the found item. if (dplEvent->getResult()) { - LogDebug("Successfully got an item."); + LoggerD("Successfully got an item."); if (CalendarEvent::EVENT_TYPE==calendar->getType()) { TIME_TRACER_ITEM_END(__FUNCTION__, 0); // Use global context for the expandRecurrence api in event. @@ -885,27 +883,27 @@ JSValueRef JSCalendar::get(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -977,7 +975,7 @@ JSValueRef JSCalendar::addChangeListener(JSContextRef context, JSCallbackManagerPtr onUpdatedCbm = JSCallbackManager::createObject(globalContext, result.onUpdated, NULL); JSCallbackManagerPtr onDeletedCbm = JSCallbackManager::createObject(globalContext, result.onDeleted, NULL); - LogDebug("Make change emitter and process sync operation."); + LoggerD("Make change emitter and process sync operation."); CalendarChangeCallbackPrivateDataPtr privData(new CalendarChangeCallbackPrivateData( onAddedCbm, onUpdatedCbm, onDeletedCbm)); @@ -998,7 +996,7 @@ JSValueRef JSCalendar::addChangeListener(JSContextRef context, DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast(canceller); CalendarListenerManagerSingleton::Instance().registerListener(listenerItem, globalContext); - LogDebug("Returning the watchId "<setWatchId(watchId); @@ -1076,27 +1074,27 @@ JSValueRef JSCalendar::removeChangeListener(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -1118,7 +1116,7 @@ JSValueRef JSCalendar::getPropertyName(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1140,7 +1138,7 @@ JSValueRef JSCalendar::getPropertyAccountServiceId(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1162,7 +1160,7 @@ JSValueRef JSCalendar::getPropertyId(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Calendar/JSCalendarAlarm.cpp b/src/Calendar/JSCalendarAlarm.cpp old mode 100755 new mode 100644 index fed108b..2de315a --- a/src/Calendar/JSCalendarAlarm.cpp +++ b/src/Calendar/JSCalendarAlarm.cpp @@ -18,13 +18,13 @@ #include "JSCalendarAlarm.h" #include "CalendarConverter.h" -#include #include #include #include #include #include #include +#include using namespace WrtDeviceApis::Commons; @@ -116,7 +116,7 @@ void JSCalendarAlarm::setPrivateObject(const EventAlarmPtr &alarm, } Catch(Exception) { - LogError("Error during replacing alarm object."); + LoggerE("Error during replacing alarm object."); } } @@ -138,7 +138,7 @@ JSObjectRef JSCalendarAlarm::constructor(JSContextRef context, EventAlarmPtr alarm( new EventAlarm() ); if (JSValueIsObjectOfClass(context, arguments[0], JSTZDate::getClassRef())){ - LogDebug("absoluteDate case"); + LoggerD("absoluteDate case"); long long int absoluteDate = (long long int) (timeConverter.getTimeInMilliseconds(arguments[0])/1000); alarm->setAbsoluteDate(absoluteDate); alarm->setTimeZone(timeConverter.getPropertiesInTZDate(arguments[0]).timezone); @@ -150,7 +150,7 @@ JSObjectRef JSCalendarAlarm::constructor(JSContextRef context, alarm->setDescription(converter.toString(arguments[2])); } } else if (JSValueIsObjectOfClass(context, arguments[0], JSTimeDuration::getClassRef())){ - LogDebug("before case"); + LoggerD("before case"); alarm->setDuration(timeConverter.getDurationPropertis(arguments[0])); if (argumentCount>=2) { @@ -167,22 +167,22 @@ JSObjectRef JSCalendarAlarm::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -193,14 +193,14 @@ void JSCalendarAlarm::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar alarm private object."); + LoggerD("Create calendar alarm private object."); EventAlarmPtr alarm( new EventAlarm() ); EventAlarmPrivateObject *priv = new EventAlarmPrivateObject(context, alarm); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -244,13 +244,13 @@ JSValueRef JSCalendarAlarm::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALENDAR_ALARM_DESCRIPTION)) { return converter.toJSValueRef(alarm->getDescription()); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_CALENDAR_ALARM_METHOD)) { - LogDebug("Alarm method: "<getMethod())); + LoggerD("Alarm method: "<getMethod())); return converter.toJSValueRef(converter.toTizenValue(alarm->getMethod())); } } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -301,7 +301,7 @@ bool JSCalendarAlarm::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/Calendar/JSCalendarAttendee.cpp b/src/Calendar/JSCalendarAttendee.cpp old mode 100755 new mode 100644 index 397ba7b..ea28280 --- a/src/Calendar/JSCalendarAttendee.cpp +++ b/src/Calendar/JSCalendarAttendee.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include "JSCalendarAttendee.h" -#include #include #include #include @@ -27,7 +25,7 @@ #include #include #include - +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -97,14 +95,14 @@ void JSCalendarAttendee::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar attendee private object."); + LoggerD("Create calendar attendee private object."); EventAttendeePtr attendee( new EventAttendee() ); AttendeePrivateObject *priv = new AttendeePrivateObject(context, attendee); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -147,7 +145,7 @@ void JSCalendarAttendee::setPrivateObject(const EventAttendeePtr &attendee, } Catch(Exception) { - LogError("Error during replacing attendee object"); + LoggerE("Error during replacing attendee object"); } } @@ -190,22 +188,22 @@ JSObjectRef JSCalendarAttendee::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -255,7 +253,7 @@ JSValueRef JSCalendarAttendee::getProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -325,7 +323,7 @@ bool JSCalendarAttendee::setProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/Calendar/JSCalendarEvent.cpp b/src/Calendar/JSCalendarEvent.cpp old mode 100755 new mode 100644 index 58ce6c0..e62b073 --- a/src/Calendar/JSCalendarEvent.cpp +++ b/src/Calendar/JSCalendarEvent.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include -#include #include #include #include @@ -37,10 +35,10 @@ #include #include #include - #include "CalendarAsyncCallbackManager.h" #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -92,19 +90,19 @@ void JSCalendarEvent::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar event private object."); + LoggerD("Create calendar event private object."); CalendarEventPtr event( new CalendarEvent() ); CalendarEventPrivObject *priv = new CalendarEventPrivObject(context, event); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } if (m_calendar) { m_calendar->setType(CalendarEvent::EVENT_TYPE); - LogDebug("Calendar object type is set to event."); + LoggerD("Calendar object type is set to event."); } } @@ -134,7 +132,7 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context, CalendarEventPtr result(new CalendarEvent()); event = result; } else if (argumentCount==1) { - LogInfo("eventInitDict case"); + LoggerI("eventInitDict case"); if (JSValueIsUndefined(context, arguments[0]) || JSValueIsNull(context, arguments[0])) { CalendarEventPtr result(new CalendarEvent()); event = result; @@ -147,7 +145,7 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context, ThrowMsg(ConversionException, "Parameter conversion failed."); } } else if (argumentCount>=2) { - LogInfo("event stringRepresentation case"); + LoggerI("event stringRepresentation case"); std::string eventStr; CalendarEvent::VObjectFormat format = CalendarEvent::UNDEFINED_FORMAT; eventStr = converter.toString(arguments[0]); @@ -161,7 +159,7 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context, // Process the returned object. if (dplEvent->getResult()) { - LogInfo("Successfully created an event."); + LoggerI("Successfully created an event."); event = dplEvent->getEvent(); } else { if (dplEvent->getExceptionCode()==ExceptionCodes::InvalidArgumentException) { @@ -176,22 +174,22 @@ JSObjectRef JSCalendarEvent::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -247,7 +245,7 @@ void JSCalendarEvent::setPrivateObject(const CalendarEventPtr &event, } Catch(Exception) { - LogError("Error during replacing event object"); + LoggerE("Error during replacing event object"); } } @@ -286,7 +284,7 @@ JSValueRef JSCalendarEvent::expandRecurrence(JSContextRef context, if (argumentCount>=1) { if (JSValueIsObjectOfClass(context, arguments[0], JSTZDate::getClassRef())) { startDate = (long long int) (timeConverter.getTimeInMilliseconds(arguments[0])/1000); - LogInfo("startDate: "<=2) { if (JSValueIsObjectOfClass(context, arguments[1], JSTZDate::getClassRef())) { endDate = (long long int) (timeConverter.getTimeInMilliseconds(arguments[1])/1000); - LogInfo("endDate: "<setObject(thisObject); - LogDebug("Proceed the expand event to the platform."); + LoggerD("Proceed the expand event to the platform."); IEventExpandEventRecurrencePtr dplEvent(new IEventExpandEventRecurrence()); dplEvent->setPrivateData(DPL::StaticPointerCast(cbm)); @@ -329,27 +327,27 @@ JSValueRef JSCalendarEvent::expandRecurrence(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -380,7 +378,7 @@ JSValueRef JSCalendarEvent::getPropertyId(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -402,7 +400,7 @@ JSValueRef JSCalendarEvent::getPropertyIsDetached(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -419,7 +417,7 @@ JSValueRef JSCalendarEvent::getPropertyRecurrenceRule(JSContextRef context, CalendarEventPtr event = getPrivateObject(object); EventRecurrenceRulePtr rrule; if (event->getIsDetached()) { - LogDebug("This is a detached event."); + LoggerD("This is a detached event."); return JSValueMakeUndefined(context); } else { rrule = event->getRecurrenceRule(); @@ -435,7 +433,7 @@ JSValueRef JSCalendarEvent::getPropertyRecurrenceRule(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -451,7 +449,7 @@ bool JSCalendarEvent::setPropertyRecurrenceRule(JSContextRef context, { event = getPrivateObject(object); if (event->getIsDetached()) { - LogWarning("Can't set the recurrenceRule of a detached event!"); + LoggerW("Can't set the recurrenceRule of a detached event!"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::NOT_SUPPORTED_ERROR); } @@ -468,7 +466,7 @@ bool JSCalendarEvent::setPropertyRecurrenceRule(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/Calendar/JSCalendarEventId.cpp b/src/Calendar/JSCalendarEventId.cpp old mode 100755 new mode 100644 index 662aa89..4544038 --- a/src/Calendar/JSCalendarEventId.cpp +++ b/src/Calendar/JSCalendarEventId.cpp @@ -15,16 +15,15 @@ // limitations under the License. // - #include "JSCalendarEventId.h" #include "CalendarConverter.h" -#include #include #include #include #include #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -105,7 +104,7 @@ void JSCalendarEventId::setPrivateObject(const EventIdPtr &eventId, } Catch(Exception) { - LogError("Error during replacing event id object."); + LoggerE("Error during replacing event id object."); } } @@ -119,14 +118,14 @@ void JSCalendarEventId::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar event id private object."); + LoggerD("Create calendar event id private object."); EventIdPtr eventId( new EventId() ); EventIdPrivateObject *priv = new EventIdPrivateObject(context, eventId); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -168,22 +167,22 @@ JSObjectRef JSCalendarEventId::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -224,7 +223,7 @@ JSValueRef JSCalendarEventId::getProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -256,7 +255,7 @@ bool JSCalendarEventId::setProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/Calendar/JSCalendarItemProperties.cpp b/src/Calendar/JSCalendarItemProperties.cpp old mode 100755 new mode 100644 index 0c49bb2..7f2cca0 --- a/src/Calendar/JSCalendarItemProperties.cpp +++ b/src/Calendar/JSCalendarItemProperties.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include -#include #include #include #include @@ -40,9 +38,9 @@ #include "JSCalendarEvent.h" #include "JSCalendarTask.h" #include "plugin_config.h" - #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -114,14 +112,14 @@ void JSCalendarItemProperties::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar item private object."); + LoggerD("Create calendar item private object."); CalendarEventPtr item( new CalendarEvent() ); CalendarItemPropertiesPrivObject *priv = new CalendarItemPropertiesPrivObject(context, item); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -177,7 +175,7 @@ void JSCalendarItemProperties::setPrivateObject(const CalendarEventPtr &event, } Catch(Exception) { - LogError("Error during replacing event object"); + LoggerE("Error during replacing event object"); } } @@ -240,27 +238,27 @@ JSValueRef JSCalendarItemProperties::convertToString(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -313,27 +311,27 @@ JSValueRef JSCalendarItemProperties::clone(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -351,7 +349,7 @@ JSValueRef JSCalendarItemProperties::getPropertyDescription(JSContextRef context } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -372,7 +370,7 @@ bool JSCalendarItemProperties::setPropertyDescription(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -391,7 +389,7 @@ JSValueRef JSCalendarItemProperties::getPropertySummary(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -412,7 +410,7 @@ bool JSCalendarItemProperties::setPropertySummary(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -430,7 +428,7 @@ JSValueRef JSCalendarItemProperties::getPropertyStartTime(JSContextRef context, TimeUtilConverter timeConverter(context); CalendarEventPtr event = privateObject->getObject(); - LogInfo("start time before converted to TZDate: "<getStartTime()<<", time zone: "<getTimeZone()); + LoggerI("start time before converted to TZDate: "<getStartTime()<<", time zone: "<getTimeZone()); if (UNDEFINED_TIME==event->getStartTime()) { return JSValueMakeUndefined(context); } else { @@ -439,7 +437,7 @@ JSValueRef JSCalendarItemProperties::getPropertyStartTime(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -473,7 +471,7 @@ bool JSCalendarItemProperties::setPropertyStartTime(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -492,7 +490,7 @@ JSValueRef JSCalendarItemProperties::getPropertyLocation(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -513,7 +511,7 @@ bool JSCalendarItemProperties::setPropertyLocation(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -534,7 +532,7 @@ JSValueRef JSCalendarItemProperties::getPropertyCategories(JSContextRef context, if(item->getCategoriesJSRef()) { return item->getCategoriesJSRef(); } else { - LogDebug("Create a JS object for categories."); + LoggerD("Create a JS object for categories."); StringArrayPtr categories = item->getCategories(); JSValueRef jsCategories = converter.toJSValueRefStringArray(categories); item->setCategoriesJSRef(converter.toJSObjectRef(jsCategories)); @@ -546,7 +544,7 @@ JSValueRef JSCalendarItemProperties::getPropertyCategories(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -566,7 +564,7 @@ bool JSCalendarItemProperties::setPropertyCategories(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -586,7 +584,7 @@ JSValueRef JSCalendarItemProperties::getPropertyStatus(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -609,7 +607,7 @@ bool JSCalendarItemProperties::setPropertyStatus(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -637,7 +635,7 @@ JSValueRef JSCalendarItemProperties::getPropertyAlarms(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -661,7 +659,7 @@ bool JSCalendarItemProperties::setPropertyAlarms(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -680,7 +678,7 @@ JSValueRef JSCalendarItemProperties::getPropertyOrganizer(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -701,7 +699,7 @@ bool JSCalendarItemProperties::setPropertyOrganizer(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -721,7 +719,7 @@ JSValueRef JSCalendarItemProperties::getPropertyVisibility(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -744,7 +742,7 @@ bool JSCalendarItemProperties::setPropertyVisibility(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -766,7 +764,7 @@ JSValueRef JSCalendarItemProperties::getPropertyGeolocation(JSContextRef context } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -794,7 +792,7 @@ bool JSCalendarItemProperties::setPropertyGeolocation(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -810,18 +808,18 @@ JSValueRef JSCalendarItemProperties::getPropertyDuration(JSContextRef context, CalendarEventPtr item = getPrivateObject(object); if(UNDEFINED_TIME==item->getStartTime() || UNDEFINED_TIME==item->getEndTime()) { - LogDebug("Start or end time is not defined."); + LoggerD("Start or end time is not defined."); return JSValueMakeUndefined(context); } TimeUtilConverter converter(context); long long length = item->getEndTime() - item->getStartTime(); // in seconds only - LogDebug("item->getStartTime():"<< item->getStartTime() << ", length:" << length); + LoggerD("item->getStartTime():"<< item->getStartTime() << ", length:" << length); return converter.makeMillisecondDurationObject( length*1000 ); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -861,7 +859,7 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -880,7 +878,7 @@ JSValueRef JSCalendarItemProperties::getPropertyIsAllDay(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -900,7 +898,7 @@ bool JSCalendarItemProperties::setPropertyIsAllDay(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -920,7 +918,7 @@ JSValueRef JSCalendarItemProperties::getPropertyAvailability(JSContextRef contex } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -943,7 +941,7 @@ bool JSCalendarItemProperties::setPropertyAvailability(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -973,7 +971,7 @@ JSValueRef JSCalendarItemProperties::getPropertyAttendees(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -993,7 +991,7 @@ bool JSCalendarItemProperties::setPropertyAttendees(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1025,7 +1023,7 @@ JSValueRef JSCalendarItemProperties::getPropertyDueDate(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1062,7 +1060,7 @@ bool JSCalendarItemProperties::setPropertyDueDate(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1094,7 +1092,7 @@ JSValueRef JSCalendarItemProperties::getPropertyCompletedDate(JSContextRef conte } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1131,7 +1129,7 @@ bool JSCalendarItemProperties::setPropertyCompletedDate(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1154,7 +1152,7 @@ JSValueRef JSCalendarItemProperties::getPropertyProgress(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1179,7 +1177,7 @@ bool JSCalendarItemProperties::setPropertyProgress(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1203,7 +1201,7 @@ JSValueRef JSCalendarItemProperties::getPropertyPriority(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1225,7 +1223,7 @@ bool JSCalendarItemProperties::setPropertyPriority(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1257,7 +1255,7 @@ JSValueRef JSCalendarItemProperties::getPropertyEndDate(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1294,7 +1292,7 @@ bool JSCalendarItemProperties::setPropertyEndDate(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; @@ -1321,7 +1319,7 @@ JSValueRef JSCalendarItemProperties::getPropertyLastModificationDate(JSContextRe } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -1347,7 +1345,7 @@ JSValueRef JSCalendarItemProperties::getPropertyCalendarId(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Calendar/JSCalendarManager.cpp b/src/Calendar/JSCalendarManager.cpp old mode 100755 new mode 100644 index e99a712..29189ef --- a/src/Calendar/JSCalendarManager.cpp +++ b/src/Calendar/JSCalendarManager.cpp @@ -83,14 +83,14 @@ void JSCalendarManager::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar manager private object."); + LoggerD("Create calendar manager private object."); ICalendarManagerPtr calendarManager = CalendarFactory::getInstance().createCalendarManagerObject(); CalendarManagerPrivObject *privateObject = new CalendarManagerPrivObject(context, calendarManager); if (!JSObjectSetPrivate(object, static_cast(privateObject))) { delete privateObject; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -157,22 +157,22 @@ JSValueRef JSCalendarManager::getCalendars(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -217,7 +217,7 @@ JSValueRef JSCalendarManager::getDefaultCalendar(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return converter.toJSValueRefCalendar(dplEvent->getCalendar()); } else { - LogError("Default calendar not found."); + LoggerE("Default calendar not found."); } } else { ThrowMsg(UnknownException, "Getting a default calendar failed by unknown reason."); @@ -225,27 +225,27 @@ JSValueRef JSCalendarManager::getDefaultCalendar(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -290,10 +290,10 @@ JSValueRef JSCalendarManager::getUnifiedCalendar(JSContextRef context, if (dplEvent->getResult()) { if( dplEvent->getCalendar() ) { - LogDebug("Successfully got a unified calendar."); + LoggerD("Successfully got a unified calendar."); return converter.toJSValueRefCalendar(dplEvent->getCalendar()); } else { - LogError("Unified calendar not found."); + LoggerE("Unified calendar not found."); } } else { ThrowMsg(UnknownException, "Getting a unified calendar failed by unknown reason."); @@ -301,27 +301,27 @@ JSValueRef JSCalendarManager::getUnifiedCalendar(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -385,27 +385,27 @@ JSValueRef JSCalendarManager::getCalendar(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } diff --git a/src/Calendar/JSCalendarRecurrenceRule.cpp b/src/Calendar/JSCalendarRecurrenceRule.cpp old mode 100755 new mode 100644 index aaa4e73..a404985 --- a/src/Calendar/JSCalendarRecurrenceRule.cpp +++ b/src/Calendar/JSCalendarRecurrenceRule.cpp @@ -15,17 +15,15 @@ // limitations under the License. // - #include "JSCalendarRecurrenceRule.h" -#include #include #include #include #include "CalendarConverter.h" #include #include - #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -95,14 +93,14 @@ JSObjectRef JSCalendarRecurrenceRule::createJSCalendarRecurrenceRule(JSContextRe void JSCalendarRecurrenceRule::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar rrule private object."); + LoggerD("Create calendar rrule private object."); EventRecurrenceRulePtr rrule( new EventRecurrenceRule() ); RecurrenceRulePrivateObject *priv = new RecurrenceRulePrivateObject(context, rrule); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -145,7 +143,7 @@ void JSCalendarRecurrenceRule::setPrivateObject(const EventRecurrenceRulePtr &rr } Catch(Exception) { - LogError("Error during replacing rrule object."); + LoggerE("Error during replacing rrule object."); } } @@ -189,22 +187,22 @@ JSObjectRef JSCalendarRecurrenceRule::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -246,7 +244,7 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context, if(rrule->getDaysOfTheWeekJSRef()) { return rrule->getDaysOfTheWeekJSRef(); } else { - LogDebug("Create a JS object for daysOfTheWeek."); + LoggerD("Create a JS object for daysOfTheWeek."); StringArrayPtr daysOfTheWeek = rrule->getDaysOfTheWeek(); JSValueRef jsDaysOfTheWeek = converter.toJSValueRefStringArray(daysOfTheWeek); rrule->setDaysOfTheWeekJSRef(converter.toJSObjectRef(jsDaysOfTheWeek)); @@ -263,7 +261,7 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context, if(rrule->getSetPositionsJSRef()) { return rrule->getSetPositionsJSRef(); } else { - LogDebug("Create a JS object for setPositions."); + LoggerD("Create a JS object for setPositions."); NumberArrayPtr setPositions = rrule->getSetPositions(); JSValueRef jsSetPositions = converter.toJSValueRefNumberArray(setPositions); rrule->setSetPositionsJSRef(converter.toJSObjectRef(jsSetPositions)); @@ -276,7 +274,7 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context, if(rrule->getExceptionsJSRef()) { return rrule->getExceptionsJSRef(); } else { - LogDebug("Create a JS object for exceptions with time zone: "<getTimeZone()); + LoggerD("Create a JS object for exceptions with time zone: "<getTimeZone()); NumberArrayPtr exceptions = rrule->getExceptions(); JSValueRef jsExceptions = converter.toJSValueRefTZDateArray(exceptions, rrule->getTimeZone()); rrule->setExceptionsJSRef(converter.toJSObjectRef(jsExceptions)); @@ -289,7 +287,7 @@ JSValueRef JSCalendarRecurrenceRule::getProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -361,7 +359,7 @@ bool JSCalendarRecurrenceRule::setProperty(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/Calendar/JSCalendarTask.cpp b/src/Calendar/JSCalendarTask.cpp old mode 100755 new mode 100644 index eba4c9c..614dd01 --- a/src/Calendar/JSCalendarTask.cpp +++ b/src/Calendar/JSCalendarTask.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include -#include #include #include #include @@ -33,8 +31,8 @@ #include #include #include - #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -79,19 +77,19 @@ void JSCalendarTask::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create calendar task private object."); + LoggerD("Create calendar task private object."); CalendarEventPtr task( new CalendarEvent() ); CalendarTaskPrivObject *priv = new CalendarTaskPrivObject(context, task); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } if (m_calendar) { m_calendar->setType(CalendarEvent::TASK_TYPE); - LogDebug("Calendar object type is set to task."); + LoggerD("Calendar object type is set to task."); } } @@ -120,7 +118,7 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context, CalendarEventPtr result(new CalendarEvent()); task = result; } else if (argumentCount==1) { - LogInfo("taskInitDict case"); + LoggerI("taskInitDict case"); if (JSValueIsUndefined(context, arguments[0]) || JSValueIsNull(context, arguments[0])) { CalendarEventPtr result(new CalendarEvent()); task = result; @@ -133,7 +131,7 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context, ThrowMsg(ConversionException, "Parameter conversion failed."); } } else if (argumentCount>=2) { - LogInfo("task stringRepresentation case"); + LoggerI("task stringRepresentation case"); std::string eventStr; CalendarEvent::VObjectFormat format = CalendarEvent::UNDEFINED_FORMAT; eventStr = converter.toString(arguments[0]); @@ -147,7 +145,7 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context, // Process the returned object. if (dplEvent->getResult()) { - LogInfo("Successfully created a task."); + LoggerI("Successfully created a task."); task = dplEvent->getEvent(); } else { if (dplEvent->getExceptionCode()==ExceptionCodes::InvalidArgumentException) { @@ -163,22 +161,22 @@ JSObjectRef JSCalendarTask::constructor(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -234,7 +232,7 @@ void JSCalendarTask::setPrivateObject(const CalendarEventPtr &event, } Catch(Exception) { - LogError("Error during replacing task object"); + LoggerE("Error during replacing task object"); } } @@ -257,7 +255,7 @@ JSValueRef JSCalendarTask::getPropertyId(JSContextRef context, } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Calendar/plugin_initializer.cpp b/src/Calendar/plugin_initializer.cpp old mode 100755 new mode 100644 index a9005ca..7c177b8 --- a/src/Calendar/plugin_initializer.cpp +++ b/src/Calendar/plugin_initializer.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -34,6 +31,7 @@ #include #include +#include namespace DeviceAPI { namespace Calendar { @@ -43,36 +41,36 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Calendar] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Calendar] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch (Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Calendar] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Calendar] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Calendar"); TIME_TRACER_RELEASE(); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch (Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\Calendar] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\Calendar] on_frame_load_callback (" << context << ")"); DeviceAPI::Common::GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Calendar] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\Calendar] on_frame_unload_callback (" << context << ")"); CalendarAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); CalendarListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/Callhistory/CallHistory.cpp b/src/Callhistory/CallHistory.cpp old mode 100755 new mode 100644 index 90873f8..bf0dc72 --- a/src/Callhistory/CallHistory.cpp +++ b/src/Callhistory/CallHistory.cpp @@ -46,11 +46,11 @@ std::vector CallHistory::m_watchers; CallHistory::CallHistory() { - LogDebug("Enter "); + LoggerD("Enter "); if (contacts_connect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to connect Call history DB "); + LoggerD("Successful to connect Call history DB "); } else { - LogDebug("Failed to connect Call history DB "); + LoggerD("Failed to connect Call history DB "); } EventCallHistoryPtr event(new EventCallHistory()); @@ -61,12 +61,12 @@ CallHistory::CallHistory() CallHistory::~CallHistory() { - LogDebug("Enter "); + LoggerD("Enter "); if (contacts_disconnect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to disconnect Call history DB "); + LoggerD("Successful to disconnect Call history DB "); } else { - LogDebug("Failed to disconnect Call history DB "); + LoggerD("Failed to disconnect Call history DB "); } int ret = CONTACTS_ERROR_NONE; @@ -78,12 +78,12 @@ CallHistory::~CallHistory() 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 << "]"); + LoggerD("callhistory remove listener error [" << ret << "]"); } it = CallHistory::m_watchers.erase(it); } - LogDebug("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")"); + LoggerD("CallHistory Watcher is removed. (" << CallHistory::m_watchers.size() << ")"); } EventCallHistoryPtr event(new EventCallHistory()); @@ -102,7 +102,7 @@ void CallHistory::callhistoryListenerCB(const char* view_uri, char *changes, voi void CallHistory::removeBatchCB(int error, void *user_data) { - LogDebug("enter"); + LoggerD("enter"); if (user_data != NULL) { CallHistory* chManager = (CallHistory *)((EventCallHistoryPtrs *)user_data)->getThisPtr(); @@ -116,7 +116,7 @@ void CallHistory::removeBatchCB(int error, void *user_data) void CallHistory::removeAllCB(int error, void *user_data) { - LogDebug("enter"); + LoggerD("enter"); if (user_data != NULL) { CallHistory* chManager = (CallHistory *)((EventCallHistoryPtrs *)user_data)->getThisPtr(); @@ -288,15 +288,15 @@ void CallHistory::removeListener(const long id) for (;it < CallHistory::m_watchers.end();) { - LogDebug("removeListener : id ["<getHandle()<<"]"); + LoggerD("removeListener : id ["<getHandle()<<"]"); if (id == (*it)->getHandle()) { flag = true; 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 << "]"); + LoggerD("callhistory remove listener error [" << ret << "]"); } it = CallHistory::m_watchers.erase(it); @@ -327,7 +327,7 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP if (record == NULL) { ret = contacts_list_next(*recordList); if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) { - LogDebug("callhistory parse error [" << ret << "]"); + LoggerD("callhistory parse error [" << ret << "]"); return false; } else { continue; @@ -350,7 +350,7 @@ bool CallHistory::parseRecord(contacts_list_h *recordList, CallHistoryEntryListP ret = contacts_list_next(*recordList); if (ret != CONTACTS_ERROR_NONE && ret != CONTACTS_ERROR_NO_DATA) { - LogDebug("callhistory parse error [" << ret << "]"); + LoggerD("callhistory parse error [" << ret << "]"); return false; } } @@ -382,19 +382,19 @@ void CallHistory::OnRequestReceived(const EventCallHistoryPtr& event) try { if (event->getCmdType() == EventCallHistory::CONNECT) { if (contacts_connect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to connect Call history DB by sub thread"); + LoggerD("Successful to connect Call history DB by sub thread"); } else { - LogDebug("Failed to connect Call history DB by sub thread"); + LoggerD("Failed to connect Call history DB by sub thread"); } } else if (event->getCmdType() == EventCallHistory::DISCONNECT) { if (contacts_disconnect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to disconnect Call history DB by sub thread"); + LoggerD("Successful to disconnect Call history DB by sub thread"); } else { - LogDebug("Failed to disconnect Call history DB by sub thread"); + LoggerD("Failed to disconnect Call history DB by sub thread"); } } } catch (const Commons::PlatformException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -402,7 +402,7 @@ void CallHistory::OnRequestReceived(const EventCallHistoryPtr& event) void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event) { try { - LogDebug("enter"); + LoggerD("enter"); CallHistoryEntryListPtr callHistoryListPtr(new CallHistoryEntryList()); int ret = CONTACTS_ERROR_NONE; @@ -444,7 +444,7 @@ void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event) } if (ret != CONTACTS_ERROR_NONE) { - LogDebug("callhistory query error [" << ret << "]"); + LoggerD("callhistory query error [" << ret << "]"); } @@ -459,7 +459,7 @@ void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event) ret = contacts_db_get_records_with_query(query, offset, limit, &recordList); if (ret != CONTACTS_ERROR_NONE) { - LogDebug("callhistory query error [" << ret << "]"); + LoggerD("callhistory query error [" << ret << "]"); } if (parseRecord(&recordList, callHistoryListPtr)) { @@ -470,7 +470,7 @@ void CallHistory::OnRequestReceived(const EventFindCallHistoryPtr& event) contacts_query_destroy(query); contacts_filter_destroy(filter); } catch (const Commons::PlatformException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -500,13 +500,13 @@ void CallHistory::OnRequestReceived(const EventRemoveBatchPtr& event) m_removeBatchEvent.push_back(eventData); event->switchToManualAnswer(); } else { - LogDebug("callhistory remove Batch error [" << ret << "]"); + LoggerD("callhistory remove Batch error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } else { ret = contacts_db_delete_records(_contacts_phone_log._uri, list, entryIds.size()); if (ret != CONTACTS_ERROR_NONE) { - LogDebug("callhistory remove Batch error [" << ret << "]"); + LoggerD("callhistory remove Batch error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -516,7 +516,7 @@ void CallHistory::OnRequestReceived(const EventRemoveBatchPtr& event) } } catch (const Commons::PlatformException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } @@ -548,14 +548,14 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event) contacts_list_get_count(record_list, &total); list = new int[total]; - LogDebug("total [" << total << "]"); + LoggerD("total [" << total << "]"); for (unsigned int i = 0; i < total; i++) { ret = contacts_list_get_current_record_p(record_list, &record); if (record == NULL) { ret = contacts_list_next(record_list); if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){ - LogDebug("callhistory remove All error [" << ret << "]"); + LoggerD("callhistory remove All error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } continue; @@ -571,12 +571,12 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event) value = 0; ret = contacts_list_next(record_list); if ( !(ret==CONTACTS_ERROR_NONE || ret==CONTACTS_ERROR_NO_DATA) ){ - LogDebug("callhistory remove All error [" << ret << "]"); + LoggerD("callhistory remove All error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } - LogDebug("cnt [" << cnt << "]"); + LoggerD("cnt [" << cnt << "]"); if (cnt > 0) { EventRemoveAllDataPtr eventData( new EventCallHistoryPtrs(event, this)); @@ -589,13 +589,13 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event) m_removeAllEvent.push_back(eventData); event->switchToManualAnswer(); } else { - LogDebug("callhistory remove All error [" << ret << "]"); + LoggerD("callhistory remove All error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } else { ret = contacts_db_delete_records(_contacts_phone_log._uri, list, cnt); if (ret != CONTACTS_ERROR_NONE) { - LogDebug("callhistory remove All error [" << ret << "]"); + LoggerD("callhistory remove All error [" << ret << "]"); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } } @@ -604,7 +604,7 @@ void CallHistory::OnRequestReceived(const EventRemoveAllPtr& event) contacts_list_destroy(record_list, true); } catch (const Commons::PlatformException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } @@ -626,7 +626,7 @@ void CallHistory::callRemoveBatchEvent(int error, const EventRemoveBatchPtr &eve for (it = m_removeBatchEvent.begin(); it != m_removeBatchEvent.end(); ++it) { if ((*it)->getEventPtrs() == event) { m_removeBatchEvent.erase(it); - LogDebug("event is removed. (" << m_removeBatchEvent.size() << ")"); + LoggerD("event is removed. (" << m_removeBatchEvent.size() << ")"); break; } } @@ -644,7 +644,7 @@ void CallHistory::callRemoveAllEvent(int error, const EventRemoveAllPtr &event) for (it = m_removeAllEvent.begin(); it != m_removeAllEvent.end(); ++it) { if ((*it)->getEventPtrs() == event) { m_removeAllEvent.erase(it); - LogDebug("event is removed. (" << m_removeAllEvent.size() << ")"); + LoggerD("event is removed. (" << m_removeAllEvent.size() << ")"); break; } } @@ -657,18 +657,18 @@ CallHistory::Watcher::Watcher(long handle, const EventCallHistoryListenerEmitter { m_missedCallList = MissedCallListPtr(new MissedCallList()); if (contacts_connect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to connect Call history DB "); + LoggerD("Successful to connect Call history DB "); } else { - LogDebug("Failed to connect Call history DB "); + LoggerD("Failed to connect Call history DB "); } } CallHistory::Watcher::~Watcher() { if (contacts_disconnect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to disconnect Call history DB "); + LoggerD("Successful to disconnect Call history DB "); } else { - LogDebug("Failed to disconnect Call history DB "); + LoggerD("Failed to disconnect Call history DB "); } } @@ -677,7 +677,7 @@ void CallHistory::Watcher::stateHasChanged(CallHistoryEntryListPtr &entryList, E if (entryList == NULL) return; - LogDebug("enter"); + LoggerD("enter"); EventCallHistoryListenerPtr event(new EventCallHistoryListener()); event->setResultState(state); @@ -690,7 +690,7 @@ void CallHistory::Watcher::stateHasRemoved(StringArrayPtr &entryList, EventCallH if (entryList == NULL) return; - LogDebug("enter"); + LoggerD("enter"); EventCallHistoryListenerPtr event(new EventCallHistoryListener()); event->setResultState(state); @@ -718,7 +718,7 @@ bool CallHistory::Watcher::parseRemoveRecord(char* record, StringArrayPtr &remov void CallHistory::Watcher::ListenerCB(char* changes) { - LogDebug("enter"); + LoggerD("enter"); char seps[] = ",:"; char* tokenType = NULL; @@ -733,7 +733,7 @@ void CallHistory::Watcher::ListenerCB(char* changes) while( tokenType != NULL ) { tokenId = strtok( NULL, seps ); - LogDebug("[ %s / %s ]", tokenType , tokenId ); + LoggerD("[ %s / %s ]", tokenType , tokenId ); changeType = atoi((const char*)tokenType); changeId = atoi((const char*)tokenId); @@ -751,7 +751,7 @@ void CallHistory::Watcher::ListenerCB(char* changes) ret = contacts_query_set_sort(query, _contacts_phone_log.id, false); if (ret != CONTACTS_ERROR_NONE) { - LogDebug("callhistory query error [" << ret << "]"); + LoggerD("callhistory query error [" << ret << "]"); } ret = contacts_db_get_records_with_query(query, 0, 1, &recordList); @@ -759,7 +759,7 @@ void CallHistory::Watcher::ListenerCB(char* changes) contacts_list_destroy(recordList, true); contacts_query_destroy(query); contacts_filter_destroy(filter); - LogDebug("callhistory query error [" << ret << "]"); + LoggerD("callhistory query error [" << ret << "]"); return; } diff --git a/src/Callhistory/CallHistoryEntry.cpp b/src/Callhistory/CallHistoryEntry.cpp old mode 100755 new mode 100644 index 6ba1a88..7af2e12 --- a/src/Callhistory/CallHistoryEntry.cpp +++ b/src/Callhistory/CallHistoryEntry.cpp @@ -15,13 +15,11 @@ // limitations under the License. // - #include "CallHistoryEntry.h" - #include #include -#include #include +#include using namespace DeviceAPI::Tizen; using namespace WrtDeviceApis; @@ -34,18 +32,18 @@ namespace CallHistory { CallHistoryEntry::CallHistoryEntry() { if (contacts_connect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to connect Call history DB "); + LoggerD("Successful to connect Call history DB "); } else { - LogDebug("Failed to connect Call history DB "); + LoggerD("Failed to connect Call history DB "); } } CallHistoryEntry::~CallHistoryEntry() { if (contacts_disconnect2() == CONTACTS_ERROR_NONE) { - LogDebug("Successful to disconnect Call history DB "); + LoggerD("Successful to disconnect Call history DB "); } else { - LogDebug("Failed to disconnect Call history DB "); + LoggerD("Failed to disconnect Call history DB "); } } diff --git a/src/Callhistory/CallHistoryFilter.cpp b/src/Callhistory/CallHistoryFilter.cpp old mode 100755 new mode 100644 index 2b6bb8a..45f2e3c --- a/src/Callhistory/CallHistoryFilter.cpp +++ b/src/Callhistory/CallHistoryFilter.cpp @@ -15,12 +15,10 @@ // limitations under the License. // - -#include #include - #include "CallHistoryDefine.h" #include "CallHistoryFilter.h" +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -45,30 +43,30 @@ CallHistoryFilter::~CallHistoryFilter() void CallHistoryFilter::visitPreComposite(FilterType& type, int depth) { - LogDebug(" type [" << type << "] depth[" << depth << "]"); + LoggerD(" type [" << type << "] depth[" << depth << "]"); contacts_filter_h filter = NULL; contacts_filter_create(_contacts_phone_log._uri, &filter); if (filter != NULL) { m_filterStack.push(filter); } - LogDebug("filter stack size [" << m_filterStack.size() << "]"); + LoggerD("filter stack size [" << m_filterStack.size() << "]"); } void CallHistoryFilter::visitInComposite(FilterType& type, int depth) { - LogDebug("type [" << type << "] depth[" << depth << "]"); + LoggerD("type [" << type << "] depth[" << depth << "]"); contacts_filter_h filter = m_filterStack.top(); if(type == DeviceAPI::Tizen::UNION_FILTER) contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_OR); else if(type == DeviceAPI::Tizen::INTERSECTION_FILTER) contacts_filter_add_operator(filter, CONTACTS_FILTER_OPERATOR_AND); - LogDebug("filter stack size [" << m_filterStack.size() << "]"); + LoggerD("filter stack size [" << m_filterStack.size() << "]"); } void CallHistoryFilter::visitPostComposite(FilterType& type, int depth) { - LogDebug(" type [" << type << "] depth[" << depth << "]"); + LoggerD(" type [" << type << "] depth[" << depth << "]"); contacts_filter_h filter = m_filterStack.top(); if (m_filterStack.size() > 1) { m_filterStack.pop(); @@ -76,7 +74,7 @@ void CallHistoryFilter::visitPostComposite(FilterType& type, int depth) contacts_filter_add_filter(filterParent, filter); contacts_filter_destroy(filter); } - LogDebug("filter stack size [" << m_filterStack.size() << "]"); + LoggerD("filter stack size [" << m_filterStack.size() << "]"); } void CallHistoryFilter::visitAttribute(std::string& attrName, MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth) @@ -88,7 +86,7 @@ void CallHistoryFilter::visitAttribute(std::string& attrName, MatchFlag& matchFl return; } - LogDebug("attrName [" << attrName << "] matchValue[" << matchValue->toString() << "] depth[" << depth << "]"); + LoggerD("attrName [" << attrName << "] matchValue[" << matchValue->toString() << "] depth[" << depth << "]"); contacts_filter_h filter = m_filterStack.top(); contacts_filter_h subFilter = NULL; contacts_filter_create(_contacts_phone_log._uri, &subFilter); @@ -218,7 +216,7 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi if(initialValue == NULL || endValue == NULL) return; - LogDebug("attrName [" << attrName << "] initialValue[" << initialValue->toString() << "] endValue[" << endValue->toString() << "] depth[" << depth <<"]"); + LoggerD("attrName [" << attrName << "] initialValue[" << initialValue->toString() << "] endValue[" << endValue->toString() << "] depth[" << depth <<"]"); contacts_filter_h filter = m_filterStack.top(); unsigned int propertyId = 0; @@ -247,7 +245,7 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi iValue = atoi(initialValue->getString().c_str()); } } - LogDebug("attrName [" << attrName << "] initialValue[" << initialValue->toString() << "] iValue[" << iValue << "]"); + LoggerD("attrName [" << attrName << "] initialValue[" << initialValue->toString() << "] iValue[" << iValue << "]"); } if (!endValue->isNullOrUndefined()) { @@ -258,7 +256,7 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi eValue = atoi(endValue->getString().c_str()); } } - LogDebug("attrName [" << attrName << "] endValue[" << endValue->toString() << "] eValue[" << eValue << "]"); + LoggerD("attrName [" << attrName << "] endValue[" << endValue->toString() << "] eValue[" << eValue << "]"); } contacts_filter_h subFilter = NULL; @@ -292,7 +290,7 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi contacts_filter_h CallHistoryFilter::getResult() const { - LogDebug("filter stack size [" << m_filterStack.size() << "]"); + LoggerD("filter stack size [" << m_filterStack.size() << "]"); contacts_filter_h filter = m_filterStack.top(); return filter; } diff --git a/src/Callhistory/CallHistoryFilterConverter.cpp b/src/Callhistory/CallHistoryFilterConverter.cpp index 5271bf2..b10fa08 100644 --- a/src/Callhistory/CallHistoryFilterConverter.cpp +++ b/src/Callhistory/CallHistoryFilterConverter.cpp @@ -23,8 +23,7 @@ */ #include "CallHistoryFilterConverter.h" - -#include +#include namespace DeviceAPI { namespace CallHistory { @@ -52,7 +51,7 @@ CallHistoryFilterConverter::CallHistoryFilterConverter(JSContextRef context) : CallHistoryFilterConverter::~CallHistoryFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } } // CallHistory diff --git a/src/Callhistory/CallHistoryListenerManager.h b/src/Callhistory/CallHistoryListenerManager.h old mode 100755 new mode 100644 index 4907537..bf756af --- a/src/Callhistory/CallHistoryListenerManager.h +++ b/src/Callhistory/CallHistoryListenerManager.h @@ -20,11 +20,11 @@ #include #include -#include #include #include #include #include "JSCallHistory.h" +#include namespace DeviceAPI { namespace CallHistory { @@ -59,7 +59,7 @@ public: JSCallHistoryPriv *priv = static_cast (JSObjectGetPrivate(m_object)); if (!priv) { - LogWarning("Object has no private object"); + LoggerW("Object has no private object"); return; } @@ -67,7 +67,7 @@ public: ICallHistoryPtr callHistory(priv->getObject()); callHistory->removeListener(m_watchId); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Callhistory/CallHistoryStaticController.cpp b/src/Callhistory/CallHistoryStaticController.cpp old mode 100755 new mode 100644 index d95250c..8967960 --- a/src/Callhistory/CallHistoryStaticController.cpp +++ b/src/Callhistory/CallHistoryStaticController.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include "CallHistoryStaticController.h" #include "Converter.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -81,7 +81,7 @@ void CallHistoryStaticController::onAnswerReceived(const EventCallHistoryListene } } } catch(ConversionException) { - LogError("Conversion exception while processing EventCallHistoryListener"); + LoggerE("Conversion exception while processing EventCallHistoryListener"); } } diff --git a/src/Callhistory/Converter.cpp b/src/Callhistory/Converter.cpp old mode 100755 new mode 100644 index 447b4fc..e92d74c --- a/src/Callhistory/Converter.cpp +++ b/src/Callhistory/Converter.cpp @@ -15,10 +15,7 @@ // limitations under the License. // - #include "Converter.h" -#include - #include #include #include @@ -27,6 +24,7 @@ #include "CallHistoryDefine.h" #include "JSCallHistoryEntry.h" #include "JSRemoteParty.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -144,7 +142,7 @@ EventCallHistoryListenerPrivateDataPtr Converter::toEventCallHistoryListenerPrivateData(const JSValueRef &jsValue, JSContextRef context) { - LogDebug("enter"); + LoggerD("enter"); if (JSValueIsNull(m_context, jsValue) || JSValueIsUndefined(m_context, jsValue)) { ThrowMsg(Commons::ConversionException, "Type missmatch error : Listener callback is null or undefined"); @@ -183,7 +181,7 @@ EventCallHistoryListenerPrivateDataPtr 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"); + LoggerD("onRemoved register"); } else { ThrowMsg(Commons::ConversionException, "Type missmatch error : onremoved callback"); diff --git a/src/Callhistory/JSCallHistoryEntry.cpp b/src/Callhistory/JSCallHistoryEntry.cpp index 119746d..87dfa97 100755 --- a/src/Callhistory/JSCallHistoryEntry.cpp +++ b/src/Callhistory/JSCallHistoryEntry.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -32,6 +30,7 @@ #include "JSCallHistoryEntry.h" #include "JSRemoteParty.h" #include "Converter.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; diff --git a/src/Callhistory/JSRemoteParty.cpp b/src/Callhistory/JSRemoteParty.cpp index 8a87b2d..7c47482 100755 --- a/src/Callhistory/JSRemoteParty.cpp +++ b/src/Callhistory/JSRemoteParty.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -28,6 +26,7 @@ #include "RemoteParty.h" #include "JSRemoteParty.h" #include "Converter.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; diff --git a/src/Callhistory/ResponseDispatcher.cpp b/src/Callhistory/ResponseDispatcher.cpp index 0347d9d..86116c8 100755 --- a/src/Callhistory/ResponseDispatcher.cpp +++ b/src/Callhistory/ResponseDispatcher.cpp @@ -14,13 +14,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // - #include "ResponseDispatcher.h" - -#include #include - #include #include #include @@ -30,6 +26,7 @@ #include "JSCallHistory.h" #include "Converter.h" #include "CallHistoryAsyncCallbackManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; diff --git a/src/Callhistory/plugin_initializer.cpp b/src/Callhistory/plugin_initializer.cpp old mode 100755 new mode 100644 index 6e4899d..a484085 --- a/src/Callhistory/plugin_initializer.cpp +++ b/src/Callhistory/plugin_initializer.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -24,6 +22,7 @@ #include "JSCallHistory.h" #include "CallHistoryAsyncCallbackManager.h" #include "CallHistoryListenerManager.h" +#include #define CALLHISTORY "callhistory" @@ -34,34 +33,34 @@ using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\callhistory] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\callhistory] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); try { WrtAccessSingleton::Instance().initialize(widgetId); } catch(WrtDeviceApis::Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\callhistory] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\callhistory] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"CallHistory"); TIME_TRACER_RELEASE(); try { WrtAccessSingleton::Instance().deinitialize(widgetId); } catch(WrtDeviceApis::Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\callhistory] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\callhistory] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\callhistory] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\callhistory] on_frame_unload_callback (" << context << ")"); DeviceAPI::CallHistory::CallHistoryAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); DeviceAPI::CallHistory::CallHistoryListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/Common/ArgumentValidator.cpp b/src/Common/ArgumentValidator.cpp index 9bb827e..232b398 100755 --- a/src/Common/ArgumentValidator.cpp +++ b/src/Common/ArgumentValidator.cpp @@ -26,10 +26,6 @@ #include #include - -#undef LOG_TAG -#define LOG_TAG "TIZEN_DEVICEAPI" - using namespace std; using namespace WrtDeviceApis::CommonsJavaScript; using namespace WrtDeviceApis::Commons; diff --git a/src/Common/AsyncCallbackManager.h b/src/Common/AsyncCallbackManager.h index a8e6bc9..ab1b036 100644 --- a/src/Common/AsyncCallbackManager.h +++ b/src/Common/AsyncCallbackManager.h @@ -25,10 +25,10 @@ #ifndef _TIZEN_COMMONS_ASYNC_CALLBACK_MANAGER_H_ #define _TIZEN_COMMONS_ASYNC_CALLBACK_MANAGER_H_ -#include #include #include #include +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -51,18 +51,18 @@ public: virtual void registerCallbackManager(WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr &cbm, const JSContextRef context) { - LogDebug("Registering an callback manager on context:" << context); + LoggerD("Registering an callback manager on context:" << context); m_map.insert(JSCallbackManagerPair(cbm, context)); } virtual void unregisterContext(const JSContextRef context) { - LogDebug("Unregistering all callback managers on context:" << context); + LoggerD("Unregistering all callback managers on context:" << context); for(JSCallbackManagerMapIter i=m_map.begin(); i!=m_map.end(); i++) { if(i->second == context) { - LogDebug("unregister a callback manager"); + LoggerD("unregister a callback manager"); i->first->setOnSuccess(NULL); i->first->setOnError(NULL); // This function does not remove cbm from multimap. @@ -73,12 +73,12 @@ public: virtual void unregisterCallbackManager(const WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr &cbm) { - LogDebug("Unregistering an callback manager"); + LoggerD("Unregistering an callback manager"); JSCallbackManagerMapIter i = m_map.find(cbm); if(i == m_map.end()) { - LogWarning("nothing to unregister"); + LoggerW("nothing to unregister"); // Something wrong return; } diff --git a/src/Common/CallbackUserData.cpp b/src/Common/CallbackUserData.cpp index a596815..479238f 100644 --- a/src/Common/CallbackUserData.cpp +++ b/src/Common/CallbackUserData.cpp @@ -17,13 +17,8 @@ #include "CallbackUserData.h" #include "MultiCallbackUserData.h" - -#include #include -#undef LOG_TAG -#define LOG_TAG "TIZEN_DEVICEAPI" - using namespace std; namespace DeviceAPI { diff --git a/src/Common/GlobalContextManager.cpp b/src/Common/GlobalContextManager.cpp index 32bc2c4..e949d14 100644 --- a/src/Common/GlobalContextManager.cpp +++ b/src/Common/GlobalContextManager.cpp @@ -16,11 +16,7 @@ // #include "GlobalContextManager.h" - -#include - -#undef LOG_TAG -#define LOG_TAG "TIZEN_DEVICEAPI" +#include "Logger.h" using namespace std; @@ -37,14 +33,14 @@ GlobalContextManager* GlobalContextManager::getInstance(){ JSContextRef GlobalContextManager::getGlobalContext(JSContextRef ctx){ if( ctx == NULL ){ - LOGE("local context is NULL"); + LoggerE("local context is NULL"); return NULL; } JSObjectRef global = JSContextGetGlobalObject(ctx); ContextMapT::iterator itr; itr = mContexts.find(global); if( itr == mContexts.end() ){ - LOGE("Can not found global Context"); + LoggerE("Can not found global Context"); return NULL; } return itr->second; @@ -67,7 +63,7 @@ void GlobalContextManager::addGlobalContext(JSContextRef ctx){ JSObjectRef global = JSContextGetGlobalObject(ctx); itr = mContexts.find(global); if( itr != mContexts.end() ){ - LOGD("already added global context"); + LoggerD("already added global context"); return; } mContexts[global] = ctx; @@ -78,13 +74,13 @@ void GlobalContextManager::removeGlobalContext(JSContextRef ctx){ JSObjectRef global = JSContextGetGlobalObject(ctx); itr = mContexts.find(global); if( itr == mContexts.end() ){ - LOGD("does not exist context"); + LoggerD("does not exist context"); return; } if( itr->second == ctx ) mContexts.erase(itr); else - LOGE("passed context is not global context"); + LoggerE("passed context is not global context"); } } diff --git a/src/Common/IListenerManager.h b/src/Common/IListenerManager.h index d29d83a..c32aac3 100644 --- a/src/Common/IListenerManager.h +++ b/src/Common/IListenerManager.h @@ -27,8 +27,8 @@ #include #include -#include #include +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -52,22 +52,22 @@ public: virtual void protectObject() { - LogDebug("Protect object:" << m_object); + LoggerD("Protect object:" << m_object); JSValueProtect(m_context, m_object); } virtual void unprotectObject() { - LogDebug("Unprotect object:" << m_object); + LoggerD("Unprotect object:" << m_object); JSValueUnprotect(m_context, m_object); } virtual void cancelListener() { - LogWarning("IListenerItem MUST be used as an inherited shape."); - LogWarning("If this log has been printed, it must be used with wrong usage."); + LoggerW("IListenerItem MUST be used as an inherited shape."); + LoggerW("If this log has been printed, it must be used with wrong usage."); } virtual bool equal(const DeviceAPI::Common::IListenerItemPtr &other) const @@ -105,7 +105,7 @@ public: virtual void registerListener(IListenerItemPtr &canceller, const JSContextRef context) { - LogDebug("Registering a listener on context:" << context); + LoggerD("Registering a listener on context:" << context); canceller->protectObject(); m_map.insert(ListenerPair(context, canceller)); @@ -113,13 +113,13 @@ public: virtual void unregisterContext(const JSContextRef context) { - LogDebug("Unregistering all listeners on context:" << context); + LoggerD("Unregistering all listeners on context:" << context); ListenerMapIterPair iterPair = m_map.equal_range(context); for(ListenerMapIter i=iterPair.first; i!=iterPair.second; i++) { - LogDebug("Unregistering a listener"); + LoggerD("Unregistering a listener"); i->second->cancelListener(); i->second->unprotectObject(); } @@ -129,13 +129,13 @@ public: virtual void unregisterListener(const IListenerItemPtr &canceller) { - LogDebug("Unregistering a listener"); + LoggerD("Unregistering a listener"); for(ListenerMapIter i=m_map.begin(); i!=m_map.end(); i++) { if(i->second->equal(canceller)) { - LogDebug("Found object"); + LoggerD("Found object"); i->second->unprotectObject(); m_map.erase(i); diff --git a/src/Common/JSArray.cpp b/src/Common/JSArray.cpp index 3e60e9b..cd386da 100755 --- a/src/Common/JSArray.cpp +++ b/src/Common/JSArray.cpp @@ -28,7 +28,7 @@ size_t JSArrayBase::size() const { } void JSArrayBase::resize(size_t size){ - JSUtil::setProperty(mContext, mArray, "length", JSUtil::toJSValueRef(mContext, static_cast(size)), NULL, NULL); + JSUtil::setProperty(mContext, mArray, "length", JSUtil::toJSValueRef(mContext, static_cast(size)), kJSPropertyAttributeNone, NULL); } JSValueRef JSArrayBase::get(int index) const{ diff --git a/src/Common/JSTizenException.cpp b/src/Common/JSTizenException.cpp index ba312fe..271c829 100644 --- a/src/Common/JSTizenException.cpp +++ b/src/Common/JSTizenException.cpp @@ -16,10 +16,8 @@ // #include "JSTizenException.h" - -#include - #include +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -118,7 +116,7 @@ namespace Common { JSValueRef JSTizenException::getStaticProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* /*exception*/) { PrivateObject* privateObject = static_cast (JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSValueMakeUndefined(context); } @@ -130,7 +128,7 @@ namespace Common { // return converter.toJSValueRef(privateObject->getObject()->getMessage()); // } // } catch (const WrtDeviceApis::Commons::ConversionException& ex) { -// LogError("Exception: " << ex.GetMessage()); +// LoggerE("Exception: " << ex.GetMessage()); // } return JSValueMakeUndefined(context); diff --git a/src/Common/JSTizenExceptionFactory.cpp b/src/Common/JSTizenExceptionFactory.cpp index 19f8ffd..af21cb8 100644 --- a/src/Common/JSTizenExceptionFactory.cpp +++ b/src/Common/JSTizenExceptionFactory.cpp @@ -16,15 +16,12 @@ // #include "JSTizenExceptionFactory.h" - #include -#include - #include - #include "TizenExceptionData.h" #include "JSWebAPIError.h" #include "JSWebAPIException.h" +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -53,4 +50,4 @@ namespace Common { return JSValueMakeUndefined(context); } }// Common -}// DeviceAPI \ No newline at end of file +}// DeviceAP \ No newline at end of file diff --git a/src/Common/JSWebAPIError.cpp b/src/Common/JSWebAPIError.cpp index 46c5507..9f2cb98 100644 --- a/src/Common/JSWebAPIError.cpp +++ b/src/Common/JSWebAPIError.cpp @@ -16,12 +16,10 @@ // #include "JSWebAPIError.h" - -#include - #include #include #include +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -188,14 +186,14 @@ namespace{ JSValueRef JSWebAPIError::getStaticProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* /*exception*/) { PrivateObject* privateObject = static_cast (JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSValueMakeUndefined(context); } WrtDeviceApis::CommonsJavaScript::Converter converter(context); try { if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_CODE)) { - LogDebug("propertyName PROPERTY_CODE"); + LoggerD("propertyName PROPERTY_CODE"); return converter.toJSValueRef(privateObject->getObject()->getCode()); } else if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_NAME)) { return converter.toJSValueRef(privateObject->getObject()->getName()); @@ -256,11 +254,11 @@ namespace{ }else if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_DATA_CLONE_ERR)) { return converter.toJSValueRef(DATA_CLONE_ERR); }else{ - LogDebug("propertyName not supported"); + LoggerD("propertyName not supported"); return converter.toJSValueRef(UNKNOWN_ERR); } } catch (const WrtDeviceApis::Commons::ConversionException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } return JSValueMakeUndefined(context); @@ -284,7 +282,7 @@ namespace{ } int JSWebAPIError::convertToWebAPIErrorCode(const std::string& errorName){ - LogDebug("<<< errorName:[" << errorName << "]"); + LoggerD("<<< errorName:[" << errorName << "]"); int retErrorCode = -1; @@ -312,7 +310,7 @@ namespace{ retErrorCode = UNKNOWN_ERR; } - LogDebug(">>> retERrorCode:" << retErrorCode ); + LoggerD(">>> retERrorCode:" << retErrorCode ); return retErrorCode; } diff --git a/src/Common/JSWebAPIError2.cpp b/src/Common/JSWebAPIError2.cpp index 4a96d3d..41e35ed 100644 --- a/src/Common/JSWebAPIError2.cpp +++ b/src/Common/JSWebAPIError2.cpp @@ -16,12 +16,11 @@ // #include "JSWebAPIError2.h" - #include #include -#include #include #include "JSUtil.h" +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -171,7 +170,7 @@ JSObjectRef JSWebAPIError2::createJSObject(JSContextRef context, PrivateObject *priv = new PrivateObject(context, webapiError); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -199,7 +198,7 @@ JSValueRef JSWebAPIError2::getStaticProperty(JSContextRef context, PrivateObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSValueMakeUndefined(context); } @@ -232,7 +231,7 @@ JSValueRef JSWebAPIError2::getStaticProperty(JSContextRef context, } catch (const WrtDeviceApis::Commons::ConversionException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } return JSValueMakeUndefined(context); @@ -248,7 +247,7 @@ JSValueRef JSWebAPIError2::toString(JSContextRef context, PrivateObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return NULL; } diff --git a/src/Common/JSWebAPIErrorFactory.cpp b/src/Common/JSWebAPIErrorFactory.cpp index cb85683..0685c9c 100644 --- a/src/Common/JSWebAPIErrorFactory.cpp +++ b/src/Common/JSWebAPIErrorFactory.cpp @@ -16,14 +16,12 @@ // #include "JSWebAPIErrorFactory.h" - #include #include -#include #include #include - #include "JSWebAPIError2.h" +#include "Logger.h" #define INDEX_SIZE_ERROR_NAME_STR "IndexSizeError" #define DOMSTRING_SIZE_ERROR_NAME_STR "DOMStringSizeError" diff --git a/src/Common/JSWebAPIException.cpp b/src/Common/JSWebAPIException.cpp index 0db9318..b92f1f2 100644 --- a/src/Common/JSWebAPIException.cpp +++ b/src/Common/JSWebAPIException.cpp @@ -16,12 +16,10 @@ // #include "JSWebAPIException.h" - -#include - #include #include #include +#include "Logger.h" namespace DeviceAPI { namespace Common { @@ -188,14 +186,14 @@ namespace{ JSValueRef JSWebAPIException::getStaticProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* /*exception*/) { PrivateObject* privateObject = static_cast (JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSValueMakeUndefined(context); } WrtDeviceApis::CommonsJavaScript::Converter converter(context); try { if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_CODE)) { - LogDebug("propertyName PROPERTY_CODE"); + LoggerD("propertyName PROPERTY_CODE"); return converter.toJSValueRef(privateObject->getObject()->getCode()); } else if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_NAME)) { return converter.toJSValueRef(privateObject->getObject()->getName()); @@ -256,11 +254,11 @@ namespace{ }else if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_DATA_CLONE_ERR)) { return converter.toJSValueRef(DATA_CLONE_ERR); }else{ - LogDebug("propertyName not supported"); + LoggerD("propertyName not supported"); return converter.toJSValueRef(UNKNOWN_ERR); } } catch (const WrtDeviceApis::Commons::ConversionException& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } return JSValueMakeUndefined(context); @@ -284,7 +282,7 @@ namespace{ } int JSWebAPIException::convertToWebAPIExceptionCode(const std::string& errorName){ - LogDebug("<<< errorName:[" << errorName << "]"); + LoggerD("<<< errorName:[" << errorName << "]"); int retErrorCode = -1; @@ -312,7 +310,7 @@ namespace{ retErrorCode = UNKNOWN_ERR; } - LogDebug(">>> retERrorCode:" << retErrorCode ); + LoggerD(">>> retERrorCode:" << retErrorCode ); return retErrorCode; } diff --git a/src/Common/Logger.h b/src/Common/Logger.h index 4b8604f..c3a3268 100644 --- a/src/Common/Logger.h +++ b/src/Common/Logger.h @@ -27,29 +27,13 @@ #define _LOGGER(prio, fmt, args...) \ do { \ std::ostringstream platformLog; \ - platformLog << "%s: %s(%d) > "; \ platformLog << fmt; \ - print_log(prio, LOG_TAG, platformLog.str().c_str(), __MODULE__, __func__, __LINE__, ##args); \ + print_log(prio, LOG_TAG, "%s: %s(%d) > %s", __MODULE__, __func__, __LINE__, platformLog.str().c_str(), ##args); \ } while(0) -#ifdef LogDebug -#undef LogDebug -#endif -#define LogDebug(fmt, args...) _LOGGER(DLOG_DEBUG, fmt, ##args) - -#ifdef LogInfo -#undef LogInfo -#endif -#define LogInfo(fmt, args...) _LOGGER(DLOG_INFO, fmt, ##args) - -#ifdef LogWarning -#undef LogWarning -#endif -#define LogWarning(fmt, args...) _LOGGER(DLOG_WARN, fmt, ##args) - -#ifdef LogError -#undef LogError -#endif -#define LogError(fmt, args...) _LOGGER(DLOG_ERROR, fmt, ##args) +#define LoggerD(fmt, args...) _LOGGER(DLOG_DEBUG, fmt, ##args) +#define LoggerI(fmt, args...) _LOGGER(DLOG_INFO, fmt, ##args) +#define LoggerW(fmt, args...) _LOGGER(DLOG_WARN, fmt, ##args) +#define LoggerE(fmt, args...) _LOGGER(DLOG_ERROR, fmt, ##args) #endif // __TIZEN_COMMON_LOGGER_H__ diff --git a/src/Common/StandaloneConsole/JSConsole.cpp b/src/Common/StandaloneConsole/JSConsole.cpp index bd96cbd..42fe5ad 100755 --- a/src/Common/StandaloneConsole/JSConsole.cpp +++ b/src/Common/StandaloneConsole/JSConsole.cpp @@ -122,7 +122,7 @@ JSValueRef JSConsole::log(JSContextRef ctx, JSObjectRef object, JSObjectRef this try{ string result = convert.toString(arguments[0]); - printf("%s\n",diff.tv_sec,diff.tv_usec,result.c_str()); + printf("%s\n",(int)diff.tv_sec,(int)diff.tv_usec,result.c_str()); LOGD("%s", result.c_str()); }catch(const ConversionException& err){ } diff --git a/src/Common/StandaloneConsole/StandaloneConsole.cpp b/src/Common/StandaloneConsole/StandaloneConsole.cpp index c7720d8..c5e76c2 100755 --- a/src/Common/StandaloneConsole/StandaloneConsole.cpp +++ b/src/Common/StandaloneConsole/StandaloneConsole.cpp @@ -404,8 +404,8 @@ class LineBuffer{ vector mHistory; string mLine; int mHistoryIndex; - int mCurrentPos; - int mCurrentPosTmp; + unsigned int mCurrentPos; + unsigned int mCurrentPosTmp; int mLineLength; public: LineBuffer():mHistoryIndex(0), mCurrentPos(0){ @@ -503,10 +503,10 @@ public: case 49: //home mCurrentPos = 0; - getch(); + a = getch(); break; default: - getch(); + a = getch(); } return true; diff --git a/src/Contact/AddressBook.cpp b/src/Contact/AddressBook.cpp old mode 100755 new mode 100644 index 5584039..1f93012 --- a/src/Contact/AddressBook.cpp +++ b/src/Contact/AddressBook.cpp @@ -23,13 +23,10 @@ */ #include "AddressBook.h" - #include - #include #include #include -#include #include #include #include @@ -42,8 +39,8 @@ #include "ContactSearchEngine.h" #include "ContactFilterValidator.h" #include "ContactUtility.h" - #include "ContactQueue.h" +#include namespace DeviceAPI { namespace Contact { @@ -61,7 +58,7 @@ AddressBook::AddressBook(bool isUnified) : m_isUnifiedAddressBook(isUnified), m_eventMapAcc(100) { - LogDebug("entered"); + LoggerD("entered"); } AddressBook::~AddressBook() @@ -100,7 +97,7 @@ void AddressBook::setAccountId(const std::string &value) void AddressBook::OnRequestReceived(const EventAddressBookGetPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_record_h contacts_record = NULL; @@ -135,25 +132,25 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetPtr &event) } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during getting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during getting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -164,7 +161,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; int id = 0; @@ -187,7 +184,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) } Catch(InvalidArgumentException) { - LogError("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -217,7 +214,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) int contactId = 0; if (!contacts_record) { - LogError("Error during converting contact object"); + LoggerE("Error during converting contact object"); ThrowMsg(PlatformException, "Error during converting contact object"); } @@ -227,14 +224,14 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) errorCode = contacts_record_set_int(contacts_record, _contacts_contact.address_book_id, m_id); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_insert_record()"); } errorCode = contacts_db_insert_record(contacts_record, &contactId); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_insert_record()"); } @@ -252,13 +249,13 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) } Catch (PlatformException) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } Catch (Exception) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -269,7 +266,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddPtr &event) void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_list_h contacts_list = NULL; @@ -293,7 +290,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -354,7 +351,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) Catch(Exception) { ThrowMsg(NotFoundException, "Error during converting contact object"); -// LogError("Error during converting contact object : " << _rethrown_exception.GetMessage()); +// LoggerE("Error during converting contact object : " << _rethrown_exception.GetMessage()); // continue; } } @@ -391,7 +388,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } @@ -402,7 +399,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -413,7 +410,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -424,7 +421,7 @@ void AddressBook::AddressBookAddBatch(const EventAddressBookAddBatchPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookAddBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -439,7 +436,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddBatchPtr &event) } Catch (Exception) { - LogError("Error during adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -447,7 +444,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddBatchPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookUpdatePtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactPtr contact(NULL); Try @@ -467,7 +464,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdatePtr &event) } Catch(InvalidArgumentException) { - LogError("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -498,7 +495,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdatePtr &event) if (!contacts_record) { - LogError("Error during converting contact object"); + LoggerE("Error during converting contact object"); ThrowMsg(PlatformException, "Error during converting contact object"); } @@ -507,27 +504,27 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdatePtr &event) ThrowMsg(NotFoundException, "Error during executing contacts_db_update_record()"); else if (errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_update_record()"); } } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; } Catch (PlatformException) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -540,7 +537,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdatePtr &event) void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_list_h contacts_list = NULL; ContactArrayPtr contacts(NULL); @@ -562,7 +559,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid arguments for updating contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for updating contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -598,7 +595,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e contacts_record = newContactT->getPlatformContactObject(); if(contacts_record == NULL) { - LogDebug("id : " << contact->getId()); + LoggerD("id : " << contact->getId()); int contactIdInt = ContactUtility::strToInt(contact->getId()); errorCode = contacts_db_get_record(_contacts_contact._uri, contactIdInt, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE || contacts_record == NULL) @@ -622,7 +619,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e Catch(Exception) { ThrowMsg(NotFoundException, "Error during converting contact object"); -// LogError("Error during converting contact object : " << _rethrown_exception.GetMessage()); +// LoggerE("Error during converting contact object : " << _rethrown_exception.GetMessage()); // continue; } } @@ -659,7 +656,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } @@ -670,7 +667,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -681,7 +678,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -692,7 +689,7 @@ void AddressBook::AddressBookUpdateBatch(const EventAddressBookUpdateBatchPtr &e void AddressBook::OnRequestReceived(const EventAddressBookUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -707,7 +704,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateBatchPtr &event) } Catch (Exception) { - LogError("Error during updating contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -715,7 +712,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateBatchPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookRemovePtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; Try @@ -754,28 +751,28 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemovePtr &event) } Catch (InvalidArgumentException) { - LogError("Invalid contact id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid contact id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; } Catch (PlatformException) { - LogError("Error during updating contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Error during updating contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -787,7 +784,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemovePtr &event) void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; StringArrayPtr contactIds(NULL); @@ -808,7 +805,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid arguments for removing contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for removing contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -861,7 +858,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e Catch(Exception) { ThrowMsg(NotFoundException, "Error during converting contact object"); -// LogError("Error during converting contact object : " << _rethrown_exception.GetMessage()); +// LoggerE("Error during converting contact object : " << _rethrown_exception.GetMessage()); // continue; } } @@ -939,7 +936,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid contact id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid contact id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -951,7 +948,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; @@ -963,7 +960,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during deleting contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -975,7 +972,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during deleting contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -984,7 +981,7 @@ void AddressBook::AddressBookRemoveBatch(const EventAddressBookRemoveBatchPtr &e void AddressBook::OnRequestReceived(const EventAddressBookRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -999,7 +996,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveBatchPtr &event) } Catch (Exception) { - LogError("Error during deleting contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -1007,7 +1004,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveBatchPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookFindPtr &event) { - LogDebug("entered"); + LoggerD("entered"); contacts_query_h query = NULL; contacts_filter_h filter = NULL; @@ -1047,25 +1044,25 @@ void AddressBook::OnRequestReceived(const EventAddressBookFindPtr &event) } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during finding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during finding contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during deleting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -1082,7 +1079,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookFindPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookAddChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1095,7 +1092,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddChangeListenerPtr & if(m_addressBookEmitters.size() == 0) { - LogDebug("Watch registered initially"); + LoggerD("Watch registered initially"); if(m_isUnifiedAddressBook) ContactsSvcChangeListenerManagerSingleton::Instance().registerContactsChangeListener(this, -1); @@ -1113,25 +1110,25 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddChangeListenerPtr & } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during deleting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during deleting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -1139,7 +1136,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddChangeListenerPtr & void AddressBook::OnRequestReceived(const EventAddressBookRemoveChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -1158,7 +1155,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveChangeListenerPt if(m_addressBookEmitters.size() == 0) { - LogDebug("No watcher is registered. unsubscribing from contact service."); + LoggerD("No watcher is registered. unsubscribing from contact service."); ContactsSvcChangeListenerManagerSingleton::Instance().unregisterContactsChangeListener(this); } @@ -1168,25 +1165,25 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveChangeListenerPt } Catch (NotFoundException) { - LogError("WatchId doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("WatchId doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during deleting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during deleting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -1194,7 +1191,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveChangeListenerPt void AddressBook::OnRequestReceived(const EventAddressBookGetGroupPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_record_h contacts_record = NULL; @@ -1230,28 +1227,28 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupPtr &event) } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during getting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during getting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -1262,7 +1259,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; @@ -1283,7 +1280,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) } Catch(InvalidArgumentException) { - LogError("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for adding contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -1294,7 +1291,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) errorCode = contacts_record_create(_contacts_group._uri, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_record_create()"); } @@ -1304,7 +1301,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) errorCode = contacts_record_set_int(contacts_record, _contacts_group.address_book_id, m_id); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_record_set_int()"); } @@ -1314,7 +1311,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) errorCode = contacts_db_insert_record(contacts_record, &groupId); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_insert_record()"); } group->setId(groupId); @@ -1325,13 +1322,13 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) } Catch (PlatformException) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } Catch (Exception) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); } @@ -1342,7 +1339,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookAddGroupPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; @@ -1366,7 +1363,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) } Catch(InvalidArgumentException) { - LogError("Invalid arguments for updating group : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for updating group : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -1374,7 +1371,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) if(group->getReadOnly()) { - LogWarning("Canceling updating readonly data."); + LoggerW("Canceling updating readonly data."); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -1383,17 +1380,17 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) Try { int id = ContactUtility::strToInt(group->getId()); - LogDebug("Load platform object id : " << id); + LoggerD("Load platform object id : " << id); errorCode = contacts_db_get_record(_contacts_group._uri, id, &contacts_record); if (errorCode == CONTACTS_ERROR_INVALID_PARAMETER) ThrowMsg(NotFoundException, "Error during executing contacts_db_get_record()"); else if (errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_get_record()"); } - LogDebug("Update group : " << id); + LoggerD("Update group : " << id); ContactsSvcObjectConverter::convertToPlatform(group, contacts_record); errorCode = contacts_db_update_record(contacts_record); @@ -1401,7 +1398,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) ThrowMsg(NotFoundException, "Error during executing contacts_db_update_record()"); else if (errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_update_record()"); } @@ -1410,19 +1407,19 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (PlatformException) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } Catch (Exception) { - LogError("Error during adding contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during adding contact : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -1435,7 +1432,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookUpdateGroupPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookRemoveGroupPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; Try @@ -1477,25 +1474,25 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveGroupPtr &event) } Catch (InvalidArgumentException) { - LogError("Invalid group id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid group id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); } Catch (NotFoundException) { - LogError("Group doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Group doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (PlatformException) { - LogError("Error during removing group : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing group : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } Catch (Exception) { - LogError("Error during removing group : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing group : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -1503,7 +1500,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookRemoveGroupPtr &event) void AddressBook::OnRequestReceived(const EventAddressBookGetGroupsPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; @@ -1565,7 +1562,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupsPtr &event) errorCode = contacts_list_get_current_record_p(groups_list, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE || contacts_record == NULL) { - LogWarning("Fail to get group record (ret:" << errorCode << ")"); + LoggerW("Fail to get group record (ret:" << errorCode << ")"); continue; } @@ -1579,42 +1576,42 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupsPtr &event) errorCode = contacts_record_get_int(contacts_record, _contacts_group.id, &id); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get id from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get id from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_int(contacts_record, _contacts_group.address_book_id, &addressBookId); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get address book id from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get address book id from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_str_p(contacts_record, _contacts_group.name, &name); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get name from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get name from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_str_p(contacts_record, _contacts_group.image_path, &photoURI); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get image_path from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get image_path from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_str_p(contacts_record, _contacts_group.ringtone_path, &ringtoneURI); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get ringtone_path from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get ringtone_path from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_bool(contacts_record, _contacts_group.is_read_only, &isReadOnly); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get is_read_only from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get is_read_only from address book (ret:" << errorCode << ")"); continue; } @@ -1640,7 +1637,7 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupsPtr &event) errorCode = contacts_list_next(groups_list); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get next address book (ret:" << errorCode << ")"); + LoggerW("Fail to get next address book (ret:" << errorCode << ")"); break; } } @@ -1651,28 +1648,28 @@ void AddressBook::OnRequestReceived(const EventAddressBookGetGroupsPtr &event) } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during getting contact : " << _rethrown_exception.GetMessage()); + LoggerE("Error during getting contact : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -1710,10 +1707,10 @@ void AddressBook::onContactsSvcContactsRemoved(StringArrayPtr &contactIds) void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned int count, void *user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogError("user_data is NULL"); + LoggerE("user_data is NULL"); return; } @@ -1735,7 +1732,7 @@ void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned i iter = m_addBatchEventMap.find(key); if(iter == m_addBatchEventMap.end()) { - LogError("No event for key : " << key); + LoggerE("No event for key : " << key); return; } @@ -1744,7 +1741,7 @@ void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned i if(error != CONTACTS_ERROR_NONE) { - LogError("contacts_db_insert_result_cb gives error : " << error); + LoggerE("contacts_db_insert_result_cb gives error : " << error); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); EventRequestReceiver::ManualAnswer(event); @@ -1761,14 +1758,14 @@ void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned i { int errorCode = 0; int contactId = ids[i]; - LogDebug("contact id : " << contactId); + LoggerD("contact id : " << contactId); contacts_record_h contacts_record = NULL; errorCode = contacts_db_get_record(_contacts_contact._uri, contactId, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); + LoggerD("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); continue; } @@ -1791,7 +1788,7 @@ void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned i } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); continue; } @@ -1812,11 +1809,11 @@ void AddressBook::contactsAddBatchResultCallback(int error, int *ids, unsigned i void AddressBook::contactsUpdateBatchResultCallback(int error, void *user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogError("user_data is NULL"); + LoggerE("user_data is NULL"); return; } @@ -1838,7 +1835,7 @@ void AddressBook::contactsUpdateBatchResultCallback(int error, long key) iter = m_updateBatchEventMap.find(key); if(iter == m_updateBatchEventMap.end()) { - LogError("No event for key : " << key); + LoggerE("No event for key : " << key); return; } @@ -1847,7 +1844,7 @@ void AddressBook::contactsUpdateBatchResultCallback(int error, long key) if(error != CONTACTS_ERROR_NONE) { - LogError("contacts_db_result_cb gives error : " << error); + LoggerE("contacts_db_result_cb gives error : " << error); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); EventRequestReceiver::ManualAnswer(event); @@ -1861,11 +1858,11 @@ void AddressBook::contactsUpdateBatchResultCallback(int error, long key) void AddressBook::contactsRemoveBatchResultCallback(int error, void *user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogError("user_data is NULL"); + LoggerE("user_data is NULL"); return; } @@ -1887,7 +1884,7 @@ void AddressBook::contactsRemoveBatchResultCallback(int error, long key) iter = m_removeBatchEventMap.find(key); if(iter == m_removeBatchEventMap.end()) { - LogError("No event for key : " << key); + LoggerE("No event for key : " << key); return; } @@ -1896,7 +1893,7 @@ void AddressBook::contactsRemoveBatchResultCallback(int error, long key) if(error != CONTACTS_ERROR_NONE) { - LogError("contacts_db_result_cb gives error : " << error); + LoggerE("contacts_db_result_cb gives error : " << error); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); EventRequestReceiver::ManualAnswer(event); diff --git a/src/Contact/AddressBookController.cpp b/src/Contact/AddressBookController.cpp old mode 100755 new mode 100644 index 91fffd5..c7a03b8 --- a/src/Contact/AddressBookController.cpp +++ b/src/Contact/AddressBookController.cpp @@ -22,7 +22,6 @@ * @brief */ -#include #include #include #include @@ -31,6 +30,7 @@ #include "JSAddressBookChangeCallbackManager.h" #include "ContactAsyncCallbackManager.h" #include "ContactQueue.h" +#include namespace DeviceAPI { namespace Contact { @@ -47,20 +47,20 @@ AddressBookController::AddressBookController(JSContextRef context, AddressBookPt EventAddressBookChangeListenerListener(ThreadEnum::NULL_THREAD), AddressBookPrivObject(context, addressBook) { - LogDebug("AddressBookController constructed : " << this); + LoggerD("AddressBookController constructed : " << this); if (!addressBook) { - LogWarning("controller has no addressBook object"); + LoggerW("controller has no addressBook object"); } } AddressBookController::~AddressBookController() { - LogDebug("AddressBookController destructed : " << this); + LoggerD("AddressBookController destructed : " << this); } void AddressBookAsyncAnswerHandler::addBatch(const EventAddressBookAddBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactQueueManagerSingleton::Instance().decreaseQueueList(); bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); if(!isEmpty){ @@ -70,14 +70,14 @@ void AddressBookAsyncAnswerHandler::addBatch(const EventAddressBookAddBatchPtr & JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -118,7 +118,7 @@ void AddressBookAsyncAnswerHandler::addBatch(const EventAddressBookAddBatchPtr & callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -128,7 +128,7 @@ void AddressBookAsyncAnswerHandler::addBatch(const EventAddressBookAddBatchPtr & void AddressBookAsyncAnswerHandler::updateBatch(const EventAddressBookUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactQueueManagerSingleton::Instance().decreaseQueueList(); bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); if(!isEmpty){ @@ -138,14 +138,14 @@ void AddressBookAsyncAnswerHandler::updateBatch(const EventAddressBookUpdateBatc JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -182,7 +182,7 @@ void AddressBookAsyncAnswerHandler::updateBatch(const EventAddressBookUpdateBatc void AddressBookAsyncAnswerHandler::removeBatch(const EventAddressBookRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactQueueManagerSingleton::Instance().decreaseQueueList(); bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); if(!isEmpty){ @@ -192,14 +192,14 @@ void AddressBookAsyncAnswerHandler::removeBatch(const EventAddressBookRemoveBatc JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -235,19 +235,19 @@ void AddressBookAsyncAnswerHandler::removeBatch(const EventAddressBookRemoveBatc void AddressBookAsyncAnswerHandler::find(const EventAddressBookFindPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -288,7 +288,7 @@ void AddressBookAsyncAnswerHandler::find(const EventAddressBookFindPtr &event) callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -298,13 +298,13 @@ void AddressBookAsyncAnswerHandler::find(const EventAddressBookFindPtr &event) void AddressBookAsyncAnswerHandler::changeListenerError(const EventAddressBookChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSValueRef errorObject; JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } @@ -320,19 +320,19 @@ void AddressBookAsyncAnswerHandler::changeListenerError(const EventAddressBookCh void AddressBookAsyncAnswerHandler::changeListenerContactAdded(const EventAddressBookChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSAddressBookChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoAddressBookChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoAddressBookChange::OnContactsAdded) { - LogError("wrong type"); + LoggerE("wrong type"); return; } @@ -340,7 +340,7 @@ void AddressBookAsyncAnswerHandler::changeListenerContactAdded(const EventAddres if (!eventInfo->getContactsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -351,7 +351,7 @@ void AddressBookAsyncAnswerHandler::changeListenerContactAdded(const EventAddres Try { contacts = converter->toJSValueRef(eventInfo->getContacts()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -360,19 +360,19 @@ void AddressBookAsyncAnswerHandler::changeListenerContactAdded(const EventAddres void AddressBookAsyncAnswerHandler::changeListenerContactUpdated(const EventAddressBookChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSAddressBookChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoAddressBookChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoAddressBookChange::OnContactsUpdated) { - LogError("wrong type"); + LoggerE("wrong type"); return; } @@ -380,7 +380,7 @@ void AddressBookAsyncAnswerHandler::changeListenerContactUpdated(const EventAddr if (!eventInfo->getContactsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -391,7 +391,7 @@ void AddressBookAsyncAnswerHandler::changeListenerContactUpdated(const EventAddr Try { contacts = converter->toJSValueRef(eventInfo->getContacts()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -400,26 +400,26 @@ void AddressBookAsyncAnswerHandler::changeListenerContactUpdated(const EventAddr void AddressBookAsyncAnswerHandler::changeListenerContactRemoved(const EventAddressBookChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSAddressBookChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoAddressBookChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoAddressBookChange::OnContactsRemoved) { - LogError("wrong type"); + LoggerE("wrong type"); return; } EventInfoAddressBookChangeRemovedPtr eventInfo = DPL::DynamicPointerCast(_eventInfo); if (!eventInfo->getContactIdsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -430,7 +430,7 @@ void AddressBookAsyncAnswerHandler::changeListenerContactRemoved(const EventAddr Try { contactIds = converter->toJSValueRef(eventInfo->getContactIds()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -462,7 +462,7 @@ void AddressBookController::onAnswerReceived(const EventAddressBookChangeListene EventInfoAddressBookChangePtr eventInfo = event->getEventInfo(); if(eventInfo == NULL) { - LogError("wrong type"); + LoggerE("wrong type"); return; } diff --git a/src/Contact/AddressBookController.h b/src/Contact/AddressBookController.h index 0499abc..7cbc8b7 100755 --- a/src/Contact/AddressBookController.h +++ b/src/Contact/AddressBookController.h @@ -25,7 +25,6 @@ #ifndef _TIZEN_CONTACT_ADDRESS_BOOK_CONTROLLER_H_ #define _TIZEN_CONTACT_ADDRESS_BOOK_CONTROLLER_H_ -#include #include #include #include diff --git a/src/Contact/Contact.cpp b/src/Contact/Contact.cpp old mode 100755 new mode 100644 index b4ade83..93e00f5 --- a/src/Contact/Contact.cpp +++ b/src/Contact/Contact.cpp @@ -23,13 +23,12 @@ */ #include "Contact.h" - -#include #include #include #include #include "ContactObjectA2PConverter.h" #include "ContactObjectP2AConverter.h" +#include namespace DeviceAPI { namespace Contact { @@ -42,7 +41,7 @@ Contact::Contact() , m_platformContactObject(NULL) , m_platformContactObjectList(NULL) { -// LogDebug("entered"); +// LoggerD("entered"); m_numbersJSObjIsSet = false; m_emailsJSObjIsSet = false; @@ -136,7 +135,7 @@ Contact::~Contact() string Contact::convertToString(const string &format) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; char *vcard_stream = NULL; @@ -166,7 +165,7 @@ string Contact::convertToString(const string &format) void Contact::setContactFromString(const std::string &vObjectStr) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; const char *vcard_stream = vObjectStr.c_str(); diff --git a/src/Contact/ContactConverter.cpp b/src/Contact/ContactConverter.cpp old mode 100755 new mode 100644 index e3e0f01..f70b76d --- a/src/Contact/ContactConverter.cpp +++ b/src/Contact/ContactConverter.cpp @@ -23,9 +23,7 @@ */ #include "ContactConverter.h" - #include -#include #include #include #include @@ -59,6 +57,7 @@ #include "JSContactWebSite.h" #include "JSContactWebSiteArray.h" #include "JSStringArray.h" +#include #define CONTACT_ATTRIBUTE_ACCOUNT_ID "accountId" #define CONTACT_ATTRIBUTE_ADDITIONAL_INFORMATION "additionalInformation" @@ -220,7 +219,7 @@ ContactPtr ContactConverter::toContact(const JSValueRef &jsValue) { if(!JSContact::isObjectOfClass(m_context, jsValue)) { - LogError("Not a Contact object"); + LoggerE("Not a Contact object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -314,17 +313,17 @@ ContactPtr ContactConverter::toContactFromInit(const JSValueRef &jsValue) // from ContactInit to Contact Validator validator(m_context); if (validator.isNullOrUndefined(jsValue)) { - LogError("ContactInit object is null"); + LoggerE("ContactInit object is null"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } if (!JSValueIsObject(m_context, jsValue) || JSIsArrayValue(m_context, jsValue)) { - LogError("ContactInit object is not object"); + LoggerE("ContactInit object is not object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } // if (!validator.checkArrayKeys(m_allowedContactInit, jsValue)) { -// LogError("invalid properties in ContactInit object"); +// LoggerE("invalid properties in ContactInit object"); // ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); // } @@ -490,7 +489,7 @@ PersonPtr ContactConverter::toPerson(const JSValueRef &jsValue) { if(!JSPerson::isObjectOfClass(m_context, jsValue)) { - LogError("Not a Person object"); + LoggerE("Not a Person object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -542,7 +541,7 @@ ContactGroupPtr ContactConverter::toContactGroup(const JSValueRef &jsValue) { if(!JSContactGroup::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactGroup object"); + LoggerE("Not a ContactGroup object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -591,7 +590,7 @@ ContactRefPtr ContactConverter::toContactRef(const JSValueRef &jsValue) { if(!JSContactRef::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactRef object"); + LoggerE("Not a ContactRef object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -607,7 +606,7 @@ ContactNamePtr ContactConverter::toContactName(const JSValueRef &jsValue) { if(!JSContactName::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactName object"); + LoggerE("Not a ContactName object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -619,17 +618,17 @@ ContactNamePtr ContactConverter::toContactNameFromInit(const JSValueRef &jsValue // from ContactNameInit to ContactName Validator validator(m_context); if (validator.isNullOrUndefined(jsValue)) { - LogError("ContactNameInit object is null"); + LoggerE("ContactNameInit object is null"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } if (!JSValueIsObject(m_context, jsValue) || JSIsArrayValue(m_context, jsValue)) { - LogError("ContactNameInit object is not object"); + LoggerE("ContactNameInit object is not object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } // if (!validator.checkArrayKeys(m_allowedContactNameInit, jsValue)) { -// LogError("invalid properties in ContactNameInit object"); +// LoggerE("invalid properties in ContactNameInit object"); // ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); // } @@ -733,7 +732,7 @@ ContactOrganizationPtr ContactConverter::toContactOrganization(const JSValueRef { if(!JSContactOrganization::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactOrganization object"); + LoggerE("Not a ContactOrganization object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -745,17 +744,17 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV // from ContactOrganizationInit to ContactOrganization Validator validator(m_context); if (validator.isNullOrUndefined(jsValue)) { - LogError("ContactOrganizationInit object is null"); + LoggerE("ContactOrganizationInit object is null"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } if (!JSValueIsObject(m_context, jsValue) || JSIsArrayValue(m_context, jsValue)) { - LogError("ContactOrganizationInit object is not object"); + LoggerE("ContactOrganizationInit object is not object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } // if (!validator.checkArrayKeys(m_allowedContactOrganizationInit, jsValue)) { -// LogError("invalid properties in ContactOrganizationInit object"); +// LoggerE("invalid properties in ContactOrganizationInit object"); // ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); // } @@ -868,7 +867,7 @@ ContactWebSitePtr ContactConverter::toContactWebSite(const JSValueRef &jsValue) { if(!JSContactWebSite::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactWebSite object"); + LoggerE("Not a ContactWebSite object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -920,7 +919,7 @@ ContactAnniversaryPtr ContactConverter::toContactAnniversary(const JSValueRef &j { if(!JSContactAnniversary::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactAnniversary object"); + LoggerE("Not a ContactAnniversary object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -969,7 +968,7 @@ ContactAddressPtr ContactConverter::toContactAddress(const JSValueRef &jsValue) { if(!JSContactAddress::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactAddress object"); + LoggerE("Not a ContactAddress object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -981,17 +980,17 @@ ContactAddressPtr ContactConverter::toContactAddressFromInit(const JSValueRef &j // from ContactAddressInit to ContactAddress Validator validator(m_context); if (validator.isNullOrUndefined(jsValue)) { - LogError("ContactAddressInit object is null"); + LoggerE("ContactAddressInit object is null"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } if (!JSValueIsObject(m_context, jsValue) || JSIsArrayValue(m_context, jsValue)) { - LogError("ContactAddressInit object is not object"); + LoggerE("ContactAddressInit object is not object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } // if (!validator.checkArrayKeys(m_allowedContactAddressInit, jsValue)) { -// LogError("invalid properties in ContactAddressInit object"); +// LoggerE("invalid properties in ContactAddressInit object"); // ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); // } @@ -1133,7 +1132,7 @@ ContactPhoneNumberPtr ContactConverter::toContactPhoneNumber(const JSValueRef &j { if(!JSContactPhoneNumber::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactPhoneNumber object"); + LoggerE("Not a ContactPhoneNumber object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } @@ -1182,7 +1181,7 @@ ContactEmailAddressPtr ContactConverter::toContactEmailAddress(const JSValueRef { if(!JSContactEmailAddress::isObjectOfClass(m_context, jsValue)) { - LogError("Not a ContactEmailAddress object"); + LoggerE("Not a ContactEmailAddress object"); ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } diff --git a/src/Contact/ContactFilterConverter.cpp b/src/Contact/ContactFilterConverter.cpp index 82ed8db..95757e9 100644 --- a/src/Contact/ContactFilterConverter.cpp +++ b/src/Contact/ContactFilterConverter.cpp @@ -23,8 +23,7 @@ */ #include "ContactFilterConverter.h" - -#include +#include namespace DeviceAPI { namespace Contact { @@ -100,7 +99,7 @@ ContactFilterConverter::ContactFilterConverter(JSContextRef context) : ContactFilterConverter::~ContactFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } PersonFilterConverter::PersonFilterConverter(JSContextRef context) : @@ -110,7 +109,7 @@ PersonFilterConverter::PersonFilterConverter(JSContextRef context) : PersonFilterConverter::~PersonFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } } // Contact diff --git a/src/Contact/ContactListenerManager.h b/src/Contact/ContactListenerManager.h old mode 100755 new mode 100644 index 7ad069c..62883a9 --- a/src/Contact/ContactListenerManager.h +++ b/src/Contact/ContactListenerManager.h @@ -27,12 +27,12 @@ #include #include -#include #include #include #include #include "AddressBookController.h" #include "ContactManagerController.h" +#include namespace DeviceAPI { namespace Contact { @@ -70,7 +70,7 @@ public: controller = static_cast(JSObjectGetPrivate(m_object)); if (!controller) { - LogWarning("Object has no controller"); + LoggerW("Object has no controller"); return; } addressBook = controller->getObject(); @@ -81,10 +81,10 @@ public: dplEvent->setForSynchronousCall(); Try { - LogDebug("Remove change listener"); + LoggerD("Remove change listener"); addressBook->removeChangeListener(dplEvent); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; @@ -109,7 +109,7 @@ public: controller = static_cast(JSObjectGetPrivate(m_object)); if (!controller) { - LogWarning("Object has no controller"); + LoggerW("Object has no controller"); return; } addressBook = controller->getObject(); @@ -120,10 +120,10 @@ public: dplEvent->setForSynchronousCall(); Try { - LogDebug("Remove change listener"); + LoggerD("Remove change listener"); addressBook->removeChangeListener(dplEvent); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Contact/ContactManager.cpp b/src/Contact/ContactManager.cpp old mode 100755 new mode 100644 index e6dcbdf..49ee116 --- a/src/Contact/ContactManager.cpp +++ b/src/Contact/ContactManager.cpp @@ -23,10 +23,8 @@ */ #include "ContactManager.h" - #include #include -#include #include #include "ContactFactory.h" #include "IAddressBook.h" @@ -37,6 +35,7 @@ #include "PersonSearchEngine.h" #include "Person.h" #include "ContactQueue.h" +#include namespace DeviceAPI { namespace Contact { @@ -60,7 +59,7 @@ ContactManager::~ContactManager() void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBookPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -81,7 +80,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBookPt Catch(PlatformException) { //when database is not opened then set result as failed - LogError("Contact DB not opened : " << _rethrown_exception.GetMessage()); + LoggerE("Contact DB not opened : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -89,13 +88,13 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBookPt Catch(NotFoundException) { //when database is not opened then set result as failed - LogError("Not found : " << _rethrown_exception.GetMessage()); + LoggerE("Not found : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogError("Unknown exception : " << _rethrown_exception.GetMessage()); + LoggerE("Unknown exception : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); return; @@ -104,7 +103,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBookPt void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBooksPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -118,14 +117,14 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBooksP Catch (PlatformException) { //when database is not opened then set result as failed - LogError("Contact DB is not opened."); + LoggerE("Contact DB is not opened."); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Unknown exception : " << _rethrown_exception.GetMessage()); + LoggerE("Unknown exception : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); return; @@ -134,7 +133,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetAddressBooksP void ContactManager::OnRequestReceived(const EventContactManagerGetDefaultAddressBookPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -148,14 +147,14 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetDefaultAddres Catch (PlatformException) { //when database is not opened then set result as failed - LogError("Contact DB is not opened."); + LoggerE("Contact DB is not opened."); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Unknown exception : " << _rethrown_exception.GetMessage()); + LoggerE("Unknown exception : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); return; @@ -164,7 +163,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetDefaultAddres void ContactManager::OnRequestReceived(const EventContactManagerGetUnifiedAddressBookPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -178,14 +177,14 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetUnifiedAddres Catch (PlatformException) { //when database is not opened then set result as failed - LogError("Contact DB is not opened."); + LoggerE("Contact DB is not opened."); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Unknown exception : " << _rethrown_exception.GetMessage()); + LoggerE("Unknown exception : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::UnknownException); return; @@ -194,7 +193,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetUnifiedAddres void ContactManager::OnRequestReceived(const EventContactManagerGetPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_record_h contacts_record = NULL; @@ -220,22 +219,22 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetPtr &event) event->setResult(true); } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during getting person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during getting person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -246,7 +245,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerGetPtr &event) void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; @@ -265,7 +264,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event ThrowMsg(InvalidArgumentException, "Person object is wrong"); } Catch(InvalidArgumentException) { - LogError("Invalid arguments for updating persons : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for updating persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -274,12 +273,12 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event Try { int id = ContactUtility::strToInt(person->getId()); - LogDebug("Load platform object id : " << id); + LoggerD("Load platform object id : " << id); errorCode = contacts_db_get_record(_contacts_person._uri, id, &contacts_record); if (errorCode == CONTACTS_ERROR_INVALID_PARAMETER) ThrowMsg(NotFoundException, "Error during executing contacts_db_get_record()"); else if (errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_get_record()"); } @@ -289,7 +288,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event if (errorCode == CONTACTS_ERROR_INVALID_PARAMETER) ThrowMsg(NotFoundException, "Error during executing contacts_db_update_record()"); else if (errorCode != CONTACTS_ERROR_NONE) { - LogError("error code : " << errorCode); + LoggerE("error code : " << errorCode); ThrowMsg(PlatformException, "Error during executing contacts_db_update_record()"); } @@ -298,17 +297,17 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch (PlatformException) { - LogError("Error during updating person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } Catch (Exception) { - LogError("Error during display_contact_id person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during display_contact_id person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -321,7 +320,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdatePtr &event void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_list_h contacts_list = NULL; PersonArrayPtr persons(NULL); @@ -343,7 +342,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid arguments for updating persons : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for updating persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -364,7 +363,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr Try { - LogDebug("id : " << person->getId()); + LoggerD("id : " << person->getId()); int personIdInt = ContactUtility::strToInt(person->getId()); errorCode = contacts_db_get_record(_contacts_person._uri, personIdInt, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) @@ -383,7 +382,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr Catch(Exception) { ThrowMsg(NotFoundException, "Error during converting contact object"); -// LogError("Error during converting person object : " << _rethrown_exception.GetMessage()); +// LoggerE("Error during converting person object : " << _rethrown_exception.GetMessage()); // continue; } } @@ -420,7 +419,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } @@ -431,7 +430,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during updating persons : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -442,7 +441,7 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during updating persons : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -453,12 +452,12 @@ void ContactManager::managerUpdateBatch(const EventContactManagerUpdateBatchPtr void ContactManager::OnRequestReceived(const EventContactManagerUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); - LogDebug("isEmpty : " << isEmpty); + LoggerD("isEmpty : " << isEmpty); if(isEmpty){ managerUpdateBatch(event); }else{ @@ -469,7 +468,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdateBatchPtr & } Catch (Exception) { - LogError("Error during updating persons : " << _rethrown_exception.GetMessage()); + LoggerE("Error during updating persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -477,7 +476,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerUpdateBatchPtr & void ContactManager::OnRequestReceived(const EventContactManagerRemovePtr &event) { - LogDebug("entered"); + LoggerD("entered"); int personId; Try @@ -508,26 +507,26 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemovePtr &event } Catch (InvalidArgumentException) { - LogError("Invalid person id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid person id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; } Catch (PlatformException) { - LogError("Error during removing person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Error during removing person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -536,7 +535,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemovePtr &event void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; StringArrayPtr personIds(NULL); @@ -557,7 +556,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid arguments for removing persons : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid arguments for removing persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -600,7 +599,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr Catch(Exception) { ThrowMsg(NotFoundException, "Error during converting person object"); -// LogError("Error during converting person object : " << _rethrown_exception.GetMessage()); +// LoggerE("Error during converting person object : " << _rethrown_exception.GetMessage()); // continue; } } @@ -635,7 +634,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Invalid person id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid person id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; @@ -647,7 +646,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; @@ -659,7 +658,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during removing persons : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -671,7 +670,7 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr if(!isEmpty){ ContactQueueManagerSingleton::Instance().pop(); } - LogError("Error during removing persons : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removing persons : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -680,12 +679,12 @@ void ContactManager::managerRemoveBatch(const EventContactManagerRemoveBatchPtr void ContactManager::OnRequestReceived(const EventContactManagerRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); - LogDebug("isEmpty : " << isEmpty); + LoggerD("isEmpty : " << isEmpty); if(isEmpty){ managerRemoveBatch(event); }else{ @@ -696,7 +695,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemoveBatchPtr & } Catch (Exception) { - LogError("Error during deleting contacts : " << _rethrown_exception.GetMessage()); + LoggerE("Error during deleting contacts : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -704,7 +703,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemoveBatchPtr & void ContactManager::OnRequestReceived(const EventContactManagerFindPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { PersonSearchEnginePtr searchEngine(new PersonSearchEngine()); @@ -731,22 +730,22 @@ void ContactManager::OnRequestReceived(const EventContactManagerFindPtr &event) event->setResult(true); } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during finding person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during finding person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during finding person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during finding person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -754,7 +753,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerFindPtr &event) void ContactManager::OnRequestReceived(const EventContactManagerAddChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { if(!event->getEmitterIsSet()) @@ -766,7 +765,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerAddChangeListene if(m_contactManagerEmitters.size() == 0) { - LogDebug("Watch registered initially"); + LoggerD("Watch registered initially"); ContactsSvcChangeListenerManagerSingleton::Instance().registerPersonsChangeListener(this); } @@ -780,22 +779,22 @@ void ContactManager::OnRequestReceived(const EventContactManagerAddChangeListene event->setResult(true); } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during addListner person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during addListner person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during addListner person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during addListner person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -803,7 +802,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerAddChangeListene void ContactManager::OnRequestReceived(const EventContactManagerRemoveChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { if(!event->getIdIsSet()) @@ -822,7 +821,7 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemoveChangeList if(m_contactManagerEmitters.size() == 0) { - LogDebug("No watcher is registered. unsubscribing from person service."); + LoggerD("No watcher is registered. unsubscribing from person service."); ContactsSvcChangeListenerManagerSingleton::Instance().unregisterPersonsChangeListener(this); } @@ -830,22 +829,22 @@ void ContactManager::OnRequestReceived(const EventContactManagerRemoveChangeList event->setResult(true); } Catch (NotFoundException) { - LogError("WatchId doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("WatchId doesn't exist : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch (PlatformException) { - LogError("Error during removeListner person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removeListner person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch (InvalidArgumentException) { - LogError("Invalid Arguments : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid Arguments : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch (Exception) { - LogError("Error during removeListner person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during removeListner person : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } @@ -880,11 +879,11 @@ void ContactManager::onContactsSvcPersonsRemoved(StringArrayPtr &personIds) void ContactManager::personsUpdateBatchResultCallback(int error, void *user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogError("user_data is NULL"); + LoggerE("user_data is NULL"); return; } @@ -906,7 +905,7 @@ void ContactManager::personsUpdateBatchResultCallback(int error, long key) iter = m_updateBatchEventMap.find(key); if(iter == m_updateBatchEventMap.end()) { - LogError("No event for key : " << key); + LoggerE("No event for key : " << key); return; } @@ -915,7 +914,7 @@ void ContactManager::personsUpdateBatchResultCallback(int error, long key) if(error != CONTACTS_ERROR_NONE) { - LogError("persons_db_result_cb gives error : " << error); + LoggerE("persons_db_result_cb gives error : " << error); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); EventRequestReceiver::ManualAnswer(event); @@ -929,11 +928,11 @@ void ContactManager::personsUpdateBatchResultCallback(int error, long key) void ContactManager::personsRemoveBatchResultCallback(int error, void *user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogError("user_data is NULL"); + LoggerE("user_data is NULL"); return; } @@ -955,7 +954,7 @@ void ContactManager::personsRemoveBatchResultCallback(int error, long key) iter = m_removeBatchEventMap.find(key); if(iter == m_removeBatchEventMap.end()) { - LogError("No event for key : " << key); + LoggerE("No event for key : " << key); return; } @@ -964,7 +963,7 @@ void ContactManager::personsRemoveBatchResultCallback(int error, long key) if(error != CONTACTS_ERROR_NONE) { - LogError("persons_db_result_cb gives error : " << error); + LoggerE("persons_db_result_cb gives error : " << error); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); EventRequestReceiver::ManualAnswer(event); diff --git a/src/Contact/ContactManagerController.cpp b/src/Contact/ContactManagerController.cpp old mode 100755 new mode 100644 index 533daab..36b7b31 --- a/src/Contact/ContactManagerController.cpp +++ b/src/Contact/ContactManagerController.cpp @@ -22,7 +22,6 @@ * @brief */ -#include #include #include #include @@ -31,6 +30,7 @@ #include "ContactAsyncCallbackManager.h" #include "JSContactManagerChangeCallbackManager.h" #include "ContactQueue.h" +#include namespace DeviceAPI { namespace Contact { @@ -47,28 +47,28 @@ ContactManagerController::ContactManagerController(JSContextRef context, Contact EventContactManagerChangeListenerListener(ThreadEnum::NULL_THREAD), ContactManagerPrivObject(context, contactManager) { - LogDebug("ContactManagerController constructed : " << this); + LoggerD("ContactManagerController constructed : " << this); } ContactManagerController::~ContactManagerController() { - LogDebug("ContactManagerController destructed : " << this); + LoggerD("ContactManagerController destructed : " << this); } void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManagerGetAddressBooksPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -109,7 +109,7 @@ void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManager callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -119,7 +119,7 @@ void ContactManagerAsyncAnswerHandler::getAddressBooks(const EventContactManager void ContactManagerAsyncAnswerHandler::updateBatch(const EventContactManagerUpdateBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactQueueManagerSingleton::Instance().decreaseQueueList(); bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); @@ -130,14 +130,14 @@ void ContactManagerAsyncAnswerHandler::updateBatch(const EventContactManagerUpda JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -174,7 +174,7 @@ void ContactManagerAsyncAnswerHandler::updateBatch(const EventContactManagerUpda void ContactManagerAsyncAnswerHandler::removeBatch(const EventContactManagerRemoveBatchPtr &event) { - LogDebug("entered"); + LoggerD("entered"); ContactQueueManagerSingleton::Instance().decreaseQueueList(); bool isEmpty = ContactQueueManagerSingleton::Instance().empty(); if(!isEmpty){ @@ -184,14 +184,14 @@ void ContactManagerAsyncAnswerHandler::removeBatch(const EventContactManagerRemo JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -227,19 +227,19 @@ void ContactManagerAsyncAnswerHandler::removeBatch(const EventContactManagerRemo void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } ContactAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); if(event->checkCancelled()) { - LogDebug("Operation cancelled"); + LoggerD("Operation cancelled"); return; } @@ -280,7 +280,7 @@ void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &ev callbackManager->callOnSuccess(result); return; } Catch(Exception) { - LogError("error during processing answer" << _rethrown_exception.GetMessage()); + LoggerE("error during processing answer" << _rethrown_exception.GetMessage()); error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Internal error"); callbackManager->callOnError(error); @@ -290,13 +290,13 @@ void ContactManagerAsyncAnswerHandler::find(const EventContactManagerFindPtr &ev void ContactManagerAsyncAnswerHandler::changeListenerError(const EventContactManagerChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSValueRef errorObject; JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } @@ -312,19 +312,19 @@ void ContactManagerAsyncAnswerHandler::changeListenerError(const EventContactMan void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventContactManagerChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSContactManagerChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoContactManagerChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoContactManagerChange::OnPersonsAdded) { - LogError("wrong type"); + LoggerE("wrong type"); return; } @@ -332,7 +332,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventCont if (!eventInfo->getPersonsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -343,7 +343,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventCont Try { contacts = converter->toJSValueRef(eventInfo->getPersons()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -352,19 +352,19 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonAdded(const EventCont void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventContactManagerChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSContactManagerChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoContactManagerChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoContactManagerChange::OnPersonsUpdated) { - LogError("wrong type"); + LoggerE("wrong type"); return; } @@ -372,7 +372,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventCo if (!eventInfo->getPersonsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -383,7 +383,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventCo Try { contacts = converter->toJSValueRef(eventInfo->getPersons()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -392,26 +392,26 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonUpdated(const EventCo void ContactManagerAsyncAnswerHandler::changeListenerPersonRemoved(const EventContactManagerChangeListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSContactManagerChangeCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } EventInfoContactManagerChangePtr _eventInfo = event->getEventInfo(); if(_eventInfo->getCallbackType() != EventInfoContactManagerChange::OnPersonsRemoved) { - LogError("wrong type"); + LoggerE("wrong type"); return; } EventInfoContactManagerChangeRemovedPtr eventInfo = DPL::DynamicPointerCast(_eventInfo); if (!eventInfo->getPersonIdsIsSet()) { - LogError("no data set"); + LoggerE("no data set"); return; } @@ -422,7 +422,7 @@ void ContactManagerAsyncAnswerHandler::changeListenerPersonRemoved(const EventCo Try { contactIds = converter->toJSValueRef(eventInfo->getPersonIds()); } Catch (Exception) { - LogError("Conversion error"); + LoggerE("Conversion error"); return; } @@ -454,7 +454,7 @@ void ContactManagerController::onAnswerReceived(const EventContactManagerChangeL EventInfoContactManagerChangePtr eventInfo = event->getEventInfo(); if(eventInfo == NULL) { - LogError("wrong type"); + LoggerE("wrong type"); return; } diff --git a/src/Contact/ContactObjectA2PConverter.cpp b/src/Contact/ContactObjectA2PConverter.cpp old mode 100755 new mode 100644 index eabf02f..f10256b --- a/src/Contact/ContactObjectA2PConverter.cpp +++ b/src/Contact/ContactObjectA2PConverter.cpp @@ -26,6 +26,7 @@ #include #include "ContactUtility.h" +#include namespace DeviceAPI { namespace Contact { @@ -68,13 +69,13 @@ ContactObjectA2PConverter::~ContactObjectA2PConverter() contacts_record_h ContactObjectA2PConverter::getPlatformContact() { - LogDebug("enter"); + LoggerD("enter"); int errorCode = 0; if(m_abstractContact == NULL) { - LogError("Abstract contact object did not set"); + LoggerE("Abstract contact object did not set"); ThrowMsg(InvalidArgumentException, "Abstract contact object did not set"); } @@ -83,14 +84,14 @@ contacts_record_h ContactObjectA2PConverter::getPlatformContact() if(m_abstractContact->getIdIsSet() && (m_forScratch == false)) { int id = ContactUtility::strToInt(m_abstractContact->getId()); - LogDebug("Load platform object id : " << id); + LoggerD("Load platform object id : " << id); errorCode = contacts_db_get_record(_contacts_contact._uri, id, &m_platformContact); if(errorCode != CONTACTS_ERROR_NONE) ThrowMsg(UnknownException, "error on contacts_db_get_record (errorCode:" << errorCode << ")"); } else { - LogDebug("New platform object has been created"); + LoggerD("New platform object has been created"); errorCode = contacts_record_create(_contacts_contact._uri, &m_platformContact); if(errorCode != CONTACTS_ERROR_NONE) ThrowMsg(UnknownException, "error on contacts_record_create (errorCode:" << errorCode << ")"); @@ -99,7 +100,7 @@ contacts_record_h ContactObjectA2PConverter::getPlatformContact() m_platformContactOwnership = true; } - LogDebug("for scratch : " << m_forScratch); + LoggerD("for scratch : " << m_forScratch); Try { @@ -108,7 +109,7 @@ contacts_record_h ContactObjectA2PConverter::getPlatformContact() } Catch(Exception) { - LogError("Error while converting - " << _rethrown_exception.GetMessage()); + LoggerE("Error while converting - " << _rethrown_exception.GetMessage()); ThrowMsg(PlatformException, "Fail to convert abstract object to platform object."); } @@ -155,7 +156,7 @@ void ContactObjectA2PConverter::importBaseInfoValue() errorCode = contacts_record_get_child_record_at_p(m_platformContact, _contacts_contact.image, 0, &child_record); if(errorCode != CONTACTS_ERROR_NONE || child_record == NULL) { - LogDebug("Fail to get contacts_record_get_child_record_at_p : " << errorCode); + LoggerD("Fail to get contacts_record_get_child_record_at_p : " << errorCode); errorCode = contacts_record_create(_contacts_image._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) ThrowMsg(UnknownException, "creating name value B (errorCode:" << errorCode << ")"); @@ -177,7 +178,7 @@ void ContactObjectA2PConverter::importBaseInfoValue() if(newValueStr != NULL) { - LogDebug("image : " << newValueStr); + LoggerD("image : " << newValueStr); errorCode = contacts_record_set_str(child_record, _contacts_image.path, newValueStr); if(errorCode != CONTACTS_ERROR_NONE) { @@ -241,7 +242,7 @@ void ContactObjectA2PConverter::importNameValue() errorCode = contacts_record_get_child_record_at_p(m_platformContact, _contacts_contact.name, 0, &child_record); if(errorCode != CONTACTS_ERROR_NONE || child_record == NULL) { - LogDebug("Fail to get contacts_record_get_child_record_at_p : " << errorCode); + LoggerD("Fail to get contacts_record_get_child_record_at_p : " << errorCode); errorCode = contacts_record_create(_contacts_name._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) ThrowMsg(UnknownException, "creating name value B (errorCode:" << errorCode << ")"); @@ -594,7 +595,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_create(_contacts_company._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_company._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_company._uri)"); continue; } @@ -607,7 +608,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_set_str(child_record, _contacts_company.name, name.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing company name N (err:" << errorCode << ", str:" << name << ")"); + LoggerW("importing company name N (err:" << errorCode << ", str:" << name << ")"); contacts_record_destroy(child_record, true); continue; } @@ -623,7 +624,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_set_str(child_record, _contacts_company.department, department.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing department N (err:" << errorCode << ", str:" << department << ")"); + LoggerW("importing department N (err:" << errorCode << ", str:" << department << ")"); contacts_record_destroy(child_record, true); continue; } @@ -639,7 +640,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_set_str(child_record, _contacts_company.job_title, title.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing title N (err:" << errorCode << ", str:" << title << ")"); + LoggerW("importing title N (err:" << errorCode << ", str:" << title << ")"); contacts_record_destroy(child_record, true); continue; } @@ -655,7 +656,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_set_str(child_record, _contacts_company.role, role.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing role N (err:" << errorCode << ", str:" << role << ")"); + LoggerW("importing role N (err:" << errorCode << ", str:" << role << ")"); contacts_record_destroy(child_record, true); continue; } @@ -672,7 +673,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_set_str(child_record, _contacts_company.logo, logoURI.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing logoURI N (err:" << errorCode << ", str:" << logoURI << ")"); + LoggerW("importing logoURI N (err:" << errorCode << ", str:" << logoURI << ")"); contacts_record_destroy(child_record, true); continue; } @@ -682,7 +683,7 @@ void ContactObjectA2PConverter::importCompanyList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.company, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set company value to child_record"); + LoggerW("Fail to set company value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -733,14 +734,14 @@ void ContactObjectA2PConverter::importNoteList() errorCode = contacts_record_create(_contacts_note._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_note._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_note._uri)"); continue; } errorCode = contacts_record_set_str(child_record, _contacts_note.note, note.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing note N (err:" << errorCode << ", str:" << note << ")"); + LoggerW("importing note N (err:" << errorCode << ", str:" << note << ")"); contacts_record_destroy(child_record, true); continue; } @@ -748,7 +749,7 @@ void ContactObjectA2PConverter::importNoteList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.note, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set note value to child_record"); + LoggerW("Fail to set note value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -792,7 +793,7 @@ void ContactObjectA2PConverter::importNumberList() if(!phoneNumber->getNumberIsSet() || phoneNumber->getNumber().empty()) { - LogDebug("Number was not set."); + LoggerD("Number was not set."); continue; } @@ -842,14 +843,14 @@ void ContactObjectA2PConverter::importNumberList() errorCode = contacts_record_create(_contacts_number._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_number._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_number._uri)"); continue; } errorCode = contacts_record_set_str(child_record, _contacts_number.number, number.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set number value to child_record number : " << number); + LoggerW("Fail to set number value to child_record number : " << number); contacts_record_destroy(child_record, true); continue; } @@ -857,7 +858,7 @@ void ContactObjectA2PConverter::importNumberList() errorCode = contacts_record_set_bool(child_record, _contacts_number.is_default, ctsBoolDefault); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set number value to child_record default : " << ctsBoolDefault); + LoggerW("Fail to set number value to child_record default : " << ctsBoolDefault); contacts_record_destroy(child_record, true); continue; } @@ -865,7 +866,7 @@ void ContactObjectA2PConverter::importNumberList() errorCode = contacts_record_set_int(child_record, _contacts_number.type, ctsIntType); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set number value to child_record type : " << ctsIntType); + LoggerW("Fail to set number value to child_record type : " << ctsIntType); contacts_record_destroy(child_record, true); continue; } @@ -875,7 +876,7 @@ void ContactObjectA2PConverter::importNumberList() // errorCode = contacts_record_set_str(child_record, _contacts_number.label, ctsStrCustomType); // if(errorCode != CONTACTS_ERROR_NONE) // { - // LogWarning("Fail to set number value to child_record custom type : " << ctsStrCustomType); + // LoggerW("Fail to set number value to child_record custom type : " << ctsStrCustomType); // contacts_record_destroy(child_record, true); // continue; // } @@ -884,7 +885,7 @@ void ContactObjectA2PConverter::importNumberList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.number, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set number value to child_record"); + LoggerW("Fail to set number value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -928,7 +929,7 @@ void ContactObjectA2PConverter::importEmailList() if(!email->getEmailIsSet() || email->getEmail().empty()) { - LogDebug("email address was not set."); + LoggerD("email address was not set."); continue; } @@ -956,14 +957,14 @@ void ContactObjectA2PConverter::importEmailList() errorCode = contacts_record_create(_contacts_email._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_email._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_email._uri)"); continue; } errorCode = contacts_record_set_str(child_record, _contacts_email.email, emailAddress.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set email value to child_record email : " << emailAddress); + LoggerW("Fail to set email value to child_record email : " << emailAddress); contacts_record_destroy(child_record, true); continue; } @@ -971,7 +972,7 @@ void ContactObjectA2PConverter::importEmailList() errorCode = contacts_record_set_bool(child_record, _contacts_email.is_default, ctsBoolDefault); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set email value to child_record default : " << ctsBoolDefault); + LoggerW("Fail to set email value to child_record default : " << ctsBoolDefault); contacts_record_destroy(child_record, true); continue; } @@ -979,7 +980,7 @@ void ContactObjectA2PConverter::importEmailList() errorCode = contacts_record_set_int(child_record, _contacts_email.type, ctsIntType); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set email value to child_record type : " << ctsIntType); + LoggerW("Fail to set email value to child_record type : " << ctsIntType); contacts_record_destroy(child_record, true); continue; } @@ -989,7 +990,7 @@ void ContactObjectA2PConverter::importEmailList() // errorCode = contacts_record_set_str(child_record, _contacts_email.label, ctsStrCustomType); // if(errorCode != CONTACTS_ERROR_NONE) // { - // LogWarning("Fail to set email value to child_record custom type : " << ctsStrCustomType); + // LoggerW("Fail to set email value to child_record custom type : " << ctsStrCustomType); // contacts_record_destroy(child_record, true); // continue; // } @@ -998,7 +999,7 @@ void ContactObjectA2PConverter::importEmailList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.email, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set email value to child_record"); + LoggerW("Fail to set email value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -1043,7 +1044,7 @@ void ContactObjectA2PConverter::importGrouprelList() if(!ContactUtility::checkStrIsUInt(groupId)) { - LogWarning("groupId (" << groupId << ") is wrong."); + LoggerW("groupId (" << groupId << ") is wrong."); continue; } @@ -1052,14 +1053,14 @@ void ContactObjectA2PConverter::importGrouprelList() errorCode = contacts_record_create(_contacts_group_relation._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_group_relation._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_group_relation._uri)"); continue; } errorCode = contacts_record_set_int(child_record, _contacts_group_relation.group_id, groupIdInt); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing group id N (err:" << errorCode << ", str:" << groupIdInt << ")"); + LoggerW("importing group id N (err:" << errorCode << ", str:" << groupIdInt << ")"); contacts_record_destroy(child_record, true); continue; } @@ -1068,7 +1069,7 @@ void ContactObjectA2PConverter::importGrouprelList() errorCode = contacts_record_set_int(child_record, _contacts_group_relation.contact_id, contactId); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("importing group contact_id N (err:" << errorCode << ", str:" << contactId << ")"); + LoggerW("importing group contact_id N (err:" << errorCode << ", str:" << contactId << ")"); contacts_record_destroy(child_record, true); continue; } @@ -1076,7 +1077,7 @@ void ContactObjectA2PConverter::importGrouprelList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.group_relation, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set group value to child_record"); + LoggerW("Fail to set group value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -1135,14 +1136,14 @@ void ContactObjectA2PConverter::importEventListBirthday() errorCode = contacts_record_create(_contacts_event._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_event._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_event._uri)"); return; } errorCode = contacts_record_set_int(child_record, _contacts_event.type, CONTACTS_EVENT_TYPE_BIRTH); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record type : " << CONTACTS_EVENT_TYPE_BIRTH); + LoggerW("Fail to set event value to child_record type : " << CONTACTS_EVENT_TYPE_BIRTH); contacts_record_destroy(child_record, true); return; } @@ -1150,7 +1151,7 @@ void ContactObjectA2PConverter::importEventListBirthday() errorCode = contacts_record_set_int(child_record, _contacts_event.date, birthday); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record date : " << birthday); + LoggerW("Fail to set event value to child_record date : " << birthday); contacts_record_destroy(child_record, true); return; } @@ -1158,7 +1159,7 @@ void ContactObjectA2PConverter::importEventListBirthday() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.event, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record"); + LoggerW("Fail to set event value to child_record"); contacts_record_destroy(child_record, true); return; } @@ -1194,14 +1195,14 @@ void ContactObjectA2PConverter::importEventListAnniversary() errorCode = contacts_record_create(_contacts_event._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_event._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_event._uri)"); continue; } errorCode = contacts_record_set_int(child_record, _contacts_event.type, CONTACTS_EVENT_TYPE_ANNIVERSARY); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record type : CONTACTS_EVENT_TYPE_ANNIVERSARY"); + LoggerW("Fail to set event value to child_record type : CONTACTS_EVENT_TYPE_ANNIVERSARY"); contacts_record_destroy(child_record, true); continue; } @@ -1209,7 +1210,7 @@ void ContactObjectA2PConverter::importEventListAnniversary() errorCode = contacts_record_set_int(child_record, _contacts_event.date, date); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record date : " << date); + LoggerW("Fail to set event value to child_record date : " << date); contacts_record_destroy(child_record, true); continue; } @@ -1220,7 +1221,7 @@ void ContactObjectA2PConverter::importEventListAnniversary() errorCode = contacts_record_set_str(child_record, _contacts_event.label, label.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set label value to child_record label : " << label); + LoggerW("Fail to set label value to child_record label : " << label); contacts_record_destroy(child_record, true); continue; } @@ -1230,7 +1231,7 @@ void ContactObjectA2PConverter::importEventListAnniversary() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.event, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set event value to child_record"); + LoggerW("Fail to set event value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -1280,7 +1281,7 @@ void ContactObjectA2PConverter::importPostalList() ( !address->getAdditionalInformationIsSet() || address->getAdditionalInformation().empty() ) && ( !address->getPostalCodeIsSet() || address->getPostalCode().empty() ) ) { - LogDebug("No information for address was not set."); + LoggerD("No information for address was not set."); continue; } @@ -1306,7 +1307,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_create(_contacts_address._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_address._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_address._uri)"); continue; } @@ -1316,7 +1317,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.country, country.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set country value to child_record str : " << country); + LoggerW("Fail to set country value to child_record str : " << country); contacts_record_destroy(child_record, true); continue; } @@ -1328,7 +1329,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.region, region.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set region value to child_record str : " << region); + LoggerW("Fail to set region value to child_record str : " << region); contacts_record_destroy(child_record, true); continue; } @@ -1340,7 +1341,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.locality, city.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set locality value to child_record str : " << city); + LoggerW("Fail to set locality value to child_record str : " << city); contacts_record_destroy(child_record, true); continue; } @@ -1352,7 +1353,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.street, streetAddress.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set street value to child_record str : " << streetAddress); + LoggerW("Fail to set street value to child_record str : " << streetAddress); contacts_record_destroy(child_record, true); continue; } @@ -1364,7 +1365,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.extended, additionalInformation.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set extended value to child_record str : " << additionalInformation); + LoggerW("Fail to set extended value to child_record str : " << additionalInformation); contacts_record_destroy(child_record, true); continue; } @@ -1376,7 +1377,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_str(child_record, _contacts_address.postal_code, postalCode.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set postal_code value to child_record str : " << postalCode); + LoggerW("Fail to set postal_code value to child_record str : " << postalCode); contacts_record_destroy(child_record, true); continue; } @@ -1385,7 +1386,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_bool(child_record, _contacts_address.is_default, ctsBoolDefault); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set favorite value to child_record default : " << ctsBoolDefault); + LoggerW("Fail to set favorite value to child_record default : " << ctsBoolDefault); contacts_record_destroy(child_record, true); continue; } @@ -1393,7 +1394,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_set_int(child_record, _contacts_address.type, ctsIntType); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set default value to child_record type : " << ctsIntType); + LoggerW("Fail to set default value to child_record type : " << ctsIntType); contacts_record_destroy(child_record, true); continue; } @@ -1403,7 +1404,7 @@ void ContactObjectA2PConverter::importPostalList() // errorCode = contacts_record_set_str(child_record, _contacts_address.label, ctsStrCustomType); // if(errorCode != CONTACTS_ERROR_NONE) // { - // LogWarning("Fail to set custom value to child_record type : " << ctsStrCustomType); + // LoggerW("Fail to set custom value to child_record type : " << ctsStrCustomType); // contacts_record_destroy(child_record, true); // continue; // } @@ -1412,7 +1413,7 @@ void ContactObjectA2PConverter::importPostalList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.address, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set address value to child_record"); + LoggerW("Fail to set address value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -1456,7 +1457,7 @@ void ContactObjectA2PConverter::importWebAddrList() if(!webSite->getUrlIsSet() || webSite->getUrl().empty()) { - LogDebug("url was not set."); + LoggerD("url was not set."); continue; } @@ -1477,14 +1478,14 @@ void ContactObjectA2PConverter::importWebAddrList() errorCode = contacts_record_create(_contacts_url._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_url._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_url._uri)"); continue; } errorCode = contacts_record_set_str(child_record, _contacts_url.url, url.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set url value to child_record str : " << url); + LoggerW("Fail to set url value to child_record str : " << url); contacts_record_destroy(child_record, true); continue; } @@ -1492,7 +1493,7 @@ void ContactObjectA2PConverter::importWebAddrList() errorCode = contacts_record_set_int(child_record, _contacts_url.type, ctsIntType); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set default value to child_record type : " << ctsIntType); + LoggerW("Fail to set default value to child_record type : " << ctsIntType); contacts_record_destroy(child_record, true); continue; } @@ -1502,7 +1503,7 @@ void ContactObjectA2PConverter::importWebAddrList() errorCode = contacts_record_set_str(child_record, _contacts_url.label, ctsStrCustomType); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set custom value to child_record type : " << ctsStrCustomType); + LoggerW("Fail to set custom value to child_record type : " << ctsStrCustomType); contacts_record_destroy(child_record, true); continue; } @@ -1511,7 +1512,7 @@ void ContactObjectA2PConverter::importWebAddrList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.url, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set url value to child_record"); + LoggerW("Fail to set url value to child_record"); contacts_record_destroy(child_record, true); continue; } @@ -1559,7 +1560,7 @@ void ContactObjectA2PConverter::importNicknameList() if(nickname.empty()) { - LogDebug("nickname was not set."); + LoggerD("nickname was not set."); continue; } @@ -1568,14 +1569,14 @@ void ContactObjectA2PConverter::importNicknameList() errorCode = contacts_record_create(_contacts_nickname._uri, &child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to create child_record with contacts_record_create(_contacts_nickname._uri)"); + LoggerW("Fail to create child_record with contacts_record_create(_contacts_nickname._uri)"); continue; } errorCode = contacts_record_set_str(child_record, _contacts_nickname.name, nickname.c_str()); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set nickname value to ctsValue str : " << nickname); + LoggerW("Fail to set nickname value to ctsValue str : " << nickname); contacts_record_destroy(child_record, true); continue; } @@ -1583,7 +1584,7 @@ void ContactObjectA2PConverter::importNicknameList() errorCode = contacts_record_add_child_record(m_platformContact, _contacts_contact.nickname, child_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to set nickname value to child_record"); + LoggerW("Fail to set nickname value to child_record"); contacts_record_destroy(child_record, true); continue; } diff --git a/src/Contact/ContactObjectP2AConverter.cpp b/src/Contact/ContactObjectP2AConverter.cpp old mode 100755 new mode 100644 index 04c1c6b..c587be3 --- a/src/Contact/ContactObjectP2AConverter.cpp +++ b/src/Contact/ContactObjectP2AConverter.cpp @@ -23,15 +23,14 @@ */ #include "ContactObjectP2AConverter.h" - #include #include -#include #include #include #include "AddressBook.h" #include "Contact.h" #include "ContactUtility.h" +#include namespace DeviceAPI { namespace Contact { @@ -64,21 +63,21 @@ ContactObjectP2AConverter::~ContactObjectP2AConverter() ContactPtr ContactObjectP2AConverter::getAbstractContact() { - //LogDebug("enter"); + //LoggerD("enter"); if(m_platformContact == NULL) { - LogError("Platform contact object did not set"); + LoggerE("Platform contact object did not set"); ThrowMsg(InvalidArgumentException, "Platform contact object did not set"); } if(m_abstractContact == NULL) { - //LogDebug("Abstract contact object did not set, so a new object has been created"); + //LoggerD("Abstract contact object did not set, so a new object has been created"); m_abstractContact = ContactPtr(new Contact()); } - //LogDebug("for scratch : " << m_forScratch); + //LoggerD("for scratch : " << m_forScratch); Try { @@ -87,7 +86,7 @@ ContactPtr ContactObjectP2AConverter::getAbstractContact() } Catch(Exception) { - LogError("Error while converting - " << _rethrown_exception.GetMessage()); + LoggerE("Error while converting - " << _rethrown_exception.GetMessage()); ThrowMsg(PlatformException, "Fail to convert platform object to abstract object."); } @@ -138,7 +137,7 @@ void ContactObjectP2AConverter::exportBaseInfoValue() bool isFavorite = false; errorCode = contacts_record_get_bool(m_platformContact, _contacts_contact.is_favorite, &isFavorite); if(errorCode != CONTACTS_ERROR_NONE) - LogError("contacts_record_get_bool returned " << errorCode); + LoggerE("contacts_record_get_bool returned " << errorCode); m_abstractContact->setIsFavorite(isFavorite); } @@ -191,7 +190,7 @@ void ContactObjectP2AConverter::exportNameValue() if(child_record == NULL || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have name value"); + //LoggerD("Platform contact don't have name value"); ContactNamePtr contactName = m_abstractContact->getName(); if(contactName != NULL) { @@ -306,7 +305,7 @@ void ContactObjectP2AConverter::exportCompanyList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have company list"); + //LoggerD("Platform contact don't have company list"); return; } @@ -387,7 +386,7 @@ void ContactObjectP2AConverter::exportNoteList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have note list"); + //LoggerD("Platform contact don't have note list"); return; } @@ -423,7 +422,7 @@ void ContactObjectP2AConverter::exportNumberList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have number list"); + //LoggerD("Platform contact don't have number list"); return; } @@ -451,7 +450,7 @@ void ContactObjectP2AConverter::exportNumberList() } else { - //LogDebug("Platform contact have a empty phone number"); + //LoggerD("Platform contact have a empty phone number"); continue; } @@ -513,7 +512,7 @@ void ContactObjectP2AConverter::exportEmailList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have email list"); + //LoggerD("Platform contact don't have email list"); return; } @@ -541,7 +540,7 @@ void ContactObjectP2AConverter::exportEmailList() } else { - //LogDebug("Platform contact have a empty email address"); + //LoggerD("Platform contact have a empty email address"); continue; } @@ -581,7 +580,7 @@ void ContactObjectP2AConverter::exportGrouprelList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have group list"); + //LoggerD("Platform contact don't have group list"); return; } @@ -620,7 +619,7 @@ void ContactObjectP2AConverter::exportEventList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have group list"); + //LoggerD("Platform contact don't have group list"); return; } @@ -645,7 +644,7 @@ void ContactObjectP2AConverter::exportEventList() Try { tmDate = ContactUtility::toDateTmFromDateDbInt(intValueDate); } Catch(Exception) { - LogError("date has wrong value"); + LoggerE("date has wrong value"); } contacts_record_get_int(child_record, _contacts_event.type, &intValueType); @@ -690,7 +689,7 @@ void ContactObjectP2AConverter::exportPostalList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have address list"); + //LoggerD("Platform contact don't have address list"); return; } @@ -772,7 +771,7 @@ void ContactObjectP2AConverter::exportWebAddrList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have address list"); + //LoggerD("Platform contact don't have address list"); return; } @@ -837,7 +836,7 @@ void ContactObjectP2AConverter::exportNicknameList() if(child_count == 0 || errorCode == CONTACTS_ERROR_NO_DATA) { - //LogDebug("Platform contact don't have nickname list"); + //LoggerD("Platform contact don't have nickname list"); return; } diff --git a/src/Contact/ContactQueue.cpp b/src/Contact/ContactQueue.cpp index 7f9587c..616e2e4 100644 --- a/src/Contact/ContactQueue.cpp +++ b/src/Contact/ContactQueue.cpp @@ -17,6 +17,7 @@ #include "ContactQueue.h" #include +#include using namespace DPL; @@ -31,7 +32,7 @@ namespace Contact { bool ContactQueueManager::empty() { - LogDebug("count : " << count); + LoggerD("count : " << count); if(count > 0) return false; @@ -42,19 +43,19 @@ bool ContactQueueManager::empty() void ContactQueueManager::increaseQueueList() { count++; - LogDebug("count : " << count); + LoggerD("count : " << count); } void ContactQueueManager::decreaseQueueList() { if(count > 0) count--; - LogDebug("count : " << count); + LoggerD("count : " << count); } void ContactQueueManager::push(operationType type, AddressBook *addressBook, const EventAddressBookAddBatchPtr &event) { - LogDebug("push type : " << type); + LoggerD("push type : " << type); queueProperties properties; properties.addressBook = addressBook; @@ -77,13 +78,13 @@ void ContactQueueManager::push(operationType type, AddressBook *addressBook, con } mapIndex++; - LogDebug("mapIndex : " << mapIndex); + LoggerD("mapIndex : " << mapIndex); m_addressBookQueueMap.insert(std::make_pair(mapIndex, properties)); } void ContactQueueManager::push(operationType type, AddressBook *addressBook, const EventAddressBookUpdateBatchPtr &event) { - LogDebug("push type : " << type); + LoggerD("push type : " << type); queueProperties properties; properties.addressBook = addressBook; @@ -106,13 +107,13 @@ void ContactQueueManager::push(operationType type, AddressBook *addressBook, con } mapIndex++; - LogDebug("mapIndex : " << mapIndex); + LoggerD("mapIndex : " << mapIndex); m_addressBookQueueMap.insert(std::make_pair(mapIndex, properties)); } void ContactQueueManager::push(operationType type, AddressBook *addressBook, const EventAddressBookRemoveBatchPtr &event) { - LogDebug("push type : " << type); + LoggerD("push type : " << type); queueProperties properties; properties.addressBook = addressBook; @@ -135,13 +136,13 @@ void ContactQueueManager::push(operationType type, AddressBook *addressBook, con } mapIndex++; - LogDebug("mapIndex : " << mapIndex); + LoggerD("mapIndex : " << mapIndex); m_addressBookQueueMap.insert(std::make_pair(mapIndex, properties)); } void ContactQueueManager::push(operationType type, ContactManager *contactManager, const EventContactManagerUpdateBatchPtr &event) { - LogDebug("push type : " << type); + LoggerD("push type : " << type); queueProperties properties; properties.contactManager = contactManager; @@ -161,13 +162,13 @@ void ContactQueueManager::push(operationType type, ContactManager *contactManage } mapIndex++; - LogDebug("mapIndex : " << mapIndex); + LoggerD("mapIndex : " << mapIndex); m_addressBookQueueMap.insert(std::make_pair(mapIndex, properties)); } void ContactQueueManager::push(operationType type, ContactManager *contactManager, const EventContactManagerRemoveBatchPtr &event) { - LogDebug("push type : " << type); + LoggerD("push type : " << type); queueProperties properties; properties.contactManager = contactManager; @@ -187,14 +188,14 @@ void ContactQueueManager::push(operationType type, ContactManager *contactManage } mapIndex++; - LogDebug("mapIndex : " << mapIndex); + LoggerD("mapIndex : " << mapIndex); m_addressBookQueueMap.insert(std::make_pair(mapIndex, properties)); } void ContactQueueManager::pop() { currentIndex++; - LogDebug("currentIndex : " << currentIndex << " / mapIndex : " << mapIndex); + LoggerD("currentIndex : " << currentIndex << " / mapIndex : " << mapIndex); AddressBookQueueMap::iterator iter = m_addressBookQueueMap.find(currentIndex); queueProperties properties = iter->second; diff --git a/src/Contact/ContactRef.cpp b/src/Contact/ContactRef.cpp index f5594a1..280ef60 100755 --- a/src/Contact/ContactRef.cpp +++ b/src/Contact/ContactRef.cpp @@ -23,6 +23,7 @@ */ #include "ContactRef.h" +#include namespace DeviceAPI { namespace Contact { diff --git a/src/Contact/ContactRef.h b/src/Contact/ContactRef.h index 8b270ec..833c2cc 100755 --- a/src/Contact/ContactRef.h +++ b/src/Contact/ContactRef.h @@ -28,7 +28,6 @@ #include #include #include -#include #include namespace DeviceAPI { diff --git a/src/Contact/ContactSearchEngine.cpp b/src/Contact/ContactSearchEngine.cpp old mode 100755 new mode 100644 index beb1390..eabad30 --- a/src/Contact/ContactSearchEngine.cpp +++ b/src/Contact/ContactSearchEngine.cpp @@ -33,6 +33,7 @@ #include "Contact.h" #include "ContactObjectP2AConverter.h" #include "ContactUtility.h" +#include #define _CONTACTS_SVC_QUERY_FUNC_PREFIX(view_uri, query, filter) \ do { \ @@ -175,7 +176,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() ContactArrayPtr result(NULL); unsigned int length = 0; - LogDebug("entered"); + LoggerD("entered"); if(m_isFilterSet) { if(m_isSortModeSet) @@ -187,7 +188,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() AttributeProperties &property = iter->second; length = m_filteredContactIds->size(); - LogDebug("length : " << length); + LoggerD("length : " << length); if(length != 0) { @@ -205,7 +206,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() else { length = m_filteredContactIds->size(); - LogDebug("length : " << length); + LoggerD("length : " << length); if(length != 0) { result = getContacts(m_filteredContactIds); @@ -230,7 +231,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() result = getAllContacts(); } } - LogDebug("End"); + LoggerD("End"); return result; } @@ -514,7 +515,7 @@ ContactArrayPtr ContactSearchEngine::getAllContactsSorted(AttributeProperties& a map::iterator idPair = contactMap.find(id); if(idPair == contactMap.end()) { - LogWarning("no contact id : " << id); + LoggerW("no contact id : " << id); continue; } contacts->push_back(idPair->second); @@ -530,7 +531,7 @@ ContactArrayPtr ContactSearchEngine::getAllContacts() ContactArrayPtr contacts(new ContactArray()); contacts_list_h list = NULL; - LogDebug("start : " << m_isAddressBookIdSet); + LoggerD("start : " << m_isAddressBookIdSet); if(!m_isAddressBookIdSet) { @@ -584,7 +585,7 @@ ContactArrayPtr ContactSearchEngine::getAllContacts() errorCode = contacts_list_get_current_record_p(list, &record); if(errorCode != CONTACTS_ERROR_NONE || record == NULL) { - LogWarning("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerW("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); continue; } @@ -598,7 +599,7 @@ ContactArrayPtr ContactSearchEngine::getAllContacts() } Catch(Exception) { - LogWarning("fail to convert contact"); + LoggerW("fail to convert contact"); continue; } @@ -610,7 +611,7 @@ ContactArrayPtr ContactSearchEngine::getAllContacts() if(list != NULL) contacts_list_destroy(list, true); - LogDebug("end"); + LoggerD("end"); return contacts; } @@ -630,7 +631,7 @@ ContactArrayPtr ContactSearchEngine::getContacts(ContactIdArrayPtr& ids) } Catch(Exception) { - LogWarning(_rethrown_exception.GetMessage()); + LoggerW(_rethrown_exception.GetMessage()); continue; } } @@ -653,7 +654,7 @@ ContactArrayPtr ContactSearchEngine::getContacts(ContactIdSetPtr& ids) } Catch(Exception) { - LogWarning(_rethrown_exception.GetMessage()); + LoggerW(_rethrown_exception.GetMessage()); continue; } } @@ -668,7 +669,7 @@ ContactPtr ContactSearchEngine::getContact(int id) errorCode = contacts_db_get_record(_contacts_contact._uri, id, &record); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("No contact (id:" << id << ") : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerE("No contact (id:" << id << ") : " << errorCode << " (" << __FUNCTION__ << ")"); return ContactPtr(NULL); } @@ -679,7 +680,7 @@ ContactPtr ContactSearchEngine::getContact(int id) errorCode = contacts_record_get_int(record, _contacts_contact.address_book_id, &addressBookId); if(errorCode != CONTACTS_ERROR_NONE) { - LogError("No contact (id:" << id << ") 2 : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerE("No contact (id:" << id << ") 2 : " << errorCode << " (" << __FUNCTION__ << ")"); return ContactPtr(NULL); } @@ -852,7 +853,7 @@ void ContactSearchEngine::queryAttributeRangeString(AttributeProperties& attribu const char* view_uri = attributeProperties.viewUri; unsigned int property_contact_id = attributeProperties.propertyContactId; unsigned int property_id = attributeProperties.propertyId; - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_query_h query = NULL; @@ -890,7 +891,7 @@ void ContactSearchEngine::queryAttributeRangeString(AttributeProperties& attribu } _CONTACTS_SVC_QUERY_FUNC_SUFFIX(query, filter, list, property_contact_id, result); - LogDebug("end"); + LoggerD("end"); } void ContactSearchEngine::sortContacts(AttributeProperties& attributeProperties, ContactIdArrayPtr& result, @@ -900,7 +901,7 @@ void ContactSearchEngine::sortContacts(AttributeProperties& attributeProperties, unsigned int property_contact_id = attributeProperties.propertyContactId; unsigned int property_id = attributeProperties.propertyId; - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_query_h query = NULL; @@ -981,7 +982,7 @@ void ContactSearchEngine::sortContacts(AttributeProperties& attributeProperties, if(query != NULL) contacts_query_destroy(query); - LogDebug("end"); + LoggerD("end"); } void ContactSearchEngine::sortContacts(AttributeProperties& attributeProperties, ContactIdArrayPtr& result, diff --git a/src/Contact/ContactsSvcChangeListenerManager.cpp b/src/Contact/ContactsSvcChangeListenerManager.cpp old mode 100755 new mode 100644 index 81ff3ba..9c0b16a --- a/src/Contact/ContactsSvcChangeListenerManager.cpp +++ b/src/Contact/ContactsSvcChangeListenerManager.cpp @@ -23,10 +23,7 @@ */ #include "ContactsSvcChangeListenerManager.h" - #include - -#include #include #include #include @@ -34,6 +31,7 @@ #include "ContactObjectP2AConverter.h" #include "ContactsSvcObjectConverter.h" #include "Person.h" +#include IMPLEMENT_SINGLETON(DeviceAPI::Contact::ContactsSvcChangeListenerManager) @@ -68,7 +66,7 @@ void ContactsSvcChangeListenerManager::registerContactsChangeListener(IContactsS { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } @@ -84,7 +82,7 @@ void ContactsSvcChangeListenerManager::registerContactsChangeListener(IContactsS { if(iter->first == addressBookId) { - LogWarning("Callbacks " << callbacks << " is already registered."); + LoggerW("Callbacks " << callbacks << " is already registered."); return; } @@ -105,13 +103,13 @@ void ContactsSvcChangeListenerManager::unregisterContactsChangeListener(IContact { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } if(m_contactsChangeListenerMap.size() == 0) { - LogWarning("No callbacks are registered."); + LoggerW("No callbacks are registered."); return; } @@ -124,7 +122,7 @@ void ContactsSvcChangeListenerManager::unregisterContactsChangeListener(IContact if(iter == m_contactsChangeListenerMap.end()) { - LogWarning("Callbacks " << callbacks << " are not registered."); + LoggerW("Callbacks " << callbacks << " are not registered."); return; } @@ -140,14 +138,14 @@ void ContactsSvcChangeListenerManager::registerPersonsChangeListener(IContactsSv { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } PersonsChangeListenerSet::iterator iter = m_personsChangeListenerSet.find(callbacks); if(iter != m_personsChangeListenerSet.end()) { - LogWarning("Callbacks " << callbacks << " is already registered."); + LoggerW("Callbacks " << callbacks << " is already registered."); return; } @@ -159,20 +157,20 @@ void ContactsSvcChangeListenerManager::unregisterPersonsChangeListener(IContacts { if(callbacks == NULL) { - LogWarning("Parameter is NULL."); + LoggerW("Parameter is NULL."); return; } if(m_personsChangeListenerSet.size() == 0) { - LogWarning("No callbacks are registered."); + LoggerW("No callbacks are registered."); return; } PersonsChangeListenerSet::iterator iter = m_personsChangeListenerSet.find(callbacks); if(iter == m_personsChangeListenerSet.end()) { - LogWarning("Callbacks " << callbacks << " are not registered."); + LoggerW("Callbacks " << callbacks << " are not registered."); return; } @@ -191,11 +189,11 @@ long ContactsSvcChangeListenerManager::getWatchIdAndInc() void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* view_uri, void* user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogWarning("contacts-service listener passed NULL user_data"); + LoggerW("contacts-service listener passed NULL user_data"); return; } @@ -205,7 +203,7 @@ void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* vie void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* view_uri) { - LogDebug("entered"); + LoggerD("entered"); string view_uri_str = view_uri; if(view_uri_str == _contacts_contact._uri) @@ -220,11 +218,11 @@ void ContactsSvcChangeListenerManager::contactsDbChangedCallback(const char* vie void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view_uri, char* changes, void* user_data) { - LogDebug("entered"); + LoggerD("entered"); if(user_data == NULL) { - LogWarning("contacts-service listener passed NULL user_data"); + LoggerW("contacts-service listener passed NULL user_data"); return; } @@ -234,7 +232,7 @@ void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view void ContactsSvcChangeListenerManager::personsDbChangedCallback(const char* view_uri, char* changes) { - LogDebug("entered"); + LoggerD("entered"); personsChangedCallback(changes); } @@ -245,7 +243,7 @@ void ContactsSvcChangeListenerManager::OnRequestReceived(const EventInvokeContac void ContactsSvcChangeListenerManager::contactsChangedCallback() { - LogDebug("entered"); + LoggerD("entered"); if(!m_contactsChangedCallbackRegistered) return; @@ -265,7 +263,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() m_latestVersion, &change_record_list, &latestVersion); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail to get the updated contacts for addressbook : " << addressBookId << ", errorCode : " << errorCode); + LoggerD("Fail to get the updated contacts for addressbook : " << addressBookId << ", errorCode : " << errorCode); if(change_record_list != NULL) contacts_list_destroy(change_record_list, true); }else{ @@ -273,13 +271,13 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() errorCode = contacts_list_get_count(change_record_list, &record_count); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("cannot get the updated contact count error : " << errorCode); + LoggerD("cannot get the updated contact count error : " << errorCode); continue; } if(record_count == 0) { - LogDebug("No updated contacts for address book : " << addressBookId); + LoggerD("No updated contacts for address book : " << addressBookId); continue; } @@ -296,7 +294,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() errorCode = contacts_list_get_current_record_p(change_record_list, &contact_updated_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_list_get_current_record_p error : " << errorCode); + LoggerD("Fail contacts_list_get_current_record_p error : " << errorCode); continue; } @@ -308,7 +306,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() _contacts_contact_updated_info.contact_id, &updatedContactId); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_record_get_int error contact_id : " << errorCode); + LoggerD("Fail contacts_record_get_int error contact_id : " << errorCode); continue; } @@ -316,7 +314,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() _contacts_contact_updated_info.address_book_id ,&updatedAddressBookId); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_record_get_int error address_book_id : " << errorCode); + LoggerD("Fail contacts_record_get_int error address_book_id : " << errorCode); continue; } @@ -324,7 +322,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() _contacts_contact_updated_info.type ,&updatedType); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_record_get_int error type : " << errorCode); + LoggerD("Fail contacts_record_get_int error type : " << errorCode); continue; } @@ -334,7 +332,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() errorCode = contacts_db_get_record(_contacts_contact._uri, updatedContactId, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); + LoggerD("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); continue; } @@ -348,7 +346,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); continue; } @@ -364,7 +362,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() errorCode = contacts_db_get_record(_contacts_contact._uri, updatedContactId, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); + LoggerD("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); continue; } @@ -378,7 +376,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); continue; } if(absContact != NULL) @@ -409,7 +407,7 @@ void ContactsSvcChangeListenerManager::contactsChangedCallback() errorCode = contacts_db_get_current_version(&m_latestVersion); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_get_current_version returns error : " << errorCode); + LoggerW("contacts_db_get_current_version returns error : " << errorCode); } } @@ -419,7 +417,7 @@ void ContactsSvcChangeListenerManager::registerContactsSvcContactsChangedCallbac if(m_contactsChangedCallbackRegistered) { - LogWarning("Callback already registered."); + LoggerW("Callback already registered."); return; } @@ -427,14 +425,14 @@ void ContactsSvcChangeListenerManager::registerContactsSvcContactsChangedCallbac contactsDbChangedCallback, reinterpret_cast(this)); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_add_changed_cb(_contacts_contact._uri) returns error : " << errorCode); + LoggerW("contacts_db_add_changed_cb(_contacts_contact._uri) returns error : " << errorCode); ThrowMsg(InvalidArgumentException, "Error while registering listener to contacts-service"); } errorCode = contacts_db_get_current_version(&m_latestVersion); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_get_current_version returns error : " << errorCode); + LoggerW("contacts_db_get_current_version returns error : " << errorCode); ThrowMsg(InvalidArgumentException, "Error while registering listener to contacts-service"); } @@ -447,7 +445,7 @@ void ContactsSvcChangeListenerManager::unregisterContactsSvcContactsChangedCallb if(!m_contactsChangedCallbackRegistered) { - LogWarning("Callback already unregistered."); + LoggerW("Callback already unregistered."); return; } @@ -459,7 +457,7 @@ void ContactsSvcChangeListenerManager::unregisterContactsSvcContactsChangedCallb contactsDbChangedCallback, reinterpret_cast(this)); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_remove_changed_cb(_contacts_contact._uri) returns error : " << errorCode); + LoggerW("contacts_db_remove_changed_cb(_contacts_contact._uri) returns error : " << errorCode); ThrowMsg(InvalidArgumentException, "Error while registering listener to contacts-service"); } } @@ -467,11 +465,11 @@ void ContactsSvcChangeListenerManager::unregisterContactsSvcContactsChangedCallb void ContactsSvcChangeListenerManager::registerContactsSvcPersonsChangedCallback() { int errorCode = 0; - LogDebug("entered"); + LoggerD("entered"); if(m_personsChangedCallbackRegistered) { - LogWarning("Callback already registered."); + LoggerW("Callback already registered."); return; } @@ -479,7 +477,7 @@ void ContactsSvcChangeListenerManager::registerContactsSvcPersonsChangedCallback personsDbChangedCallback, reinterpret_cast(this)); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_add_changed_cb(_contacts_person._uri) returns error : " << errorCode); + LoggerW("contacts_db_add_changed_cb(_contacts_person._uri) returns error : " << errorCode); ThrowMsg(InvalidArgumentException, "Error while registering listener to contacts-service"); } @@ -492,7 +490,7 @@ void ContactsSvcChangeListenerManager::unregisterContactsSvcPersonsChangedCallba if(!m_personsChangedCallbackRegistered) { - LogWarning("Callback already unregistered."); + LoggerW("Callback already unregistered."); return; } @@ -502,14 +500,14 @@ void ContactsSvcChangeListenerManager::unregisterContactsSvcPersonsChangedCallba personsDbChangedCallback, reinterpret_cast(this)); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_db_remove_changed_cb(_contacts_person._uri) returns error : " << errorCode); + LoggerW("contacts_db_remove_changed_cb(_contacts_person._uri) returns error : " << errorCode); ThrowMsg(InvalidArgumentException, "Error while registering listener to contacts-service"); } } void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) { - LogDebug("entered : " << changes); + LoggerD("entered : " << changes); if(!m_personsChangedCallbackRegistered) return; @@ -554,7 +552,7 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) { int updatedType = it->first; int updatedContactId = it->second; -// LogDebug("updatedContactId : " << updatedContactId << " , updatedType : " << updatedType); +// LoggerD("updatedContactId : " << updatedContactId << " , updatedType : " << updatedType); if(updatedType == CONTACTS_CHANGE_INSERTED) { @@ -562,7 +560,7 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) errorCode = contacts_db_get_record(_contacts_person._uri, updatedContactId, &person_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); + LoggerD("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); continue; } @@ -573,14 +571,14 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); continue; } if(absPerson != NULL) addedPersons->push_back(absPerson); else - LogDebug("absPerson is null"); + LoggerD("absPerson is null"); if(person_record != NULL) contacts_record_destroy(person_record, true); @@ -591,7 +589,7 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) errorCode = contacts_db_get_record(_contacts_person._uri, updatedContactId, &person_record); if(errorCode != CONTACTS_ERROR_NONE) { - LogDebug("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); + LoggerD("Fail contacts_db_get_record error _contacts_contact._uri : " << errorCode); continue; } @@ -603,7 +601,7 @@ void ContactsSvcChangeListenerManager::personsChangedCallback(char* changes) } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); continue; } if(absPerson != NULL) diff --git a/src/Contact/ContactsSvcObjectConverter.cpp b/src/Contact/ContactsSvcObjectConverter.cpp old mode 100755 new mode 100644 index 5c289d4..dbddc52 --- a/src/Contact/ContactsSvcObjectConverter.cpp +++ b/src/Contact/ContactsSvcObjectConverter.cpp @@ -26,11 +26,11 @@ #include #include -#include #include #include #include "Contact.h" #include "ContactUtility.h" +#include namespace DeviceAPI { namespace Contact { @@ -201,7 +201,7 @@ void ContactsSvcObjectConverter::convertToPlatform(PersonPtr& person, contacts_r if(newValueStr != NULL) { - LogDebug("update photoURI : " << newValueStr); + LoggerD("update photoURI : " << newValueStr); int personId = ContactUtility::strToInt(person->getId()); contacts_filter_h filter = NULL; @@ -247,14 +247,14 @@ void ContactsSvcObjectConverter::convertToPlatform(PersonPtr& person, contacts_r errorCode = contacts_list_get_current_record_p(list, &record); if(errorCode != CONTACTS_ERROR_NONE || record == NULL) { - LogWarning("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerW("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); continue; } contacts_record_get_int(record, _contacts_simple_contact.id, &id); contacts_record_get_str_p(record, _contacts_simple_contact.image_thumbnail_path, &charValue); - LogDebug("id : " << id); - LogDebug("charValue : " << charValue); + LoggerD("id : " << id); + LoggerD("charValue : " << charValue); /* if((charValue == NULL) && g_strcmp0(newValueStr, EMPTY_STRING) == 0){ is_success = true; @@ -284,7 +284,7 @@ void ContactsSvcObjectConverter::convertToPlatform(PersonPtr& person, contacts_r query = NULL; list = NULL; - LogDebug("targetId : " << targetId); + LoggerD("targetId : " << targetId); errorCode = contacts_query_create(_contacts_image._uri, &query); if(errorCode != CONTACTS_ERROR_NONE) @@ -318,21 +318,21 @@ void ContactsSvcObjectConverter::convertToPlatform(PersonPtr& person, contacts_r errorCode = contacts_list_get_current_record_p(list, &imageRecord); if(errorCode != CONTACTS_ERROR_NONE || imageRecord == NULL) { - LogWarning("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerW("contacts_list_get_current_record_p error : " << errorCode << " (" << __FUNCTION__ << ")"); continue; } errorCode = contacts_record_get_int(imageRecord, _contacts_image.id, &imageId); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_record_get_int error : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerW("contacts_record_get_int error : " << errorCode << " (" << __FUNCTION__ << ")"); continue; } errorCode = contacts_list_next(list); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("contacts_list_next error : " << errorCode << " (" << __FUNCTION__ << ")"); + LoggerW("contacts_list_next error : " << errorCode << " (" << __FUNCTION__ << ")"); break; } } diff --git a/src/Contact/ContactsSvcWrapper.cpp b/src/Contact/ContactsSvcWrapper.cpp old mode 100755 new mode 100644 index e782fef..b53b982 --- a/src/Contact/ContactsSvcWrapper.cpp +++ b/src/Contact/ContactsSvcWrapper.cpp @@ -28,6 +28,7 @@ #include #include #include "AddressBook.h" +#include IMPLEMENT_SINGLETON(DeviceAPI::Contact::ContactsSvcWrapper) @@ -56,7 +57,7 @@ ContactsSvcWrapper::~ContactsSvcWrapper() if (ret != CONTACTS_ERROR_NONE) { //error during closing contacts database - LogError("Error occurred during closing contacts database. (ret:" << ret << ")"); + LoggerE("Error occurred during closing contacts database. (ret:" << ret << ")"); } } } @@ -67,7 +68,7 @@ AddressBookPtr ContactsSvcWrapper::getAddressBook(const std::string &id) if(!m_opened) { //when database is not opened then set result as failed - LogError("Contact db is not open."); + LoggerE("Contact db is not open."); ThrowMsg(PlatformException, "Contact DB is not open."); } @@ -88,7 +89,7 @@ AddressBookPtr ContactsSvcWrapper::getDefaultAddressBook() if(!m_opened) { //when database is not opened then set result as failed - LogError("Contact db is not open."); + LoggerE("Contact db is not open."); ThrowMsg(PlatformException, "Contact DB is not open."); } @@ -104,7 +105,7 @@ AddressBookPtr ContactsSvcWrapper::getUnifiedAddressBook() if(!m_opened) { //when database is not opened then set result as failed - LogError("Contact db is not open."); + LoggerE("Contact db is not open."); ThrowMsg(PlatformException, "Contact DB is not open."); } @@ -120,7 +121,7 @@ AddressBookArrayPtr ContactsSvcWrapper::getAddressBooks() if(!m_opened) { //when database is not opened then set result as failed - LogError("Contact db is not open."); + LoggerE("Contact db is not open."); ThrowMsg(PlatformException, "Contact DB is not open."); } @@ -137,13 +138,13 @@ void ContactsSvcWrapper::init() if (m_opened) return; - LogDebug("entered"); + LoggerD("entered"); int ret = contacts_connect2(); if (ret != CONTACTS_ERROR_NONE) { //error during opening contacts database - LogError("Error occurred during opening contacts database. (ret:" + LoggerE("Error occurred during opening contacts database. (ret:" << ret << ")"); m_opened = false; @@ -151,7 +152,7 @@ void ContactsSvcWrapper::init() } //contacts-service has properly connected. - LogDebug("Contact db has properly opened."); + LoggerD("Contact db has properly opened."); m_opened = true; loadAddressBooks(); @@ -159,7 +160,7 @@ void ContactsSvcWrapper::init() void ContactsSvcWrapper::loadAddressBooks() { - LogDebug("Loading AddressBook"); + LoggerD("Loading AddressBook"); int errorCode = 0; contacts_list_h addressbooks_list = NULL; @@ -181,7 +182,7 @@ void ContactsSvcWrapper::loadAddressBooks() errorCode = contacts_list_get_current_record_p(addressbooks_list, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE || contacts_record == NULL) { - LogWarning("Fail to get addressbook record (ret:" << errorCode << ")"); + LoggerW("Fail to get addressbook record (ret:" << errorCode << ")"); continue; } @@ -191,32 +192,32 @@ void ContactsSvcWrapper::loadAddressBooks() errorCode = contacts_record_get_int(contacts_record, _contacts_address_book.id, &id); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get id from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get id from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_int(contacts_record, _contacts_address_book.account_id, &accountId); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get account id from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get account id from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_int(contacts_record, _contacts_address_book.mode, &mode); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get mode from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get mode from address book (ret:" << errorCode << ")"); continue; } errorCode = contacts_record_get_str_p(contacts_record, _contacts_address_book.name, &name); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get name from address book (ret:" << errorCode << ")"); + LoggerW("Fail to get name from address book (ret:" << errorCode << ")"); continue; } - LogDebug(" AddressBook [id:" << id << ", name:" << name << + LoggerD(" AddressBook [id:" << id << ", name:" << name << ", accId:" << accountId << ", mode:" << mode << "]"); AddressBook *addressBook = new AddressBook(false); @@ -241,7 +242,7 @@ void ContactsSvcWrapper::loadAddressBooks() errorCode = contacts_list_next(addressbooks_list); if(errorCode != CONTACTS_ERROR_NONE) { - LogWarning("Fail to get netx address book (ret:" << errorCode << ")"); + LoggerW("Fail to get netx address book (ret:" << errorCode << ")"); break; } } @@ -257,7 +258,7 @@ void ContactsSvcWrapper::loadAddressBooks() } Catch(Exception) { - LogError("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); + LoggerE("Fail error on converting contact to abs contact : " << _rethrown_exception.GetMessage()); if(addressbooks_list != NULL) contacts_list_destroy(addressbooks_list, true); return; diff --git a/src/Contact/IAddressBook.cpp b/src/Contact/IAddressBook.cpp old mode 100755 new mode 100644 index ef66ae9..2f03f23 --- a/src/Contact/IAddressBook.cpp +++ b/src/Contact/IAddressBook.cpp @@ -24,6 +24,7 @@ #include #include "IAddressBook.h" +#include namespace DeviceAPI { namespace Contact { @@ -49,13 +50,13 @@ IAddressBook::IAddressBook() : EventRequestReceiver< EventAddressBookGetGroups >(ThreadEnum::NULL_THREAD) { //Nothing to do - LogDebug("entered"); + LoggerD("entered"); } IAddressBook::~IAddressBook() { //Nothing to do -// LogDebug("entered"); +// LoggerD("entered"); } void IAddressBook::get(const EventAddressBookGetPtr &event) diff --git a/src/Contact/IAddressBook.h b/src/Contact/IAddressBook.h index 63984fd..ff29063 100755 --- a/src/Contact/IAddressBook.h +++ b/src/Contact/IAddressBook.h @@ -27,7 +27,6 @@ #include #include -#include #include #include #include "EventAddressBookGet.h" diff --git a/src/Contact/IContact.h b/src/Contact/IContact.h index e6255ec..dcecffd 100755 --- a/src/Contact/IContact.h +++ b/src/Contact/IContact.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include "ContactTypes.h" diff --git a/src/Contact/IPerson.cpp b/src/Contact/IPerson.cpp index 90d9113..84c6f43 100755 --- a/src/Contact/IPerson.cpp +++ b/src/Contact/IPerson.cpp @@ -24,9 +24,9 @@ */ #include "IPerson.h" - #include #include "ContactFactory.h" +#include namespace DeviceAPI { namespace Contact { diff --git a/src/Contact/IPerson.h b/src/Contact/IPerson.h index 7a920f7..7b05844 100755 --- a/src/Contact/IPerson.h +++ b/src/Contact/IPerson.h @@ -28,7 +28,6 @@ #include #include -#include #include #include "EventPersonLink.h" #include "EventPersonUnlink.h" diff --git a/src/Contact/JSAddressBook.cpp b/src/Contact/JSAddressBook.cpp old mode 100755 new mode 100644 index 7f6587e..c20b064 --- a/src/Contact/JSAddressBook.cpp +++ b/src/Contact/JSAddressBook.cpp @@ -22,7 +22,6 @@ * @brief Implementation of the JSAddressBook class */ -#include #include #include #include @@ -53,6 +52,7 @@ #include #include #include +#include using namespace std; @@ -126,7 +126,7 @@ const JSClassDefinition* JSAddressBook::getClassInfo() const JSClassRef JSAddressBook::getClassRef() { - LogInfo("entered"); + LoggerI("entered"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); } @@ -197,7 +197,7 @@ JSValueRef JSAddressBook::getId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -216,7 +216,7 @@ JSValueRef JSAddressBook::getName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -236,7 +236,7 @@ JSValueRef JSAddressBook::getReadOnly(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -260,7 +260,7 @@ JSValueRef JSAddressBook::getAccountId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -272,7 +272,7 @@ JSValueRef JSAddressBook::get(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -287,7 +287,7 @@ JSValueRef JSAddressBook::get(JSContextRef context, gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -317,7 +317,7 @@ JSValueRef JSAddressBook::get(JSContextRef context, Try { addressBook->get(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -328,7 +328,7 @@ JSValueRef JSAddressBook::get(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << id); + LoggerE("Not Found error : " << id); oss << "No Contact id '" << id << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -348,7 +348,7 @@ JSValueRef JSAddressBook::get(JSContextRef context, Try { result = converter->toJSValueRef(contact); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -363,7 +363,7 @@ JSValueRef JSAddressBook::add(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -377,7 +377,7 @@ JSValueRef JSAddressBook::add(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -405,7 +405,7 @@ JSValueRef JSAddressBook::add(JSContextRef context, ThrowMsg(InvalidArgumentException, "1st argument is not a 'Contact object'."); contact = converter->toContact(arguments[0]); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'Contact object'"); } @@ -417,7 +417,7 @@ JSValueRef JSAddressBook::add(JSContextRef context, Try { addressBook->add(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -448,7 +448,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -465,7 +465,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -510,7 +510,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context, Try { dplEvent->setContacts(converter->toContactArray(arguments[0])); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be an array of 'Contact object'"); } @@ -525,7 +525,7 @@ JSValueRef JSAddressBook::addBatch(JSContextRef context, addressBook->addBatch(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -541,7 +541,7 @@ JSValueRef JSAddressBook::update(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -555,7 +555,7 @@ JSValueRef JSAddressBook::update(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -584,7 +584,7 @@ JSValueRef JSAddressBook::update(JSContextRef context, ThrowMsg(InvalidArgumentException, "1st argument is not a 'Contact object'."); contact = converter->toContact(arguments[0]); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument is not a 'Contact object'"); } @@ -596,7 +596,7 @@ JSValueRef JSAddressBook::update(JSContextRef context, Try { addressBook->update(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -630,7 +630,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -647,7 +647,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -693,7 +693,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context, Try { dplEvent->setContacts(converter->toContactArray(arguments[0])); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be an array of 'Contact object'"); } @@ -708,7 +708,7 @@ JSValueRef JSAddressBook::updateBatch(JSContextRef context, addressBook->updateBatch(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -724,7 +724,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -736,7 +736,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context, } addressBook = controller->getObject(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -765,7 +765,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context, Try { addressBook->remove(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -776,7 +776,7 @@ JSValueRef JSAddressBook::remove(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << contactId); + LoggerE("Not Found error : " << contactId); oss << "No Contact id '" << contactId << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -799,7 +799,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -816,7 +816,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -861,7 +861,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context, Try { dplEvent->setContactIds(converter->toStringArray(arguments[0])); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be an array of 'Contact id'"); } @@ -876,7 +876,7 @@ JSValueRef JSAddressBook::removeBatch(JSContextRef context, addressBook->removeBatch(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -892,7 +892,7 @@ JSValueRef JSAddressBook::find(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -910,7 +910,7 @@ JSValueRef JSAddressBook::find(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -960,7 +960,7 @@ JSValueRef JSAddressBook::find(JSContextRef context, if (js3rdParamIsObject) dplEvent->setFilter(filterConverter->toFilter(arguments[2])); } Catch(Exception) { - LogError("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be an 'Filter object' or 'null'"); } @@ -968,7 +968,7 @@ JSValueRef JSAddressBook::find(JSContextRef context, if (js4thParamIsObject) dplEvent->setSortMode(filterConverter->toSortMode(arguments[3])); } Catch(Exception) { - LogError("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "4th argument must be an 'SortMode object' or 'null'"); } @@ -983,7 +983,7 @@ JSValueRef JSAddressBook::find(JSContextRef context, addressBook->find(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -999,7 +999,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -1015,7 +1015,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1072,7 +1072,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context, ThrowMsg(ConversionException, "2nd argument must have at least one function"); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } @@ -1097,7 +1097,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context, Try { addressBook->addChangeListener(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1126,7 +1126,7 @@ JSValueRef JSAddressBook::addChangeListener(JSContextRef context, result = JSUtil::toJSValueRef(context, watchId); // result = converter->toJSValueRefLong(watchId); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -1140,7 +1140,7 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; JSContextRef gContext; @@ -1154,7 +1154,7 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1184,7 +1184,7 @@ JSValueRef JSAddressBook::removeChangeListener(JSContextRef context, Try { addressBook->removeChangeListener(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1216,7 +1216,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -1230,7 +1230,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1261,7 +1261,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context, Try { addressBook->getGroup(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1273,7 +1273,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << id); + LoggerE("Not Found error : " << id); oss << "No Contact id '" << id << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); @@ -1295,7 +1295,7 @@ JSValueRef JSAddressBook::getGroup(JSContextRef context, Try { result = converter->toJSValueRef(group); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1310,7 +1310,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -1324,7 +1324,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1355,7 +1355,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context, group = converter->toContactGroup(arguments[0]); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactGroup object'"); } @@ -1368,7 +1368,7 @@ JSValueRef JSAddressBook::addGroup(JSContextRef context, Try { addressBook->addGroup(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1398,7 +1398,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -1412,7 +1412,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1441,7 +1441,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context, ThrowMsg(InvalidArgumentException, "1st argument is not a 'ContactGroup object'."); contact = converter->toContactGroup(arguments[0]); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument is not a 'ContactGroup object'"); } @@ -1453,7 +1453,7 @@ JSValueRef JSAddressBook::updateGroup(JSContextRef context, Try { addressBook->updateGroup(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1490,7 +1490,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -1502,7 +1502,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context, } addressBook = controller->getObject(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1533,7 +1533,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context, Try { addressBook->removeGroup(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1545,7 +1545,7 @@ JSValueRef JSAddressBook::removeGroup(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << groupId); + LoggerE("Not Found error : " << groupId); oss << "No Contact id '" << groupId << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); @@ -1571,7 +1571,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AddressBookPtr addressBook; AddressBookController *controller; @@ -1585,7 +1585,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1604,7 +1604,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context, Try { addressBook->getGroups(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1616,7 +1616,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << id); + LoggerE("Not Found error : " << id); oss << "No Contact id '" << id << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); @@ -1638,7 +1638,7 @@ JSValueRef JSAddressBook::getGroups(JSContextRef context, Try { result = converter->toJSValueRef(groups); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } diff --git a/src/Contact/JSAddressBookArray.cpp b/src/Contact/JSAddressBookArray.cpp old mode 100755 new mode 100644 index b761dfd..e598688 --- a/src/Contact/JSAddressBookArray.cpp +++ b/src/Contact/JSAddressBookArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSAddressBookArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSAddressBookArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSAddressBookArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSAddressBookArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSAddressBookArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSAddressBookArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSAddressBookArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSAddressBookArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSAddressBookArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSAddressBookArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSAddressBookArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSAddressBookArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSAddressBookArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSAddressBookArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSAddressBookChangeCallbackManager.cpp b/src/Contact/JSAddressBookChangeCallbackManager.cpp old mode 100755 new mode 100644 index f944218..e43b6c2 --- a/src/Contact/JSAddressBookChangeCallbackManager.cpp +++ b/src/Contact/JSAddressBookChangeCallbackManager.cpp @@ -23,7 +23,7 @@ */ #include "JSAddressBookChangeCallbackManager.h" -#include +#include namespace DeviceAPI { namespace Contact { @@ -185,7 +185,7 @@ void JSAddressBookChangeCallbackManager::callOnContactsAdded( JSValueRef contact { if ( m_onContactsAdded == NULL ) { - //LogDebug("oncontactsadded callback is not set"); + //LoggerD("oncontactsadded callback is not set"); return; } JSValueRef objParam[1] = { contacts }; @@ -196,7 +196,7 @@ void JSAddressBookChangeCallbackManager::callOnContactsUpdated( JSValueRef conta { if ( m_onContactsUpdated == NULL ) { - //LogDebug("oncontactsupdated callback is not set"); + //LoggerD("oncontactsupdated callback is not set"); return; } JSValueRef objParam[1] = { contacts }; @@ -207,7 +207,7 @@ void JSAddressBookChangeCallbackManager::callOnContactsDeleted( JSValueRef conta { if ( m_onContactsDeleted == NULL ) { - //LogDebug("oncontactsdeleted callback is not set"); + //LoggerD("oncontactsdeleted callback is not set"); return; } JSValueRef objParam[1] = { contactIds }; @@ -218,7 +218,7 @@ void JSAddressBookChangeCallbackManager::callOnError( JSValueRef error ) { if ( m_onError == NULL ) { - //LogDebug("Error callback is not set"); + //LoggerD("Error callback is not set"); return; } JSValueRef objParam[1] = { error }; @@ -230,7 +230,7 @@ void JSAddressBookChangeCallbackManager::makeCallback(JSContextRef context, JSOb if (callback == NULL) { - LogError("callback is NULL"); + LoggerE("callback is NULL"); return; } @@ -238,12 +238,12 @@ void JSAddressBookChangeCallbackManager::makeCallback(JSContextRef context, JSOb { if (argc == 0) { - //LogDebug("Calling object directly, no arguments"); + //LoggerD("Calling object directly, no arguments"); JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL); } else { - //LogDebug("Calling object directly, one argument"); + //LoggerD("Calling object directly, one argument"); JSObjectCallAsFunction(context, callback, object, argc, argv, NULL); } return; diff --git a/src/Contact/JSAttributesOfInterestArray.cpp b/src/Contact/JSAttributesOfInterestArray.cpp old mode 100755 new mode 100644 index fdb5283..b57813f --- a/src/Contact/JSAttributesOfInterestArray.cpp +++ b/src/Contact/JSAttributesOfInterestArray.cpp @@ -23,13 +23,13 @@ */ #include -#include #include #include #include #include #include "ContactConverter.h" #include "JSAttributesOfInterestArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -101,7 +101,7 @@ JSValueRef JSAttributesOfInterestArray::getLength(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - //LogDebug("enter"); + //LoggerD("enter"); Try { JSAttributesOfInterestArrayPriv* priv = @@ -118,7 +118,7 @@ JSValueRef JSAttributesOfInterestArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -167,12 +167,12 @@ AttributesOfInterestArrayPtr JSAttributesOfInterestArray::getAttributesOfInteres void JSAttributesOfInterestArray::initialize(JSContextRef context, JSObjectRef object) { - //LogDebug("enter"); + //LoggerD("enter"); } void JSAttributesOfInterestArray::finalize(JSObjectRef object) { - //LogDebug("enter"); + //LoggerD("enter"); JSAttributesOfInterestArrayPriv* priv = static_cast(JSObjectGetPrivate(object)); delete priv; @@ -183,7 +183,7 @@ bool JSAttributesOfInterestArray::hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName) { - //LogDebug("enter"); + //LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::BasicConverter converter = WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context); Try @@ -211,7 +211,7 @@ JSValueRef JSAttributesOfInterestArray::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - //LogDebug("enter"); + //LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::BasicConverter converter = WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context); Try @@ -232,7 +232,7 @@ JSValueRef JSAttributesOfInterestArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -243,7 +243,7 @@ bool JSAttributesOfInterestArray::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - //LogDebug("enter"); + //LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::BasicConverter converter = WrtDeviceApis::CommonsJavaScript::BasicConverterFactory::getConverter(context); Try @@ -270,7 +270,7 @@ bool JSAttributesOfInterestArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -301,7 +301,7 @@ void JSAttributesOfInterestArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -312,7 +312,7 @@ JSValueRef JSAttributesOfInterestArray::concat(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("enter"); + //LoggerD("enter"); Try { AttributesOfInterestArrayPtr typeArray = @@ -349,7 +349,7 @@ JSValueRef JSAttributesOfInterestArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -361,7 +361,7 @@ JSValueRef JSAttributesOfInterestArray::join(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { std::string result; @@ -384,7 +384,7 @@ JSValueRef JSAttributesOfInterestArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -396,7 +396,7 @@ JSValueRef JSAttributesOfInterestArray::pop(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { WrtDeviceApis::CommonsJavaScript::BasicConverter converter = @@ -413,7 +413,7 @@ JSValueRef JSAttributesOfInterestArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -425,7 +425,7 @@ JSValueRef JSAttributesOfInterestArray::push(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { ContactConverterFactory::ConverterType converter = @@ -440,7 +440,7 @@ JSValueRef JSAttributesOfInterestArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -452,7 +452,7 @@ JSValueRef JSAttributesOfInterestArray::reverse(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { WrtDeviceApis::CommonsJavaScript::BasicConverter converter = @@ -465,7 +465,7 @@ JSValueRef JSAttributesOfInterestArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -477,7 +477,7 @@ JSValueRef JSAttributesOfInterestArray::shift(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { WrtDeviceApis::CommonsJavaScript::BasicConverter converter = @@ -493,7 +493,7 @@ JSValueRef JSAttributesOfInterestArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -505,7 +505,7 @@ JSValueRef JSAttributesOfInterestArray::slice(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("enter"); + //LoggerD("enter"); Try { if (argumentCount < 1) { @@ -540,7 +540,7 @@ JSValueRef JSAttributesOfInterestArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -552,7 +552,7 @@ JSValueRef JSAttributesOfInterestArray::sort(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); Try { WrtDeviceApis::CommonsJavaScript::BasicConverter converter = @@ -565,7 +565,7 @@ JSValueRef JSAttributesOfInterestArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -577,7 +577,7 @@ JSValueRef JSAttributesOfInterestArray::splice(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -588,7 +588,7 @@ JSValueRef JSAttributesOfInterestArray::toString(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); return join(context, function, thisObject, 0, arguments, exception); } @@ -599,7 +599,7 @@ JSValueRef JSAttributesOfInterestArray::unshift(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -610,7 +610,7 @@ JSValueRef JSAttributesOfInterestArray::valueOf(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //LogDebug("entered"); + //LoggerD("entered"); return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContact.cpp b/src/Contact/JSContact.cpp old mode 100755 new mode 100644 index 2219cd7..058b154 --- a/src/Contact/JSContact.cpp +++ b/src/Contact/JSContact.cpp @@ -22,7 +22,6 @@ * @brief Implementation of the JSContact class */ -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #define FILTER_CLASS_NAME "Contact" @@ -171,7 +171,7 @@ JSObjectRef JSContact::createJSObject(JSContextRef context, ContactPtr contact) JSContactPriv *priv = new JSContactPriv(context, contact); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -196,7 +196,7 @@ JSObjectRef JSContact::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); bool jsNoParam = false; bool js1stParamIsObject = false; @@ -223,7 +223,7 @@ JSObjectRef JSContact::constructor(JSContextRef context, js1stParamIsString = true; else { - LogError("Argument type mismatch : 1nd argument must be ContactInit object or string"); + LoggerE("Argument type mismatch : 1nd argument must be ContactInit object or string"); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'"); return NULL; } @@ -238,11 +238,11 @@ JSObjectRef JSContact::constructor(JSContextRef context, contact = converter->toContactFromInit(arguments[0]); } Catch(ConversionException) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be 'ContactInit object'"); return NULL; } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -258,19 +258,19 @@ JSObjectRef JSContact::constructor(JSContextRef context, contact->setContactFromString(stringRepresentation); } Catch(ConversionException) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "2nd argument must be 'ContactTextFormat'"); return NULL; } Catch(InvalidArgumentException) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "1st argument must be vCard string"); return NULL; } Catch(UnsupportedException) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, "Only support vCard 3.0"); return NULL; } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -280,7 +280,7 @@ JSObjectRef JSContact::constructor(JSContextRef context, Try { contact = ContactFactory::getInstance().createContact(); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -291,7 +291,7 @@ JSObjectRef JSContact::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contact); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -324,7 +324,7 @@ JSValueRef JSContact::getId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -346,7 +346,7 @@ JSValueRef JSContact::getAddressBookId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -368,7 +368,7 @@ JSValueRef JSContact::getPersonId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -390,7 +390,7 @@ JSValueRef JSContact::getLastUpdated(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -410,7 +410,7 @@ JSValueRef JSContact::getIsFavorite(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -439,7 +439,7 @@ JSValueRef JSContact::getName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -463,7 +463,7 @@ bool JSContact::setName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -503,7 +503,7 @@ JSValueRef JSContact::getAddresses(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -525,7 +525,7 @@ bool JSContact::setAddresses(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -549,7 +549,7 @@ JSValueRef JSContact::getPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -575,7 +575,7 @@ bool JSContact::setPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -615,7 +615,7 @@ JSValueRef JSContact::getPhoneNumbers(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -637,7 +637,7 @@ bool JSContact::setPhoneNumbers(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -662,10 +662,10 @@ JSValueRef JSContact::getEmails(JSContextRef context, DPL::SharedPtr newContactT = DPL::StaticPointerCast(contact); if(newContactT->EmailsJSObjIsSet()){ - LogDebug("return init value"); + LoggerD("return init value"); return newContactT->getEmailsJSObj(); }else{ - LogDebug("new array"); + LoggerD("new array"); JSValueRef tempJSValue = newContactT->getEmailsJSValue(); tempJSValue = converter->toJSValueRef(newContactT->getEmails()); @@ -680,7 +680,7 @@ JSValueRef JSContact::getEmails(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -703,7 +703,7 @@ bool JSContact::setEmails(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -727,7 +727,7 @@ JSValueRef JSContact::getBirthday(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -753,7 +753,7 @@ bool JSContact::setBirthday(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -794,7 +794,7 @@ JSValueRef JSContact::getAnniversaries(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -816,7 +816,7 @@ bool JSContact::setAnniversaries(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -857,7 +857,7 @@ JSValueRef JSContact::getOrganizations(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -879,7 +879,7 @@ bool JSContact::setOrganizations(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -920,7 +920,7 @@ JSValueRef JSContact::getNotes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -948,7 +948,7 @@ bool JSContact::setNotes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -989,7 +989,7 @@ JSValueRef JSContact::getUrls(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -1011,7 +1011,7 @@ bool JSContact::setUrls(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -1035,7 +1035,7 @@ JSValueRef JSContact::getRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -1061,7 +1061,7 @@ bool JSContact::setRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -1103,7 +1103,7 @@ JSValueRef JSContact::getGroupIds(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -1125,7 +1125,7 @@ bool JSContact::setGroupIds(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -1139,7 +1139,7 @@ JSValueRef JSContact::convertToString(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactPtr contact(NULL); @@ -1149,7 +1149,7 @@ JSValueRef JSContact::convertToString(JSContextRef context, ThrowMsg(InvalidArgumentException, "No private object."); } } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1175,13 +1175,13 @@ JSValueRef JSContact::convertToString(JSContextRef context, Try { vCard = contact->convertToString(format); } Catch(ConversionException) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be 'ContactTextFormat string'"); } Catch(UnsupportedException) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Only support vCard 3.0"); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1190,7 +1190,7 @@ JSValueRef JSContact::convertToString(JSContextRef context, Try { result = converter->toJSValueRef(vCard); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -1204,7 +1204,7 @@ JSValueRef JSContact::clone(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactPtr contact(NULL); @@ -1214,7 +1214,7 @@ JSValueRef JSContact::clone(JSContextRef context, ThrowMsg(InvalidArgumentException, "No private object."); } } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1226,7 +1226,7 @@ JSValueRef JSContact::clone(JSContextRef context, Try { clonedContact = contact->clone(); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1239,7 +1239,7 @@ JSValueRef JSContact::clone(JSContextRef context, JSContextRef gContext = priv->getContext(); result = createJSObject(gContext, clonedContact); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } TIME_TRACER_ITEM_END(__FUNCTION__, 0); diff --git a/src/Contact/JSContactAddress.cpp b/src/Contact/JSContactAddress.cpp old mode 100755 new mode 100644 index 4eec716..4b0f6e5 --- a/src/Contact/JSContactAddress.cpp +++ b/src/Contact/JSContactAddress.cpp @@ -29,6 +29,7 @@ #include "ContactConverter.h" #include "JSContactAddress.h" #include "JSContactAddressTypeArray.h" +#include #define CONTACT_CLASS_NAME "ContactAddress" @@ -141,7 +142,7 @@ JSObjectRef JSContactAddress::createJSObject(JSContextRef context, const Contact JSContactAddressPriv *priv = new JSContactAddressPriv(context, contactAddress); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -166,7 +167,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); bool js1stParamIsObject = false; @@ -190,7 +191,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context, } } Catch(Exception ) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'"); return NULL; } @@ -206,7 +207,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context, contactEmailAddress = ContactAddressPtr(new ContactAddress()); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'ContactAddressInit object'"); return NULL; } @@ -216,7 +217,7 @@ JSObjectRef JSContactAddress::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactEmailAddress); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -249,7 +250,7 @@ JSValueRef JSContactAddress::getCountry(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -274,7 +275,7 @@ bool JSContactAddress::setCountry(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -298,7 +299,7 @@ JSValueRef JSContactAddress::getRegion(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -323,7 +324,7 @@ bool JSContactAddress::setRegion(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -346,7 +347,7 @@ JSValueRef JSContactAddress::getCity(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -371,7 +372,7 @@ bool JSContactAddress::setCity(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -395,7 +396,7 @@ JSValueRef JSContactAddress::getStreetAddress(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -420,7 +421,7 @@ bool JSContactAddress::setStreetAddress(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -444,7 +445,7 @@ JSValueRef JSContactAddress::getAdditionalInformation(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -469,7 +470,7 @@ bool JSContactAddress::setAdditionalInformation(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -493,7 +494,7 @@ JSValueRef JSContactAddress::getPostalCode(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -518,7 +519,7 @@ bool JSContactAddress::setPostalCode(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -539,7 +540,7 @@ JSValueRef JSContactAddress::getIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -561,7 +562,7 @@ bool JSContactAddress::setIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -600,7 +601,7 @@ JSValueRef JSContactAddress::getTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -622,7 +623,7 @@ bool JSContactAddress::setTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactAddressArray.cpp b/src/Contact/JSContactAddressArray.cpp old mode 100755 new mode 100644 index e54a948..11efdc5 --- a/src/Contact/JSContactAddressArray.cpp +++ b/src/Contact/JSContactAddressArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactAddressArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactAddressArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactAddressArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactAddressArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactAddressArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactAddressArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactAddressArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactAddressArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactAddressArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactAddressArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactAddressArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactAddressArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactAddressArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactAddressArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactAddressTypeArray.cpp b/src/Contact/JSContactAddressTypeArray.cpp old mode 100755 new mode 100644 index 2cb345d..a1e4a27 --- a/src/Contact/JSContactAddressTypeArray.cpp +++ b/src/Contact/JSContactAddressTypeArray.cpp @@ -23,13 +23,13 @@ */ #include -#include #include #include #include #include #include "ContactConverter.h" #include "JSContactAddressTypeArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -117,7 +117,7 @@ JSValueRef JSContactAddressTypeArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -227,7 +227,7 @@ JSValueRef JSContactAddressTypeArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -264,7 +264,7 @@ bool JSContactAddressTypeArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -295,7 +295,7 @@ bool JSContactAddressTypeArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -326,7 +326,7 @@ void JSContactAddressTypeArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -373,7 +373,7 @@ JSValueRef JSContactAddressTypeArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -407,7 +407,7 @@ JSValueRef JSContactAddressTypeArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactAddressTypeArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactAddressTypeArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactAddressTypeArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactAddressTypeArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactAddressTypeArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactAddressTypeArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactAnniversary.cpp b/src/Contact/JSContactAnniversary.cpp old mode 100755 new mode 100644 index f5b234e..ce89d5f --- a/src/Contact/JSContactAnniversary.cpp +++ b/src/Contact/JSContactAnniversary.cpp @@ -28,6 +28,7 @@ #include #include "ContactConverter.h" #include "JSContactAnniversary.h" +#include #define FILTER_CLASS_NAME "Anniversary" #define CONTACT_ATTR_DATE "date" @@ -127,7 +128,7 @@ JSObjectRef JSContactAnniversary::createJSObject(JSContextRef context, ContactAn JSContactAnniversaryPriv *priv = new JSContactAnniversaryPriv(context, contactAnniversary); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -152,7 +153,7 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactAnniversaryPriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -193,7 +194,7 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context, date = converter->toDateTm(arguments[0]); contactAnniversary->setDate(date); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'Date object'"); return NULL; } @@ -203,7 +204,7 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactAnniversary); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -233,7 +234,7 @@ JSValueRef JSContactAnniversary::getDate(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -253,7 +254,7 @@ bool JSContactAnniversary::setDate(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -276,7 +277,7 @@ JSValueRef JSContactAnniversary::getLabel(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -301,7 +302,7 @@ bool JSContactAnniversary::setLabel(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactAnniversaryArray.cpp b/src/Contact/JSContactAnniversaryArray.cpp old mode 100755 new mode 100644 index 41afa75..bef0c29 --- a/src/Contact/JSContactAnniversaryArray.cpp +++ b/src/Contact/JSContactAnniversaryArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactAnniversaryArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactAnniversaryArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactAnniversaryArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactAnniversaryArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactAnniversaryArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactAnniversaryArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactAnniversaryArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactAnniversaryArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactAnniversaryArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactAnniversaryArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactAnniversaryArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactAnniversaryArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactAnniversaryArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactAnniversaryArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactArray.cpp b/src/Contact/JSContactArray.cpp old mode 100755 new mode 100644 index 58275a5..782abca --- a/src/Contact/JSContactArray.cpp +++ b/src/Contact/JSContactArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactEmailAddress.cpp b/src/Contact/JSContactEmailAddress.cpp old mode 100755 new mode 100644 index 341efb3..f8c802b --- a/src/Contact/JSContactEmailAddress.cpp +++ b/src/Contact/JSContactEmailAddress.cpp @@ -29,6 +29,7 @@ #include "ContactConverter.h" #include "JSContactEmailAddressTypeArray.h" #include "JSContactEmailAddress.h" +#include #define CONTACT_CLASS_NAME "EmailAddress" @@ -132,7 +133,7 @@ JSObjectRef JSContactEmailAddress::createJSObject(JSContextRef context, JSContactEmailAddressPriv *priv = new JSContactEmailAddressPriv(context, emailAddress); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -157,7 +158,7 @@ JSObjectRef JSContactEmailAddress::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactEmailAddressPriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -211,7 +212,7 @@ JSObjectRef JSContactEmailAddress::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactEmailAddress); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -241,7 +242,7 @@ JSValueRef JSContactEmailAddress::getEmail(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -261,7 +262,7 @@ bool JSContactEmailAddress::setEmail(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -282,7 +283,7 @@ JSValueRef JSContactEmailAddress::getIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -304,7 +305,7 @@ bool JSContactEmailAddress::setIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -344,7 +345,7 @@ JSValueRef JSContactEmailAddress::getTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -369,7 +370,7 @@ bool JSContactEmailAddress::setTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactEmailAddressArray.cpp b/src/Contact/JSContactEmailAddressArray.cpp old mode 100755 new mode 100644 index 382b4be..9951d4f --- a/src/Contact/JSContactEmailAddressArray.cpp +++ b/src/Contact/JSContactEmailAddressArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactEmailAddressArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactEmailAddressArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactEmailAddressArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactEmailAddressArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactEmailAddressArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactEmailAddressArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactEmailAddressArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactEmailAddressArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactEmailAddressArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactEmailAddressArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactEmailAddressArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactEmailAddressArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactEmailAddressArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactEmailAddressArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactEmailAddressTypeArray.cpp b/src/Contact/JSContactEmailAddressTypeArray.cpp old mode 100755 new mode 100644 index c6e2198..12e25da --- a/src/Contact/JSContactEmailAddressTypeArray.cpp +++ b/src/Contact/JSContactEmailAddressTypeArray.cpp @@ -23,13 +23,13 @@ */ #include -#include #include #include #include #include #include "ContactConverter.h" #include "JSContactEmailAddressTypeArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -117,7 +117,7 @@ JSValueRef JSContactEmailAddressTypeArray::getLength(JSContextRef context, } Catch(Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactEmailAddressTypeArray::getProperty(JSContextRef context, } Catch(Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactEmailAddressTypeArray::setProperty(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -294,7 +294,7 @@ bool JSContactEmailAddressTypeArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -325,7 +325,7 @@ void JSContactEmailAddressTypeArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -372,7 +372,7 @@ JSValueRef JSContactEmailAddressTypeArray::concat(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -405,7 +405,7 @@ JSValueRef JSContactEmailAddressTypeArray::join(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -432,7 +432,7 @@ JSValueRef JSContactEmailAddressTypeArray::pop(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -458,7 +458,7 @@ JSValueRef JSContactEmailAddressTypeArray::push(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -481,7 +481,7 @@ JSValueRef JSContactEmailAddressTypeArray::reverse(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -508,7 +508,7 @@ JSValueRef JSContactEmailAddressTypeArray::shift(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -553,7 +553,7 @@ JSValueRef JSContactEmailAddressTypeArray::slice(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -576,7 +576,7 @@ JSValueRef JSContactEmailAddressTypeArray::sort(JSContextRef context, } Catch(Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactGroup.cpp b/src/Contact/JSContactGroup.cpp old mode 100755 new mode 100644 index a510287..d09c646 --- a/src/Contact/JSContactGroup.cpp +++ b/src/Contact/JSContactGroup.cpp @@ -23,13 +23,12 @@ */ #include "JSContactGroup.h" - -#include #include #include #include #include #include "ContactConverter.h" +#include #define CONTACT_CLASS_NAME "ContactGroup" #define CONTACT_PROP_ATTR_ID "id" @@ -142,7 +141,7 @@ JSObjectRef JSContactGroup::createJSObject(JSContextRef context, ContactGroupPtr JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -169,7 +168,7 @@ JSObjectRef JSContactGroup::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactGroupPriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -207,7 +206,7 @@ JSObjectRef JSContactGroup::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactGroup); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -240,7 +239,7 @@ JSValueRef JSContactGroup::getId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -267,7 +266,7 @@ bool JSContactGroup::setId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); } JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -291,7 +290,7 @@ JSValueRef JSContactGroup::getAddressBookId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -317,7 +316,7 @@ bool JSContactGroup::setAddressBookId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -341,7 +340,7 @@ JSValueRef JSContactGroup::getName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -367,7 +366,7 @@ bool JSContactGroup::setName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -391,7 +390,7 @@ JSValueRef JSContactGroup::getRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -417,7 +416,7 @@ bool JSContactGroup::setRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -441,7 +440,7 @@ JSValueRef JSContactGroup::getPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -467,7 +466,7 @@ bool JSContactGroup::setPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -489,7 +488,7 @@ JSValueRef JSContactGroup::getReadOnly(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); diff --git a/src/Contact/JSContactGroupArray.cpp b/src/Contact/JSContactGroupArray.cpp old mode 100755 new mode 100644 index 5387622..52d9b91 --- a/src/Contact/JSContactGroupArray.cpp +++ b/src/Contact/JSContactGroupArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactGroupArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactGroupArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactGroupArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactGroupArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactGroupArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactGroupArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactGroupArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactGroupArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactGroupArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactGroupArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactGroupArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactGroupArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactGroupArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactGroupArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactManager.cpp b/src/Contact/JSContactManager.cpp old mode 100755 new mode 100644 index bea6ce9..8e1555e --- a/src/Contact/JSContactManager.cpp +++ b/src/Contact/JSContactManager.cpp @@ -25,7 +25,6 @@ #include "JSContactManager.h" #include -#include #include #include #include @@ -48,6 +47,7 @@ #include #include #include +#include namespace DeviceAPI { namespace Contact { @@ -115,7 +115,7 @@ JSClassRef JSContactManager::m_classRef = JSClassCreate(JSContactManager::getCla void JSContactManager::Initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); ContactManagerPtr contactManager = ContactFactory::getInstance().createContactManager(); ContactManagerController *priv = new ContactManagerController(context, contactManager); @@ -125,9 +125,9 @@ void JSContactManager::Initialize(JSContextRef context, void JSContactManager::Finalize(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); ContactManagerController *priv = static_cast(JSObjectGetPrivate(object)); - LogInfo("Delete address book manager"); + LoggerI("Delete address book manager"); delete priv; } @@ -138,7 +138,7 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr contactManager; JSContextRef gContext; @@ -154,7 +154,7 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context, contactManager = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -200,7 +200,7 @@ JSValueRef JSContactManager::getAddressBooks(JSContextRef context, contactManager->getAddressBooks(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -216,12 +216,12 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerController *priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -234,7 +234,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context, contactManager = priv->getObject(); gContext = priv->getContext(); } Catch(Exception) { - LogError("contact manager or context is null"); + LoggerE("contact manager or context is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -247,7 +247,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context, Try { contactManager->getDefaultAddressBook(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -258,7 +258,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error"); + LoggerE("Not Found error"); oss << "No default address book"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -277,7 +277,7 @@ JSValueRef JSContactManager::getDefaultAddressBook(JSContextRef context, Try { resultValue = converter->toJSValueRef(defaultAddressBook); } Catch(Exception){ - LogError("Conversion error."); + LoggerE("Conversion error."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -292,12 +292,12 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerController *priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -310,7 +310,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context, contactManager = priv->getObject(); gContext = priv->getContext(); } Catch(Exception) { - LogError("contact manager or context is null"); + LoggerE("contact manager or context is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -323,7 +323,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context, Try { contactManager->getUnifiedAddressBook(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -334,7 +334,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error"); + LoggerE("Not Found error"); oss << "No default address book"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -353,7 +353,7 @@ JSValueRef JSContactManager::getUnifiedAddressBook(JSContextRef context, Try { resultValue = converter->toJSValueRef(unifiedAddressBook); } Catch(Exception){ - LogError("Conversion error."); + LoggerE("Conversion error."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -368,12 +368,12 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerController *priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -386,7 +386,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context, contactManager = priv->getObject(); gContext = priv->getContext(); } Catch(Exception) { - LogError("contact manager or context is null"); + LoggerE("contact manager or context is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -414,7 +414,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context, Try { contactManager->getAddressBook(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -425,7 +425,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << addressBookId); + LoggerE("Not Found error : " << addressBookId); oss << "No Contact id '" << addressBookId << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -444,7 +444,7 @@ JSValueRef JSContactManager::getAddressBook(JSContextRef context, Try { resultValue = converter->toJSValueRef(addressBook); } Catch(Exception){ - LogError("Conversion error."); + LoggerE("Conversion error."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -459,7 +459,7 @@ JSValueRef JSContactManager::get(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; ContactManagerController *controller; @@ -471,7 +471,7 @@ JSValueRef JSContactManager::get(JSContextRef context, } addressBook = controller->getObject(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -480,7 +480,7 @@ JSValueRef JSContactManager::get(JSContextRef context, if (argumentCount < 1) { /* 1st Argument must be string. */ - LogError("1st argument must not be undefined."); + LoggerE("1st argument must not be undefined."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, "No Contact id 'undefined'"); } @@ -508,7 +508,7 @@ JSValueRef JSContactManager::get(JSContextRef context, Try { addressBook->get(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -519,7 +519,7 @@ JSValueRef JSContactManager::get(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << id); + LoggerE("Not Found error : " << id); oss << "No Person id '" << id << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); break; @@ -538,7 +538,7 @@ JSValueRef JSContactManager::get(JSContextRef context, Try { result = converter->toJSValueRef(person); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -553,7 +553,7 @@ JSValueRef JSContactManager::update(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; ContactManagerController *controller; @@ -565,7 +565,7 @@ JSValueRef JSContactManager::update(JSContextRef context, } addressBook = controller->getObject(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -593,7 +593,7 @@ JSValueRef JSContactManager::update(JSContextRef context, ThrowMsg(InvalidArgumentException, "1st argument is not a 'Contact object'."); person = converter->toPerson(arguments[0]); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument is not a 'Contact object'"); } @@ -605,7 +605,7 @@ JSValueRef JSContactManager::update(JSContextRef context, Try { addressBook->update(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -639,7 +639,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; JSContextRef gContext; @@ -656,7 +656,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -701,7 +701,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context, Try { dplEvent->setPersons(converter->toPersonArray(arguments[0])); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be a 'function' or a 'null'"); } @@ -717,7 +717,7 @@ JSValueRef JSContactManager::updateBatch(JSContextRef context, addressBook->updateBatch(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -734,7 +734,7 @@ JSValueRef JSContactManager::remove(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; ContactManagerController *controller; @@ -746,7 +746,7 @@ JSValueRef JSContactManager::remove(JSContextRef context, } addressBook = controller->getObject(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -777,7 +777,7 @@ JSValueRef JSContactManager::remove(JSContextRef context, Try { addressBook->remove(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -789,7 +789,7 @@ JSValueRef JSContactManager::remove(JSContextRef context, { case ExceptionCodes::NotFoundException: case ExceptionCodes::InvalidArgumentException: - LogError("Not Found error : " << personId); + LoggerE("Not Found error : " << personId); oss << "No Contact id '" << personId << "'"; return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, oss.str()); @@ -816,7 +816,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; JSContextRef gContext; @@ -833,7 +833,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -877,7 +877,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context, Try { dplEvent->setPersonIds(converter->toStringArray(arguments[0])); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be an array of 'Contact id'"); } @@ -892,7 +892,7 @@ JSValueRef JSContactManager::removeBatch(JSContextRef context, addressBook->removeBatch(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -908,7 +908,7 @@ JSValueRef JSContactManager::find(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; JSContextRef gContext; @@ -926,7 +926,7 @@ JSValueRef JSContactManager::find(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -976,7 +976,7 @@ JSValueRef JSContactManager::find(JSContextRef context, if (js3rdParamIsObject) dplEvent->setFilter(filterConverter->toFilter(arguments[2])); } Catch(Exception) { - LogError("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "3rd argument must be an 'Filter object' or 'null'"); } @@ -984,7 +984,7 @@ JSValueRef JSContactManager::find(JSContextRef context, if (js4thParamIsObject) dplEvent->setSortMode(filterConverter->toSortMode(arguments[3])); } Catch(Exception) { - LogError("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "4th argument must be an 'SortMode object' or 'null'"); } @@ -999,7 +999,7 @@ JSValueRef JSContactManager::find(JSContextRef context, addressBook->find(dplEvent); ContactAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1015,7 +1015,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; JSContextRef gContext; @@ -1031,7 +1031,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1090,7 +1090,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context, ThrowMsg(ConversionException, "2nd argument must have at least one function"); } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } @@ -1115,7 +1115,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context, Try { addressBook->addChangeListener(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -1143,7 +1143,7 @@ JSValueRef JSContactManager::addChangeListener(JSContextRef context, Try { result = converter->toJSValueRefLong(watchId); } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -1157,7 +1157,7 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); ContactManagerPtr addressBook; JSContextRef gContext; @@ -1171,7 +1171,7 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context, addressBook = controller->getObject(); gContext = controller->getContext(); } Catch(Exception) { - LogError("No private object"); + LoggerE("No private object"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -1202,7 +1202,7 @@ JSValueRef JSContactManager::removeChangeListener(JSContextRef context, Try { addressBook->removeChangeListener(dplEvent); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } diff --git a/src/Contact/JSContactManagerChangeCallbackManager.cpp b/src/Contact/JSContactManagerChangeCallbackManager.cpp old mode 100755 new mode 100644 index 07be09c..2d5536c --- a/src/Contact/JSContactManagerChangeCallbackManager.cpp +++ b/src/Contact/JSContactManagerChangeCallbackManager.cpp @@ -23,7 +23,7 @@ */ #include "JSContactManagerChangeCallbackManager.h" -#include +#include namespace DeviceAPI { namespace Contact { @@ -185,7 +185,7 @@ void JSContactManagerChangeCallbackManager::callOnPersonsAdded( JSValueRef conta { if ( m_onPersonsAdded == NULL ) { - //LogDebug("onpersonsadded callback is not set"); + //LoggerD("onpersonsadded callback is not set"); return; } JSValueRef objParam[1] = { contacts }; @@ -196,7 +196,7 @@ void JSContactManagerChangeCallbackManager::callOnPersonsUpdated( JSValueRef con { if ( m_onPersonsUpdated == NULL ) { - //LogDebug("onpersonsupdated callback is not set"); + //LoggerD("onpersonsupdated callback is not set"); return; } JSValueRef objParam[1] = { contacts }; @@ -207,7 +207,7 @@ void JSContactManagerChangeCallbackManager::callOnPersonsDeleted( JSValueRef con { if ( m_onPersonsDeleted == NULL ) { - //LogDebug("onpersonsdeleted callback is not set"); + //LoggerD("onpersonsdeleted callback is not set"); return; } JSValueRef objParam[1] = { contactIds }; @@ -218,7 +218,7 @@ void JSContactManagerChangeCallbackManager::callOnError( JSValueRef error ) { if ( m_onError == NULL ) { - //LogDebug("Error callback is not set"); + //LoggerD("Error callback is not set"); return; } JSValueRef objParam[1] = { error }; @@ -230,7 +230,7 @@ void JSContactManagerChangeCallbackManager::makeCallback(JSContextRef context, J if (callback == NULL) { - LogError("callback is NULL"); + LoggerE("callback is NULL"); return; } @@ -238,12 +238,12 @@ void JSContactManagerChangeCallbackManager::makeCallback(JSContextRef context, J { if (argc == 0) { - //LogDebug("Calling object directly, no arguments"); + //LoggerD("Calling object directly, no arguments"); JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL); } else { - //LogDebug("Calling object directly, one argument"); + //LoggerD("Calling object directly, one argument"); JSObjectCallAsFunction(context, callback, object, argc, argv, NULL); } return; diff --git a/src/Contact/JSContactName.cpp b/src/Contact/JSContactName.cpp old mode 100755 new mode 100644 index d6ba76a..1419b54 --- a/src/Contact/JSContactName.cpp +++ b/src/Contact/JSContactName.cpp @@ -22,13 +22,13 @@ * @brief Implementation of the JSContactName class */ -#include #include #include #include #include #include "ContactConverter.h" #include "JSContactName.h" +#include #define CONTACT_CLASS_NAME "ContactName" #define CONTACT_PROP_ATTR_PREFIX "prefix" @@ -149,7 +149,7 @@ JSObjectRef JSContactName::createJSObject(JSContextRef context, ContactNamePtr c JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -176,7 +176,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); bool js1stParamIsObject = false; @@ -200,7 +200,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context, } } Catch(Exception ) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be 'object'"); return NULL; } @@ -215,7 +215,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context, contactName = ContactNamePtr(new ContactName()); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -225,7 +225,7 @@ JSObjectRef JSContactName::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactName); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -258,7 +258,7 @@ JSValueRef JSContactName::getPrefix(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -284,7 +284,7 @@ bool JSContactName::setPrefix(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -307,7 +307,7 @@ JSValueRef JSContactName::getSuffix(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -332,7 +332,7 @@ bool JSContactName::setSuffix(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -355,7 +355,7 @@ JSValueRef JSContactName::getFirstName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -379,7 +379,7 @@ bool JSContactName::setFirstName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -403,7 +403,7 @@ JSValueRef JSContactName::getMiddleName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -429,7 +429,7 @@ bool JSContactName::setMiddleName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -453,7 +453,7 @@ JSValueRef JSContactName::getLastName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -479,7 +479,7 @@ bool JSContactName::setLastName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -519,7 +519,7 @@ JSValueRef JSContactName::getNicknames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -541,7 +541,7 @@ bool JSContactName::setNicknames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -584,7 +584,7 @@ JSValueRef JSContactName::getPhoneticFirstName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -610,7 +610,7 @@ bool JSContactName::setPhoneticFirstName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -634,7 +634,7 @@ JSValueRef JSContactName::getPhoneticLastName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -660,7 +660,7 @@ bool JSContactName::setPhoneticLastName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -684,7 +684,7 @@ JSValueRef JSContactName::getDisplayName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); diff --git a/src/Contact/JSContactOrganization.cpp b/src/Contact/JSContactOrganization.cpp old mode 100755 new mode 100644 index ee2252c..e8e00e4 --- a/src/Contact/JSContactOrganization.cpp +++ b/src/Contact/JSContactOrganization.cpp @@ -28,6 +28,7 @@ #include #include #include "ContactConverter.h" +#include #define ORGANIZATION_CLASS_NAME "ContactOrganization" @@ -136,7 +137,7 @@ JSObjectRef JSContactOrganization::createJSObject(JSContextRef context, ContactO JSContactOrganizationPriv *priv = new JSContactOrganizationPriv(context, contactOrganization); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -161,7 +162,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); bool js1stParamIsObject = false; @@ -185,7 +186,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context, } } Catch(Exception ) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be a 'object'"); return NULL; } @@ -200,7 +201,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context, contactOrganization = ContactOrganizationPtr(new ContactOrganization()); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -210,7 +211,7 @@ JSObjectRef JSContactOrganization::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactOrganization); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Internal error"); return NULL; } @@ -243,7 +244,7 @@ JSValueRef JSContactOrganization::getName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -268,7 +269,7 @@ bool JSContactOrganization::setName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -292,7 +293,7 @@ JSValueRef JSContactOrganization::getDepartment(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -317,7 +318,7 @@ bool JSContactOrganization::setDepartment(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -359,7 +360,7 @@ JSValueRef JSContactOrganization::getTitle(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -384,7 +385,7 @@ bool JSContactOrganization::setTitle(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -407,7 +408,7 @@ JSValueRef JSContactOrganization::getRole(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -432,7 +433,7 @@ bool JSContactOrganization::setRole(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -455,7 +456,7 @@ JSValueRef JSContactOrganization::getLogoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -480,7 +481,7 @@ bool JSContactOrganization::setLogoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactOrganizationArray.cpp b/src/Contact/JSContactOrganizationArray.cpp old mode 100755 new mode 100644 index 8533dc8..1d35783 --- a/src/Contact/JSContactOrganizationArray.cpp +++ b/src/Contact/JSContactOrganizationArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactOrganizationArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactOrganizationArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -225,7 +225,7 @@ JSValueRef JSContactOrganizationArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -262,7 +262,7 @@ bool JSContactOrganizationArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -295,7 +295,7 @@ bool JSContactOrganizationArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -326,7 +326,7 @@ void JSContactOrganizationArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -370,7 +370,7 @@ JSValueRef JSContactOrganizationArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -405,7 +405,7 @@ JSValueRef JSContactOrganizationArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -433,7 +433,7 @@ JSValueRef JSContactOrganizationArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -459,7 +459,7 @@ JSValueRef JSContactOrganizationArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -483,7 +483,7 @@ JSValueRef JSContactOrganizationArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -510,7 +510,7 @@ JSValueRef JSContactOrganizationArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -556,7 +556,7 @@ JSValueRef JSContactOrganizationArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -580,7 +580,7 @@ JSValueRef JSContactOrganizationArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactPhoneNumber.cpp b/src/Contact/JSContactPhoneNumber.cpp old mode 100755 new mode 100644 index fdd84c2..81bbbd2 --- a/src/Contact/JSContactPhoneNumber.cpp +++ b/src/Contact/JSContactPhoneNumber.cpp @@ -22,7 +22,6 @@ * @brief Implementation of the JSContactPhoneNumber class */ -#include #include #include #include @@ -30,6 +29,7 @@ #include "ContactConverter.h" #include "JSContactPhoneNumberTypeArray.h" #include "JSContactPhoneNumber.h" +#include #define FILTER_CLASS_NAME "ContactPhoneNumber" @@ -132,7 +132,7 @@ JSObjectRef JSContactPhoneNumber::createJSObject(JSContextRef context, ContactPh JSContactPhoneNumberPriv *priv = new JSContactPhoneNumberPriv(context, contactPhoneNumber); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -157,7 +157,7 @@ JSObjectRef JSContactPhoneNumber::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactPhoneNumberPriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -210,7 +210,7 @@ JSObjectRef JSContactPhoneNumber::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactPhoneNumber); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -240,7 +240,7 @@ JSValueRef JSContactPhoneNumber::getNumber(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -260,7 +260,7 @@ bool JSContactPhoneNumber::setNumber(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -281,7 +281,7 @@ JSValueRef JSContactPhoneNumber::getIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -303,7 +303,7 @@ bool JSContactPhoneNumber::setIsDefault(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -342,7 +342,7 @@ JSValueRef JSContactPhoneNumber::getTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -363,7 +363,7 @@ bool JSContactPhoneNumber::setTypes(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactPhoneNumberArray.cpp b/src/Contact/JSContactPhoneNumberArray.cpp old mode 100755 new mode 100644 index 693d642..0e7a7f0 --- a/src/Contact/JSContactPhoneNumberArray.cpp +++ b/src/Contact/JSContactPhoneNumberArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactPhoneNumberArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactPhoneNumberArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactPhoneNumberArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactPhoneNumberArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactPhoneNumberArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactPhoneNumberArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactPhoneNumberArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactPhoneNumberArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactPhoneNumberArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactPhoneNumberArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactPhoneNumberArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactPhoneNumberArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactPhoneNumberArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactPhoneNumberArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactPhoneNumberTypeArray.cpp b/src/Contact/JSContactPhoneNumberTypeArray.cpp old mode 100755 new mode 100644 index e25c3e7..49826c0 --- a/src/Contact/JSContactPhoneNumberTypeArray.cpp +++ b/src/Contact/JSContactPhoneNumberTypeArray.cpp @@ -23,13 +23,13 @@ */ #include -#include #include #include #include #include #include "ContactConverter.h" #include "JSContactPhoneNumberTypeArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -117,7 +117,7 @@ JSValueRef JSContactPhoneNumberTypeArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactPhoneNumberTypeArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -262,7 +262,7 @@ bool JSContactPhoneNumberTypeArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -293,7 +293,7 @@ bool JSContactPhoneNumberTypeArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -324,7 +324,7 @@ void JSContactPhoneNumberTypeArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactPhoneNumberTypeArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -404,7 +404,7 @@ JSValueRef JSContactPhoneNumberTypeArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -432,7 +432,7 @@ JSValueRef JSContactPhoneNumberTypeArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -458,7 +458,7 @@ JSValueRef JSContactPhoneNumberTypeArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -481,7 +481,7 @@ JSValueRef JSContactPhoneNumberTypeArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -507,7 +507,7 @@ JSValueRef JSContactPhoneNumberTypeArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -552,7 +552,7 @@ JSValueRef JSContactPhoneNumberTypeArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -575,7 +575,7 @@ JSValueRef JSContactPhoneNumberTypeArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSContactRef.cpp b/src/Contact/JSContactRef.cpp old mode 100755 new mode 100644 index 7925cbe..0a8c775 --- a/src/Contact/JSContactRef.cpp +++ b/src/Contact/JSContactRef.cpp @@ -22,13 +22,13 @@ * @brief Implementation of the JSContactRef class */ -#include #include #include #include #include #include "ContactConverter.h" #include "JSContactRef.h" +#include #define CONTACT_CLASS_NAME "ContactRef" #define CONTACT_PROP_ATTR_ADDRESS_BOOK_ID "addressBookId" @@ -133,7 +133,7 @@ JSObjectRef JSContactRef::createJSObject(JSContextRef context, ContactRefPtr con JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -160,7 +160,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactRefPriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -180,7 +180,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context, ThrowMsg(InvalidArgumentException, "2nd argument must be contact id"); } Catch(Exception ) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Wrong arguments"); return NULL; } @@ -193,7 +193,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context, Try { addressBookId = converter->toString(arguments[0]); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -201,7 +201,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context, Try { contactId = converter->toString(arguments[1]); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -215,7 +215,7 @@ JSObjectRef JSContactRef::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactRef); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -245,7 +245,7 @@ JSValueRef JSContactRef::getAddressBookId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -267,7 +267,7 @@ bool JSContactRef::setAddressBookId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); } JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -288,7 +288,7 @@ JSValueRef JSContactRef::getContactId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -310,7 +310,7 @@ bool JSContactRef::setContactId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); } JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); diff --git a/src/Contact/JSContactWebSite.cpp b/src/Contact/JSContactWebSite.cpp old mode 100755 new mode 100644 index 1455c6c..a8bce26 --- a/src/Contact/JSContactWebSite.cpp +++ b/src/Contact/JSContactWebSite.cpp @@ -28,6 +28,7 @@ #include #include "ContactConverter.h" #include "JSContactWebSite.h" +#include #define CONTACT_CLASS_NAME "ContactWebSite" @@ -128,7 +129,7 @@ JSObjectRef JSContactWebSite::createJSObject(JSContextRef context, ContactWebSit JSContactWebSitePriv *priv = new JSContactWebSitePriv(context, contactWebSite); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -153,7 +154,7 @@ JSObjectRef JSContactWebSite::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSContactWebSitePriv *priv = static_cast(JSObjectGetPrivate(constructor)); if (!priv) { @@ -198,7 +199,7 @@ JSObjectRef JSContactWebSite::constructor(JSContextRef context, Try { jsobject = createJSObject(gContext, contactWebSite); } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments"); return NULL; } @@ -228,7 +229,7 @@ JSValueRef JSContactWebSite::getUrl(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -248,7 +249,7 @@ bool JSContactWebSite::setUrl(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; @@ -273,7 +274,7 @@ JSValueRef JSContactWebSite::getType(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -301,7 +302,7 @@ bool JSContactWebSite::setType(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return true; diff --git a/src/Contact/JSContactWebSiteArray.cpp b/src/Contact/JSContactWebSiteArray.cpp old mode 100755 new mode 100644 index 74a83d5..27e6b16 --- a/src/Contact/JSContactWebSiteArray.cpp +++ b/src/Contact/JSContactWebSiteArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSContactWebSiteArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSContactWebSiteArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSContactWebSiteArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSContactWebSiteArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -296,7 +296,7 @@ bool JSContactWebSiteArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -327,7 +327,7 @@ void JSContactWebSiteArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -371,7 +371,7 @@ JSValueRef JSContactWebSiteArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -406,7 +406,7 @@ JSValueRef JSContactWebSiteArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -434,7 +434,7 @@ JSValueRef JSContactWebSiteArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -460,7 +460,7 @@ JSValueRef JSContactWebSiteArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSContactWebSiteArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -511,7 +511,7 @@ JSValueRef JSContactWebSiteArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -557,7 +557,7 @@ JSValueRef JSContactWebSiteArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -581,7 +581,7 @@ JSValueRef JSContactWebSiteArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSPerson.cpp b/src/Contact/JSPerson.cpp old mode 100755 new mode 100644 index 4903f87..bd171cd --- a/src/Contact/JSPerson.cpp +++ b/src/Contact/JSPerson.cpp @@ -22,7 +22,6 @@ * @brief Implementation of the JSPerson class */ -#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #define FILTER_CLASS_NAME "Person" @@ -153,7 +153,7 @@ JSObjectRef JSPerson::createJSObject(JSContextRef context, PersonPtr person) JSPersonPriv *priv = new JSPersonPriv(context, person); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -197,7 +197,7 @@ JSValueRef JSPerson::getId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -219,7 +219,7 @@ JSValueRef JSPerson::getDisplayName(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -241,7 +241,7 @@ JSValueRef JSPerson::getContactCount(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ JSValueRef JSPerson::getHasPhoneNumber(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -285,7 +285,7 @@ JSValueRef JSPerson::getHasEmail(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -305,7 +305,7 @@ JSValueRef JSPerson::getIsFavorite(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -325,7 +325,7 @@ bool JSPerson::setIsFavorite(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -349,7 +349,7 @@ JSValueRef JSPerson::getPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -374,7 +374,7 @@ bool JSPerson::setPhotoURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -398,7 +398,7 @@ JSValueRef JSPerson::getRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -423,7 +423,7 @@ bool JSPerson::setRingtoneURI(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -446,7 +446,7 @@ JSValueRef JSPerson::getDisplayContactId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -470,7 +470,7 @@ bool JSPerson::setDisplayContactId(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -484,7 +484,7 @@ JSValueRef JSPerson::link(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); PersonPtr person(NULL); @@ -496,7 +496,7 @@ JSValueRef JSPerson::link(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -529,13 +529,13 @@ JSValueRef JSPerson::link(JSContextRef context, } Catch(ConversionException) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be 'PersonId'"); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -576,7 +576,7 @@ JSValueRef JSPerson::unlink(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); PersonPtr person(NULL); @@ -588,7 +588,7 @@ JSValueRef JSPerson::unlink(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong object"); } @@ -621,13 +621,13 @@ JSValueRef JSPerson::unlink(JSContextRef context, } Catch(ConversionException) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "1st argument must be 'ContactId'"); } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } @@ -673,7 +673,7 @@ JSValueRef JSPerson::unlink(JSContextRef context, } Catch(Exception) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Internal error"); } diff --git a/src/Contact/JSPersonArray.cpp b/src/Contact/JSPersonArray.cpp old mode 100755 new mode 100644 index 40db8ee..1509ce3 --- a/src/Contact/JSPersonArray.cpp +++ b/src/Contact/JSPersonArray.cpp @@ -23,12 +23,12 @@ */ #include -#include #include #include #include #include "ContactConverter.h" #include "JSPersonArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -116,7 +116,7 @@ JSValueRef JSPersonArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -226,7 +226,7 @@ JSValueRef JSPersonArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -263,7 +263,7 @@ bool JSPersonArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -297,7 +297,7 @@ bool JSPersonArray::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -329,7 +329,7 @@ void JSPersonArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -373,7 +373,7 @@ JSValueRef JSPersonArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -409,7 +409,7 @@ JSValueRef JSPersonArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -438,7 +438,7 @@ JSValueRef JSPersonArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -464,7 +464,7 @@ JSValueRef JSPersonArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -489,7 +489,7 @@ JSValueRef JSPersonArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -516,7 +516,7 @@ JSValueRef JSPersonArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -562,7 +562,7 @@ JSValueRef JSPersonArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); @@ -587,7 +587,7 @@ JSValueRef JSPersonArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/JSStringArray.cpp b/src/Contact/JSStringArray.cpp old mode 100755 new mode 100644 index 3d5f3be..412c9a7 --- a/src/Contact/JSStringArray.cpp +++ b/src/Contact/JSStringArray.cpp @@ -23,13 +23,13 @@ */ #include -#include #include #include #include #include #include "ContactConverter.h" #include "JSStringArray.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -117,7 +117,7 @@ JSValueRef JSStringArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -227,7 +227,7 @@ JSValueRef JSStringArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -264,7 +264,7 @@ bool JSStringArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } return false; @@ -295,7 +295,7 @@ void JSStringArray::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } @@ -342,7 +342,7 @@ JSValueRef JSStringArray::concat(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -376,7 +376,7 @@ JSValueRef JSStringArray::join(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -404,7 +404,7 @@ JSValueRef JSStringArray::pop(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -430,7 +430,7 @@ JSValueRef JSStringArray::push(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -454,7 +454,7 @@ JSValueRef JSStringArray::reverse(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -481,7 +481,7 @@ JSValueRef JSStringArray::shift(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } @@ -527,7 +527,7 @@ JSValueRef JSStringArray::slice(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); } @@ -551,7 +551,7 @@ JSValueRef JSStringArray::sort(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return JSValueMakeUndefined(context); } diff --git a/src/Contact/Person.cpp b/src/Contact/Person.cpp old mode 100755 new mode 100644 index c243d0e..c94e087 --- a/src/Contact/Person.cpp +++ b/src/Contact/Person.cpp @@ -23,13 +23,12 @@ */ #include "Person.h" - -#include #include #include #include #include "ContactUtility.h" #include "ContactsSvcObjectConverter.h" +#include namespace DeviceAPI { namespace Contact { @@ -40,13 +39,13 @@ using namespace std; Person::Person() : IPerson() { - LogDebug("entered"); + LoggerD("entered"); } Person::Person(contacts_record_h record) : IPerson() { - LogDebug("entered"); + LoggerD("entered"); } Person::~Person() @@ -55,7 +54,7 @@ Person::~Person() void Person::OnRequestReceived(const EventPersonLinkPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; contacts_record_h contacts_record = NULL; @@ -89,7 +88,7 @@ void Person::OnRequestReceived(const EventPersonLinkPtr &event) contacts_record_destroy(contacts_record, true); contacts_record = NULL; - LogDebug("Linking person : " << personId); + LoggerD("Linking person : " << personId); errorCode = contacts_person_link_person(selfPersonId, personId); if(errorCode == CONTACTS_ERROR_INVALID_PARAMETER) @@ -116,26 +115,26 @@ void Person::OnRequestReceived(const EventPersonLinkPtr &event) } Catch (InvalidArgumentException) { - LogError("Invalid person id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid person id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; } Catch (NotFoundException) { - LogError("Person doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Person doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; } Catch (PlatformException) { - LogError("Error during linking person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during linking person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Error during linking person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during linking person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; @@ -144,7 +143,7 @@ void Person::OnRequestReceived(const EventPersonLinkPtr &event) void Person::OnRequestReceived(const EventPersonUnlinkPtr &event) { - LogDebug("entered"); + LoggerD("entered"); int errorCode = 0; int selfPersonId; @@ -190,7 +189,7 @@ void Person::OnRequestReceived(const EventPersonUnlinkPtr &event) ThrowMsg(OutOfRangeException, "Contact (id:" << contactId << ") is not a member of person"); } - LogDebug("Unlinking contact : " << contactId); + LoggerD("Unlinking contact : " << contactId); int newPersonId = 0; int errorCode = contacts_person_unlink_contact(selfPersonId, contactId, &newPersonId); @@ -198,7 +197,7 @@ void Person::OnRequestReceived(const EventPersonUnlinkPtr &event) ThrowMsg(NotFoundException, "Error during executing contacts_person_unlink_contact()"); else if (errorCode != CONTACTS_ERROR_NONE) ThrowMsg(PlatformException, "Error during executing contacts_person_unlink_contact()"); - LogDebug("newPersonId : " << newPersonId); + LoggerD("newPersonId : " << newPersonId); errorCode = contacts_db_get_record(_contacts_person._uri, newPersonId, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE) @@ -230,33 +229,33 @@ void Person::OnRequestReceived(const EventPersonUnlinkPtr &event) } Catch (InvalidArgumentException) { - LogError("Invalid person id : " << _rethrown_exception.GetMessage()); + LoggerE("Invalid person id : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); return; } Catch (NotFoundException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); return; } Catch (OutOfRangeException) { - LogError("Contact doesn't exist : " << _rethrown_exception.GetMessage()); + LoggerE("Contact doesn't exist : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::OutOfRangeException); return; } Catch (PlatformException) { - LogError("Error during linking person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during linking person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; } Catch (Exception) { - LogError("Error during linking person : " << _rethrown_exception.GetMessage()); + LoggerE("Error during linking person : " << _rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); return; diff --git a/src/Contact/PersonSearchEngine.cpp b/src/Contact/PersonSearchEngine.cpp old mode 100755 new mode 100644 index ea045c2..7a9fbe9 --- a/src/Contact/PersonSearchEngine.cpp +++ b/src/Contact/PersonSearchEngine.cpp @@ -30,6 +30,7 @@ #include "Person.h" #include "ContactUtility.h" #include "ContactsSvcObjectConverter.h" +#include namespace DeviceAPI { namespace Contact { @@ -124,7 +125,7 @@ PersonArrayPtr PersonSearchEngine::getResult() errorCode = contacts_list_get_current_record_p(person_list, &contacts_record); if(errorCode != CONTACTS_ERROR_NONE || contacts_record == NULL) { - LogWarning("Fail to get group record (ret:" << errorCode << ")"); + LoggerW("Fail to get group record (ret:" << errorCode << ")"); continue; } diff --git a/src/Contact/plugin_initializer.cpp b/src/Contact/plugin_initializer.cpp old mode 100755 new mode 100644 index 7fd0147..f1b519e --- a/src/Contact/plugin_initializer.cpp +++ b/src/Contact/plugin_initializer.cpp @@ -22,8 +22,6 @@ * @brief */ -#include - #include #include #include @@ -40,6 +38,7 @@ #include "JSContactEmailAddress.h" #include "ContactAsyncCallbackManager.h" #include "ContactListenerManager.h" +#include namespace DeviceAPI { namespace Contact { @@ -49,7 +48,7 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\contact] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { @@ -57,13 +56,13 @@ void on_widget_start_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\contact] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Contact"); TIME_TRACER_RELEASE(); Try @@ -72,18 +71,18 @@ void on_widget_stop_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\contact] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\contact] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); DeviceAPI::Contact::ContactAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); DeviceAPI::Contact::ContactListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/Content/AudioLyrics.cpp b/src/Content/AudioLyrics.cpp index 8f2eca3..abb30fd 100755 --- a/src/Content/AudioLyrics.cpp +++ b/src/Content/AudioLyrics.cpp @@ -15,10 +15,9 @@ // limitations under the License. // - -#include #include #include "AudioLyrics.h" +#include namespace DeviceAPI { namespace Content { diff --git a/src/Content/AudioLyricsUtil.cpp b/src/Content/AudioLyricsUtil.cpp old mode 100755 new mode 100644 index 2200625..2980dd0 --- a/src/Content/AudioLyricsUtil.cpp +++ b/src/Content/AudioLyricsUtil.cpp @@ -15,11 +15,10 @@ // limitations under the License. // - #include "AudioLyricsUtil.h" -#include #include #include +#include using namespace DPL; @@ -31,19 +30,19 @@ namespace Content { metadata_extractor_h m_extractor = NULL; MediaLyricsUtil::MediaLyricsUtil() { - LogDebug("entered "); + LoggerD("entered "); if ( METADATA_EXTRACTOR_ERROR_NONE != metadata_extractor_create(&m_extractor)) { - LogDebug("MetaData Extractor create Fail..."); + LoggerD("MetaData Extractor create Fail..."); } } MediaLyricsUtil::~MediaLyricsUtil() { - LogDebug("entered "); + LoggerD("entered "); if ( m_extractor && METADATA_EXTRACTOR_ERROR_NONE != metadata_extractor_destroy(m_extractor)) { - LogDebug("Metadata extractor destory Fail..."); + LoggerD("Metadata extractor destory Fail..."); } } @@ -55,10 +54,10 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) if (m_extractor) { - LogDebug("Valide Extractor"); + LoggerD("Valide Extractor"); //setpath - LogDebug("set Path : " << filepath); + LoggerD("set Path : " << filepath); if ( METADATA_EXTRACTOR_ERROR_NONE == metadata_extractor_set_path(m_extractor, filepath.c_str()) ) { @@ -67,10 +66,10 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) if ( METADATA_EXTRACTOR_ERROR_NONE == metadata_extractor_get_metadata(m_extractor, attr, &strSyncTextNum) && strSyncTextNum ) { - LogDebug("SYNCHRONIZED"); + LoggerD("SYNCHRONIZED"); int nSyncTextNum = 0; istringstream(strSyncTextNum) >> nSyncTextNum; - LogDebug("nSyncTextNum : " << nSyncTextNum); + LoggerD("nSyncTextNum : " << nSyncTextNum); free(strSyncTextNum); strSyncTextNum = NULL; @@ -89,7 +88,7 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) { lyricsPtr->addMediaLyricsTimeStamp(time_info); lyricsPtr->addMediaLyricsText(lyrics); - LogDebug( "timestamp " << time_info << "lyrics : " << lyrics); + LoggerD( "timestamp " << time_info << "lyrics : " << lyrics); } } @@ -97,7 +96,7 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) } else { - LogDebug("sync Lyrics Error. text num is 0"); + LoggerD("sync Lyrics Error. text num is 0"); char* unSyncText = NULL; attr = METADATA_UNSYNCLYRICS; @@ -107,7 +106,7 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) if (unSyncText) { MediacontentLyricsPtr lyricsPtr(new MediacontentLyrics()); - LogDebug("UNSYNCHRONIZED: " << unSyncText); + LoggerD("UNSYNCHRONIZED: " << unSyncText); lyricsPtr->setMediaLyricsType("UNSYNCHRONIZED"); lyricsPtr->addMediaLyricsTimeStamp(0); lyricsPtr->addMediaLyricsText(unSyncText); @@ -124,7 +123,7 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) } else { - LogDebug("extractor Error!!!"); + LoggerD("extractor Error!!!"); } } @@ -132,7 +131,7 @@ MediacontentLyricsPtr MediaLyricsUtil::fetchLyrics(string filepath) } else { - LogDebug(" extractor is invaild "); + LoggerD(" extractor is invaild "); } return result; diff --git a/src/Content/ContentAudio.cpp b/src/Content/ContentAudio.cpp index be0bc6d..91fd7c8 100755 --- a/src/Content/ContentAudio.cpp +++ b/src/Content/ContentAudio.cpp @@ -15,10 +15,9 @@ // limitations under the License. // - -#include #include #include "ContentAudio.h" +#include namespace DeviceAPI { namespace Content { diff --git a/src/Content/ContentController.cpp b/src/Content/ContentController.cpp old mode 100755 new mode 100644 index 099e941..feb0370 --- a/src/Content/ContentController.cpp +++ b/src/Content/ContentController.cpp @@ -15,15 +15,13 @@ // limitations under the License. // - -#include #include #include #include #include "ContentController.h" #include "ContentConverter.h" #include "ContentAsyncCallbackManager.h" - +#include namespace DeviceAPI { namespace Content { @@ -39,25 +37,25 @@ MediacontentManagerController::MediacontentManagerController(): EventUpdateMediaItemsAnswerReceiver(ThreadEnum::NULL_THREAD), EventFindFolderAnswerReceiver(ThreadEnum::NULL_THREAD) { - LogDebug("create a MediacontentManagerController"); + LoggerD("create a MediacontentManagerController"); } MediacontentManagerController::~MediacontentManagerController() { - LogDebug("<<<"); - LogDebug(">>>"); + LoggerD("<<<"); + LoggerD(">>>"); } void MediacontentManagerController::OnAnswerReceived(const IEventUpdateMediaItemsPtr &event) { - LogDebug("MediacontentManagerController::IEventUpdateMediaItemsPtr:entered"); + LoggerD("MediacontentManagerController::IEventUpdateMediaItemsPtr:entered"); JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if(!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } Try @@ -77,7 +75,7 @@ void MediacontentManagerController::OnAnswerReceived(const IEventUpdateMediaItem } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); } } @@ -85,12 +83,12 @@ void MediacontentManagerController::OnAnswerReceived(const IEventUpdateMediaItem void MediacontentManagerController::OnAnswerReceived(const IEventBrowseFolderPtr &event) { - LogDebug("MediacontentManagerController::OnAnswerReceived:entered"); + LoggerD("MediacontentManagerController::OnAnswerReceived:entered"); JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } Try @@ -113,7 +111,7 @@ void MediacontentManagerController::OnAnswerReceived(const IEventBrowseFolderPtr } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); } } @@ -122,12 +120,12 @@ void MediacontentManagerController::OnAnswerReceived(const IEventBrowseFolderPtr void MediacontentManagerController::OnAnswerReceived(const IEventFindFolderPtr &event) { - LogDebug("MediacontentManagerController::OnAnswerReceived:entered"); + LoggerD("MediacontentManagerController::OnAnswerReceived:entered"); JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } Try @@ -150,7 +148,7 @@ void MediacontentManagerController::OnAnswerReceived(const IEventFindFolderPtr & } Catch(Exception) { - LogError("error during processing answer"); + LoggerE("error during processing answer"); } } diff --git a/src/Content/ContentConverter.cpp b/src/Content/ContentConverter.cpp old mode 100755 new mode 100644 index 4ddbcf3..bbe743e --- a/src/Content/ContentConverter.cpp +++ b/src/Content/ContentConverter.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -28,6 +27,7 @@ #include "JSAudio.h" #include "JSFolder.h" #include "JSAudioLyrics.h" +#include using namespace DeviceAPI::Common; @@ -36,7 +36,7 @@ namespace Content { MediaConverter::MediaConverter(JSContextRef context) : Converter(context) { - LogDebug("entered"); + LoggerD("entered"); } JSValueRef MediaConverter::toFunctionOrNull(const JSValueRef& arg) @@ -112,12 +112,12 @@ JSValueRef MediaConverter::toJSValueRef(const MediacontentLyricsPtr &arg) MediacontentMediaListPtr MediaConverter::toVectorOfMediaItem(JSValueRef events) { - LogDebug("entered"); + LoggerD("entered"); MediacontentMediaListPtr result(new MediacontentMediaList()); std::vector resultVector; JSObjectRef objArg = toJSObjectRef(events); - LogDebug("array length "< +#include namespace DeviceAPI { namespace Content { @@ -72,7 +71,7 @@ FolderContentFilterConverter::FolderContentFilterConverter(JSContextRef context) FolderContentFilterConverter::~FolderContentFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MediaContentFilterConverter::MediaContentFilterConverter(JSContextRef context) : @@ -82,7 +81,7 @@ MediaContentFilterConverter::MediaContentFilterConverter(JSContextRef context) : MediaContentFilterConverter::~MediaContentFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } } // Content diff --git a/src/Content/ContentFilterValidator.cpp b/src/Content/ContentFilterValidator.cpp old mode 100755 new mode 100644 index 17517a4..0be75a7 --- a/src/Content/ContentFilterValidator.cpp +++ b/src/Content/ContentFilterValidator.cpp @@ -15,9 +15,8 @@ // limitations under the License. // - #include "ContentFilterValidator.h" -#include +#include namespace DeviceAPI { @@ -64,12 +63,12 @@ FilterValidatorPtr MediaFilterValidatorFactory::getMediaFilterValidator(QueryTyp if(value == QUERY_FOLDER) { - LogDebug("create validator of folder"); + LoggerD("create validator of folder"); theValidatorInstance = FilterValidatorPtr(new FilterValidator(folderProperties)); } else if(value == QUERY_MEDIA) { - LogDebug("create validator of media item"); + LoggerD("create validator of media item"); theValidatorInstance = FilterValidatorPtr(new FilterValidator(mediaProperties)); } diff --git a/src/Content/ContentFolder.cpp b/src/Content/ContentFolder.cpp old mode 100755 new mode 100644 index bb3e0b9..3c1f84e --- a/src/Content/ContentFolder.cpp +++ b/src/Content/ContentFolder.cpp @@ -15,10 +15,9 @@ // limitations under the License. // - -#include #include #include "ContentFolder.h" +#include namespace DeviceAPI { namespace Content { @@ -126,7 +125,7 @@ string MediacontentFolder::findValue(string attrName) } else { - LogDebug("Attribute(" << attrName << ") There is no data."); + LoggerD("Attribute(" << attrName << ") There is no data."); } return value; } @@ -134,10 +133,10 @@ string MediacontentFolder::findValue(string attrName) void MediacontentFolder::display() const { - LogDebug("m_folderUUID: " << m_folderUUID); - LogDebug("m_folderName: " << m_folderName); - LogDebug("m_folderPath: " << m_folderPath); - LogDebug("m_storageType: " << m_storageType); + LoggerD("m_folderUUID: " << m_folderUUID); + LoggerD("m_folderName: " << m_folderName); + LoggerD("m_folderPath: " << m_folderPath); + LoggerD("m_storageType: " << m_storageType); } diff --git a/src/Content/ContentImage.cpp b/src/Content/ContentImage.cpp old mode 100755 new mode 100644 index 65c9037..f69f25b --- a/src/Content/ContentImage.cpp +++ b/src/Content/ContentImage.cpp @@ -15,18 +15,16 @@ // limitations under the License. // - -#include #include - #include "ContentImage.h" +#include namespace DeviceAPI { namespace Content { MediacontentImage::MediacontentImage() { - LogDebug("enter"); + LoggerD("enter"); m_editableAttrList.push_back("geolocation"); m_editableAttrList.push_back("orientation"); @@ -34,7 +32,7 @@ MediacontentImage::MediacontentImage() MediacontentImage::~MediacontentImage() { - LogDebug("enter"); + LoggerD("enter"); } double MediacontentImage::getImageLatitude() const @@ -114,11 +112,11 @@ bool MediacontentImage::isChangedLongitude() const void MediacontentImage::display() { MediacontentMedia::display(); - LogDebug("m_imageWidth : " << m_imageWidth); - LogDebug("m_imageHeight : " << m_imageHeight); - LogDebug("m_imageOrientation : " << m_imageOrientation); - LogDebug("m_imageLongitude : " << m_imageLongitude); - LogDebug("m_imageLatitude : " << m_imageLatitude); + LoggerD("m_imageWidth : " << m_imageWidth); + LoggerD("m_imageHeight : " << m_imageHeight); + LoggerD("m_imageOrientation : " << m_imageOrientation); + LoggerD("m_imageLongitude : " << m_imageLongitude); + LoggerD("m_imageLatitude : " << m_imageLatitude); } diff --git a/src/Content/ContentListener.cpp b/src/Content/ContentListener.cpp old mode 100755 new mode 100644 index 7a082eb..5f5a668 --- a/src/Content/ContentListener.cpp +++ b/src/Content/ContentListener.cpp @@ -16,18 +16,13 @@ // #include - -#include - #include #include #include #include #include "ContentListener.h" #include "ContentConverter.h" - -#undef LOG_TAG -#define LOG_TAG "TIZEN_DEVICEAPI" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -122,7 +117,7 @@ ContentListener::~ContentListener() { void ContentListener::oncontentadded(MediacontentMediaPtr content) { - LogInfo("ContentListener::oncontentadded is entered"); + LoggerI("ContentListener::oncontentadded is entered"); JSContextRef context = m_callback->getContext(); MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context); @@ -132,7 +127,7 @@ void ContentListener::oncontentadded(MediacontentMediaPtr content) void ContentListener::oncontentupdated(MediacontentMediaPtr content) { - LogInfo("ContentListener::oncontentupdated is entered"); + LoggerI("ContentListener::oncontentupdated is entered"); JSContextRef context = m_callback->getContext(); MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context); @@ -143,7 +138,7 @@ void ContentListener::oncontentupdated(MediacontentMediaPtr content) void ContentListener::oncontentremoved(std::string id) { - LogInfo("ContentListener::oncontentremoved is entered"); + LoggerI("ContentListener::oncontentremoved is entered"); JSContextRef context = m_callback->getContext(); MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context); diff --git a/src/Content/ContentManager.cpp b/src/Content/ContentManager.cpp old mode 100755 new mode 100644 index dd0c30d..490d13c --- a/src/Content/ContentManager.cpp +++ b/src/Content/ContentManager.cpp @@ -15,11 +15,9 @@ // limitations under the License. // - #include #include #include -#include #include #include #include @@ -28,7 +26,7 @@ #include "ContentManager.h" #include "ContentFilterValidator.h" #include "ContentUtility.h" - +#include using namespace WrtDeviceApis::Commons; @@ -41,7 +39,7 @@ int MediacontentManager::m_instanceCount = 0; MediacontentManager::MediacontentManager() { - LogDebug("entered"); + LoggerD("entered"); //protect for pararel execution DPL::Mutex::ScopedLock mx(&m_constructorMutex); @@ -50,7 +48,7 @@ MediacontentManager::MediacontentManager() //when it is first instance then connect to media content service. if( MEDIA_CONTENT_ERROR_NONE != media_content_connect()) { - LogDebug("Media Content Service Connect Fail..."); + LoggerD("Media Content Service Connect Fail..."); return; } } @@ -61,17 +59,17 @@ MediacontentManager::MediacontentManager() MediacontentManager::~MediacontentManager() { - LogDebug("entered : " << m_instanceCount); + LoggerD("entered : " << m_instanceCount); DPL::Mutex::ScopedLock mx(&m_constructorMutex); //decrease counter of instances m_instanceCount--; if (m_instanceCount == 0) { - LogDebug("instance Count is zero "); + LoggerD("instance Count is zero "); //when it is last instance then clse connection to database if ( MEDIA_CONTENT_ERROR_NONE != media_content_disconnect()) { - LogDebug("Media Content Service Disconnect Fail..."); + LoggerD("Media Content Service Disconnect Fail..."); } } } @@ -79,13 +77,13 @@ MediacontentManager::~MediacontentManager() /* void MediacontentManager::OnRequestReceived(const IEventGetMediacontentPtr &event) { - LogDebug( "OnRequestReceived::entered"); + LoggerD( "OnRequestReceived::entered"); //IMediacontentPtr newMediacontent(new Mediacontent()); //IMediacontentPtr newMediacontent = MediacontentFactory::getInstance().createMediacontentObject(); Try { - LogDebug( "get Mediacontent \n"); + LoggerD( "get Mediacontent \n"); // event->setMediacontent(m_mediaContent); event->setResult(true); } @@ -145,7 +143,7 @@ media_content_orientation_e MediacontentManager::convertToOrientation(string ori } else { - LogDebug("wrong value."); + LoggerD("wrong value."); ret = MEDIA_CONTENT_ORIENTATION_NOT_AVAILABLE; } @@ -162,7 +160,7 @@ void MediacontentManager::convertToPlatformFolder(media_folder_h media_folder, M { if ( tmpStr ) { - LogDebug("Folder UUID : " << tmpStr); + LoggerD("Folder UUID : " << tmpStr); newFolder->setFolderUUID(tmpStr); free(tmpStr); tmpStr = NULL; @@ -173,7 +171,7 @@ void MediacontentManager::convertToPlatformFolder(media_folder_h media_folder, M { if ( tmpStr ) { - LogDebug("Folder path : " << tmpStr); + LoggerD("Folder path : " << tmpStr); newFolder->setFolderPath(ContentUtility::convertPathToUri(tmpStr)); free(tmpStr); tmpStr = NULL; @@ -184,7 +182,7 @@ void MediacontentManager::convertToPlatformFolder(media_folder_h media_folder, M { if ( tmpStr ) { - LogDebug("Folder name : " << tmpStr); + LoggerD("Folder name : " << tmpStr); newFolder->setFolderName(tmpStr); free(tmpStr); tmpStr = NULL; @@ -193,13 +191,13 @@ void MediacontentManager::convertToPlatformFolder(media_folder_h media_folder, M if (MEDIA_CONTENT_ERROR_NONE == media_folder_get_modified_time(media_folder, &date)) { - LogDebug("get Modified Time "); + LoggerD("get Modified Time "); newFolder->setFolderModifiedDate(toDateTm(date)); } if (MEDIA_CONTENT_ERROR_NONE == media_folder_get_storage_type(media_folder, &storageType)) { - LogDebug("storage Type=" << storageType); + LoggerD("storage Type=" << storageType); string type; if(storageType == MEDIA_CONTENT_STORAGE_INTERNAL ) { @@ -228,14 +226,14 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco unsigned long long tmpLongLong = 0; bool tmpBool= false; - LogDebug("enter Common Data type : " << newMedia->getMediaType()); + LoggerD("enter Common Data type : " << newMedia->getMediaType()); if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_media_id(info, &tmpStr) ) { if (tmpStr) { newMedia->setMediaUUID(tmpStr); - LogDebug("UUID : " << tmpStr); + LoggerD("UUID : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -246,7 +244,7 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if (tmpStr) { newMedia->setMimeType(tmpStr); - LogDebug("MineType : " << tmpStr); + LoggerD("MineType : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -257,7 +255,7 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if (tmpStr) { newMedia->setDisplayName(tmpStr); - LogDebug("Display Name : " << tmpStr); + LoggerD("Display Name : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -268,7 +266,7 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if (tmpStr) { newMedia->setFilePath(ContentUtility::convertPathToUri(tmpStr)); - LogDebug("Path : " << newMedia->getFilePath()); + LoggerD("Path : " << newMedia->getFilePath()); free(tmpStr); tmpStr = NULL; } @@ -279,7 +277,7 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if (tmpStr) { newMedia->setThumbnailPath(ContentUtility::convertPathToUri(tmpStr)); - LogDebug("Thumnail Path : " << newMedia->getThumbnailPath()); + LoggerD("Thumnail Path : " << newMedia->getThumbnailPath()); free(tmpStr); tmpStr = NULL; } @@ -290,7 +288,7 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if (tmpStr) { newMedia->setDescription(tmpStr); - LogDebug("Description : " << tmpStr); + LoggerD("Description : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -308,19 +306,19 @@ void MediacontentManager::readCommonDataFromMediaInfo(media_info_h info, Mediaco if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_favorite (info, &tmpBool) ) { newMedia->setFavorite(tmpBool); - LogDebug("favorite " << tmpBool); + LoggerD("favorite " << tmpBool); } if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_rating (info, &tmpInt) ) { newMedia->setRating(tmpInt); - LogDebug("rating " << tmpInt); + LoggerD("rating " << tmpInt); } if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_size(info, &tmpLongLong) ) { newMedia->setSize(tmpLongLong); - LogDebug("Size : " << tmpLongLong); + LoggerD("Size : " << tmpLongLong); } } @@ -351,7 +349,7 @@ void MediacontentManager::readImageFromMediaInfo( media_info_h info, Mediaconten LogError( "Couldn't convert supplied date."); } - LogDebug("image_meta_get_date_taken : " << tmpStr); //time?? + LoggerD("image_meta_get_date_taken : " << tmpStr); //time?? newImage->setReleasedDate(result); free(tmpStr); tmpStr = NULL; @@ -362,7 +360,7 @@ void MediacontentManager::readImageFromMediaInfo( media_info_h info, Mediaconten if( tmpStr ) { newImage->setTitle(tmpStr); - LogDebug(" Image Title: " << tmpStr); + LoggerD(" Image Title: " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -371,25 +369,25 @@ void MediacontentManager::readImageFromMediaInfo( media_info_h info, Mediaconten if ( MEDIA_CONTENT_ERROR_NONE == image_meta_get_width(img, &tmpInt) ) { newImage->setImageWidth(tmpInt); - LogDebug("Image Width " << tmpInt); + LoggerD("Image Width " << tmpInt); } if ( MEDIA_CONTENT_ERROR_NONE == image_meta_get_height(img, &tmpInt) ) { newImage->setImageHeight(tmpInt); - LogDebug("Image Height " << tmpInt); + LoggerD("Image Height " << tmpInt); } if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_latitude(info, &tmpDouble) ) { newImage->setImageLatitude(tmpDouble); - LogDebug("Image Latitude " << tmpDouble); + LoggerD("Image Latitude " << tmpDouble); } if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_longitude(info, &tmpDouble) ) { newImage->setImageLongitude(tmpDouble); - LogDebug("Image Longitude " << tmpDouble); + LoggerD("Image Longitude " << tmpDouble); } media_content_orientation_e orientation; @@ -428,25 +426,25 @@ void MediacontentManager::readImageFromMediaInfo( media_info_h info, Mediaconten } newImage->setImageOrientation(orientationStr); - LogDebug(" image Orientation. " << orientationStr); + LoggerD(" image Orientation. " << orientationStr); } if ( METADATA_EXTRACTOR_ERROR_NONE != image_meta_destroy(img)) { - LogDebug(" image_meta_destroy is fail... "); + LoggerD(" image_meta_destroy is fail... "); } } else { - LogDebug("fetch Image Info failed.."); + LoggerD("fetch Image Info failed.."); } } else { - LogDebug("media info is NULL"); + LoggerD("media info is NULL"); } } @@ -477,7 +475,7 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten } newVideo->setReleasedDate(result); - LogDebug("audio_meta_get_recorded_date : " << tmpStr); + LoggerD("audio_meta_get_recorded_date : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -488,7 +486,7 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten if( tmpStr ) { newVideo->setVideoAlbum(tmpStr); - LogDebug(" Video Album. " << tmpStr); + LoggerD(" Video Album. " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -499,7 +497,7 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten if( tmpStr ) { newVideo->setTitle(tmpStr); - LogDebug(" Video Title. " << tmpStr); + LoggerD(" Video Title. " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -513,7 +511,7 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten for( unsigned int i=0; i < artists.size(); i++) { string artist = artists.at(i); - LogDebug("Audio artist: " << artist); + LoggerD("Audio artist: " << artist); newVideo->appendVideoArtist(artist); } @@ -550,18 +548,18 @@ void MediacontentManager::readVideoFromMediaInfo( media_info_h info, Mediaconten if ( METADATA_EXTRACTOR_ERROR_NONE != video_meta_destroy(video)) { - LogDebug(" video_meta_destroy is fail... "); + LoggerD(" video_meta_destroy is fail... "); } } else { - LogDebug("fetch Video info fail..."); + LoggerD("fetch Video info fail..."); } } else { - LogDebug("media info is NULL"); + LoggerD("media info is NULL"); } } @@ -592,7 +590,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten } newAudio->setReleasedDate(result); - LogDebug("audio_meta_get_recorded_date : " << tmpStr); + LoggerD("audio_meta_get_recorded_date : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -603,7 +601,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if (tmpStr) { newAudio->setTitle(tmpStr); - LogDebug("Audio Title : " << tmpStr); + LoggerD("Audio Title : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -614,7 +612,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if (tmpStr) { newAudio->setAudioAlbum(tmpStr); - LogDebug("Audio Album : " << tmpStr); + LoggerD("Audio Album : " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -628,7 +626,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten for( unsigned int i=0; i < artists.size(); i++) { string artist = artists.at(i); - LogDebug("Audio artist: " << artist); + LoggerD("Audio artist: " << artist); newAudio->appendAudioArtist(artist); } @@ -645,7 +643,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten for( unsigned int i=0; i < composers.size(); i++) { string composer = composers.at(i); - LogDebug("Audio Composer : " << composer); + LoggerD("Audio Composer : " << composer); newAudio->appendAudioComposer(composer); } @@ -657,7 +655,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_duration(audio, &tmpInt) ) { newAudio->setAudioDuration(tmpInt); - LogDebug("Audio Duration : " << tmpInt); + LoggerD("Audio Duration : " << tmpInt); } if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_copyright(audio, &tmpStr) ) @@ -665,7 +663,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if (tmpStr) { newAudio->setAudioCopyright(tmpStr); - LogDebug("Audio CopyRight: " << tmpStr); + LoggerD("Audio CopyRight: " << tmpStr); free(tmpStr); tmpStr = NULL; } @@ -676,11 +674,11 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten int trackNum = 0; if (tmpStr) { - LogDebug("trackNum: " << tmpStr); + LoggerD("trackNum: " << tmpStr); try { istringstream(tmpStr) >> trackNum; } catch (...) { - LogDebug("Track Number type is wrong. (track number:" << tmpStr << ")"); + LoggerD("Track Number type is wrong. (track number:" << tmpStr << ")"); trackNum = 0; } newAudio->setAudioTrackNum(trackNum); @@ -692,13 +690,13 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_size(info, &tmpLongLong) ) { newAudio->setAudioSize(tmpLongLong); - LogDebug("Audio Size: " << tmpLongLong); + LoggerD("Audio Size: " << tmpLongLong); } if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_bit_rate(audio, &tmpInt) ) { newAudio->setAudioBitrate(tmpInt); - LogDebug("Audio Bitrate: " << tmpInt); + LoggerD("Audio Bitrate: " << tmpInt); } if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_genre(audio, &tmpStr) ) @@ -710,7 +708,7 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten for( unsigned int i=0; i < genres.size(); i++) { string genre = genres.at(i); - LogDebug("Audio Genre: " << genre); + LoggerD("Audio Genre: " << genre); newAudio->appendAudioGenre(genre); } @@ -721,21 +719,21 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten if ( METADATA_EXTRACTOR_ERROR_NONE != audio_meta_destroy(audio)) { - LogDebug(" audio_meta_destroy is fail... "); + LoggerD(" audio_meta_destroy is fail... "); } } else { - LogDebug("fetch Music Info fail..."); + LoggerD("fetch Music Info fail..."); } } else { - LogDebug("media info is NULL"); + LoggerD("media info is NULL"); } } @@ -744,23 +742,23 @@ void MediacontentManager::readMusicFromMediaInfo( media_info_h info, Mediaconten //Callback. bool MediacontentManager::mediaFolderCallback(media_folder_h folder, void *user_data) { - LogDebug("enter"); + LoggerD("enter"); if (user_data != NULL){ IEventFindFolder* event = (IEventFindFolder*)user_data; - LogDebug("user data is valide"); + LoggerD("user data is valide"); if ( folder ) { - LogDebug("folder is valide"); + LoggerD("folder is valide"); MediacontentFolderPtr newFolder(new MediacontentFolder()); convertToPlatformFolder(folder, newFolder); - LogDebug("folder type" << newFolder->getFolderStorageType()); + LoggerD("folder type" << newFolder->getFolderStorageType()); event->addFolder(newFolder); } } else { - LogDebug("user data is NULL"); + LoggerD("user data is NULL"); } return true; @@ -807,7 +805,7 @@ bool MediacontentManager::mediaItemCallback(media_info_h info, void* user_data) } else { - LogDebug("event is NULL"); + LoggerD("event is NULL"); } return true; @@ -815,7 +813,7 @@ bool MediacontentManager::mediaItemCallback(media_info_h info, void* user_data) void MediacontentManager::OnRequestReceived(const IEventFindFolderPtr &eFolder) { - LogDebug("entered"); + LoggerD("entered"); if ( MEDIA_CONTENT_ERROR_NONE != media_folder_foreach_folder_from_db (NULL, mediaFolderCallback, eFolder.Get())) @@ -827,12 +825,12 @@ void MediacontentManager::OnRequestReceived(const IEventFindFolderPtr &eFolder) { eFolder->setResult(true); } - LogDebug("end"); + LoggerD("end"); } void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse) { - LogDebug("OnRequestReceived::IEventBrowseFolderPtr entered"); + LoggerD("OnRequestReceived::IEventBrowseFolderPtr entered"); MediaSearchVisitorPtr visitor(new MediaSearchVisitor()); visitor->setQueryType(MediaSearchVisitor::QUERY_MEDIA); @@ -863,7 +861,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse jsFilter->travel(IVisitor); condition = visitor->getResult(); - LogDebug("execute condition [" << condition << "]"); + LoggerD("execute condition [" << condition << "]"); media_filter_set_condition(filter, condition.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT ); //set condition } @@ -877,7 +875,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse { string attriName = attr->getAttributeName(); attriName = visitor->getPlatformAttr(attriName); - LogDebug("Attribute Name [" << attriName << "]"); + LoggerD("Attribute Name [" << attriName << "]"); if (attriName.compare("") != 0) { @@ -893,7 +891,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse if ( MEDIA_CONTENT_ERROR_NONE != media_filter_set_order(filter, order, attriName.c_str(), MEDIA_CONTENT_COLLATE_DEFAULT )) //set order { - LogDebug("media_filter_set_order fail..."); + LoggerD("media_filter_set_order fail..."); } } } @@ -902,7 +900,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse if (eBrowse->getLimitIsSet() ||eBrowse->getOffsetIsSet() ) { - LogDebug("limit or offset"); + LoggerD("limit or offset"); int count = -1; int offset = 0; @@ -910,18 +908,18 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse if ( eBrowse->getLimitIsSet() ) { count = eBrowse->getLimit(); - LogDebug("limit is " << count); + LoggerD("limit is " << count); } if ( eBrowse->getOffsetIsSet() ) { offset = eBrowse->getOffset(); - LogDebug("offset is " << offset); + LoggerD("offset is " << offset); } if ( MEDIA_CONTENT_ERROR_NONE != media_filter_set_offset(filter, offset, count)) { - LogDebug("set limit or offset fail..."); + LoggerD("set limit or offset fail..."); } } @@ -937,7 +935,7 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse if ( eBrowse->getFolderIdIsSet()) { string folderID = eBrowse->getFolderID(); - LogDebug("FolderID :" << folderID); + LoggerD("FolderID :" << folderID); if ( MEDIA_CONTENT_ERROR_NONE != media_folder_foreach_media_from_db (folderID.c_str(), filter, mediaItemCallback, eBrowse.Get())) @@ -989,7 +987,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) string type = mediaPtr->getMediaType(); //media type. string mediaId = mediaPtr->getMediaUUID(); - LogDebug("MediaId : " << mediaId); + LoggerD("MediaId : " << mediaId); media_info_h media = NULL; bool ret = true; @@ -1001,7 +999,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != media_info_set_rating(media, mediaPtr->getRating())) { - LogDebug("Error: set rating"); + LoggerD("Error: set rating"); } } if ( mediaPtr->isChangedDescription() ) @@ -1009,7 +1007,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != media_info_set_description (media, mediaPtr->getDescription().c_str())) { - LogDebug("Error: set description"); + LoggerD("Error: set description"); } } if( mediaPtr->isChangedDisplayName()) @@ -1017,7 +1015,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != media_info_set_display_name (media, mediaPtr->getDisplayName().c_str())) { - LogDebug("Error: set displayname"); + LoggerD("Error: set displayname"); } } @@ -1035,7 +1033,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != image_meta_set_orientation (img, convertToOrientation(imagePtr->getImageOrientation()))) { - LogDebug("Error: set orientation"); + LoggerD("Error: set orientation"); ret = false; } } @@ -1044,7 +1042,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) media_info_set_latitude(media, imagePtr->getImageLatitude()) ) { - LogDebug("Error: set Latitude"); + LoggerD("Error: set Latitude"); ret = false; } @@ -1052,19 +1050,19 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) media_info_set_longitude(media, imagePtr->getImageLongitude()) ) { - LogDebug("Error: set Longitude"); + LoggerD("Error: set Longitude"); ret = false; } if ( MEDIA_CONTENT_ERROR_NONE != image_meta_update_to_db (img) ) { - LogDebug("Error: update db"); + LoggerD("Error: update db"); ret = false; } if ( MEDIA_CONTENT_ERROR_NONE != image_meta_destroy(img)) { - LogDebug("Error: destroy media info"); + LoggerD("Error: destroy media info"); ret = false; } @@ -1073,7 +1071,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) } else { - LogDebug("Error: get Image from DB"); + LoggerD("Error: get Image from DB"); ret = false; } } @@ -1095,7 +1093,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != video_meta_set_played_count (video, videoPtr->getVideoPlayCount())) { - LogDebug("Error: set play count"); + LoggerD("Error: set play count"); ret = false; } @@ -1106,20 +1104,20 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != video_meta_set_played_position (video, videoPtr->getVideoPlayedTime())) { - LogDebug("Error: set played time"); + LoggerD("Error: set played time"); ret = false; } } if (videoPtr->isChangedAlbum()) { - LogDebug("Not support - Album API"); + LoggerD("Not support - Album API"); ret = false; } if (videoPtr->isChangedArtists()) { - LogDebug("Not support - Artist API"); + LoggerD("Not support - Artist API"); ret = false; } #endif @@ -1127,7 +1125,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) media_info_set_latitude(media, videoPtr->getVideoLatitude()) ) { - LogDebug("Error: set Latitude"); + LoggerD("Error: set Latitude"); ret = false; } @@ -1135,20 +1133,20 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) media_info_set_longitude(media, videoPtr->getVideoLongitude()) ) { - LogDebug("Error: set Latitude"); + LoggerD("Error: set Latitude"); ret = false; } if ( MEDIA_CONTENT_ERROR_NONE != video_meta_update_to_db (video) ) { - LogDebug("Error: update db"); + LoggerD("Error: update db"); ret = false; } if ( MEDIA_CONTENT_ERROR_NONE != video_meta_destroy(video)) { - LogDebug("Error: destroy video meta"); + LoggerD("Error: destroy video meta"); ret = false; } @@ -1179,7 +1177,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != audio_meta_set_played_count (audio, audioPtr->getAudioPlayCount())) { - LogDebug("Error: set play count"); + LoggerD("Error: set play count"); ret = false; } } @@ -1189,50 +1187,50 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) if ( MEDIA_CONTENT_ERROR_NONE != audio_meta_set_played_position (audio, audioPtr->getAudioPlayedTime())) { - LogDebug("Error: set played time"); + LoggerD("Error: set played time"); ret = false; } } if (audioPtr->isChangedAudioArtist()) { - LogDebug("Not Support API"); + LoggerD("Not Support API"); ret = false; } if (audioPtr->isChangedAudioAlbum()) { - LogDebug("Not Support API"); + LoggerD("Not Support API"); ret = false; } if (audioPtr->isChangedAudioGenre()) { - LogDebug("Not Support API"); + LoggerD("Not Support API"); ret = false; } if (audioPtr->isChangedAudioComposer()) { - LogDebug("Not Support API"); + LoggerD("Not Support API"); ret = false; } if (audioPtr->isChangedAudioTrackNumber()) { - LogDebug("Not Support API"); + LoggerD("Not Support API"); ret = false; } #endif if ( MEDIA_CONTENT_ERROR_NONE != audio_meta_update_to_db (audio) ) { - LogDebug("Error: update db"); + LoggerD("Error: update db"); ret = false; } if ( MEDIA_CONTENT_ERROR_NONE != audio_meta_destroy(audio)) { - LogDebug("Error: destroy audio meta"); + LoggerD("Error: destroy audio meta"); ret = false; } audio = NULL; @@ -1246,7 +1244,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) //update media info if ( MEDIA_CONTENT_ERROR_NONE != media_info_update_to_db(media)) { - LogDebug("Error: update to DB"); + LoggerD("Error: update to DB"); ret = false; } } @@ -1255,7 +1253,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) { if ( MEDIA_CONTENT_ERROR_NONE !=media_info_destroy(media)) { - LogDebug("Error: destroy media info"); + LoggerD("Error: destroy media info"); ret = false; } } @@ -1265,7 +1263,7 @@ bool MediacontentManager::updateMediaToDB(MediacontentMediaPtr mediaPtr) void MediacontentManager::OnRequestReceived(const IEventUpdateMediaPtr &eMedia) { - LogDebug("OnRequestReceived::IEventUpdateMediaPtr entered"); + LoggerD("OnRequestReceived::IEventUpdateMediaPtr entered"); try { MediacontentMediaPtr mediaPtr = eMedia->getMediaItem(); @@ -1273,7 +1271,7 @@ void MediacontentManager::OnRequestReceived(const IEventUpdateMediaPtr &eMedia) if(updateMediaToDB(mediaPtr)) { eMedia->setResult(true); - LogDebug("update success"); + LoggerD("update success"); } else { @@ -1291,14 +1289,14 @@ void MediacontentManager::OnRequestReceived(const IEventUpdateMediaPtr &eMedia) void MediacontentManager::OnRequestReceived(const IEventUpdateMediaItemsPtr &eItems) { - LogDebug("OnRequestReceived::IEventUpdateMediaItemsPtr entered"); + LoggerD("OnRequestReceived::IEventUpdateMediaItemsPtr entered"); try { MediacontentMediaListPtr mediaListPtr = eItems->getMediaItems(); if (mediaListPtr->empty()) { - LogDebug("Item vector is empty"); + LoggerD("Item vector is empty"); } else { @@ -1309,7 +1307,7 @@ void MediacontentManager::OnRequestReceived(const IEventUpdateMediaItemsPtr &eIt if(updateMediaToDB(mediaPtr)) { eItems->setResult(true); - LogDebug("update success"); + LoggerD("update success"); } else { diff --git a/src/Content/ContentMedia.cpp b/src/Content/ContentMedia.cpp old mode 100755 new mode 100644 index e712ec0..7c4f1fc --- a/src/Content/ContentMedia.cpp +++ b/src/Content/ContentMedia.cpp @@ -15,12 +15,10 @@ // limitations under the License. // - -#include #include #include "ContentMedia.h" #include - +#include namespace DeviceAPI { namespace Content { @@ -70,7 +68,7 @@ void MediacontentMedia::setMediaUUID(const string &value) string MediacontentMedia::getMimeType() { - LogDebug("MediacontentMedia::getMimeType"); + LoggerD("MediacontentMedia::getMimeType"); return m_mimeType; } @@ -179,17 +177,17 @@ void MediacontentMedia::setMediaType(const string &value) void MediacontentMedia::display() const { - LogDebug("m_mediaUUID : " << m_mediaUUID); - LogDebug("m_mediaType : " << m_mediaType); -// LogDebug("m_mimeType : " << m_mimeType); - LogDebug("m_displayName : " << m_displayName); - LogDebug("m_filePath : " << m_filePath); - LogDebug("m_thumbnailPath : " << m_thumbnailPath); - LogDebug("m_description : " << m_description); -// LogDebug("m_createdDate : " << m_createdDate); -// LogDebug("m_releasedDate : " << m_releasedDate); -// LogDebug("m_modifiedDate : " << m_modifiedDate); - LogDebug("m_favorite : " << m_favorite); + LoggerD("m_mediaUUID : " << m_mediaUUID); + LoggerD("m_mediaType : " << m_mediaType); +// LoggerD("m_mimeType : " << m_mimeType); + LoggerD("m_displayName : " << m_displayName); + LoggerD("m_filePath : " << m_filePath); + LoggerD("m_thumbnailPath : " << m_thumbnailPath); + LoggerD("m_description : " << m_description); +// LoggerD("m_createdDate : " << m_createdDate); +// LoggerD("m_releasedDate : " << m_releasedDate); +// LoggerD("m_modifiedDate : " << m_modifiedDate); + LoggerD("m_favorite : " << m_favorite); } diff --git a/src/Content/ContentSearchVisitor.cpp b/src/Content/ContentSearchVisitor.cpp old mode 100755 new mode 100644 index 50850b2..24bb29d --- a/src/Content/ContentSearchVisitor.cpp +++ b/src/Content/ContentSearchVisitor.cpp @@ -15,12 +15,12 @@ // limitations under the License. // -#include #include "time.h" #include #include #include "ContentSearchVisitor.h" #include "ContentUtility.h" +#include namespace DeviceAPI { namespace Content { @@ -119,8 +119,8 @@ string MediaSearchVisitor::getPlatformAttr(string attrName) { string platformAttr; map::iterator pos; - LogDebug("attrName=" << attrName); - LogDebug("queryType=" << queryType); + LoggerD("attrName=" << attrName); + LoggerD("queryType=" << queryType); if( queryType == QUERY_FOLDER) { diff --git a/src/Content/ContentVideo.cpp b/src/Content/ContentVideo.cpp old mode 100755 new mode 100644 index feffd77..40133e1 --- a/src/Content/ContentVideo.cpp +++ b/src/Content/ContentVideo.cpp @@ -15,10 +15,9 @@ // limitations under the License. // - -#include #include #include "ContentVideo.h" +#include namespace DeviceAPI { namespace Content { @@ -147,14 +146,14 @@ vector MediacontentVideo::getEditableAttr() const void MediacontentVideo::display() const { - LogDebug("m_videoLongitude: " << m_videoLongitude;); - LogDebug("m_videoLatitude: " << m_videoLatitude); - LogDebug("m_videoAlbum: " << m_videoAlbum;); - //LogDebug("m_videoArtist: " << m_videoArtist); - //LogDebug("m_videoPlayedTime: " << m_videoPlayedTime); - LogDebug("m_videoDuration: " << m_videoDuration); - LogDebug("m_videoWidth: " << m_videoWidth); - LogDebug("m_videoHeight: " << m_videoHeight); + LoggerD("m_videoLongitude: " << m_videoLongitude;); + LoggerD("m_videoLatitude: " << m_videoLatitude); + LoggerD("m_videoAlbum: " << m_videoAlbum;); + //LoggerD("m_videoArtist: " << m_videoArtist); + //LoggerD("m_videoPlayedTime: " << m_videoPlayedTime); + LoggerD("m_videoDuration: " << m_videoDuration); + LoggerD("m_videoWidth: " << m_videoWidth); + LoggerD("m_videoHeight: " << m_videoHeight); MediacontentMedia::display(); } diff --git a/src/Content/IContentManager.cpp b/src/Content/IContentManager.cpp old mode 100755 new mode 100644 index caf44a3..cbd5e99 --- a/src/Content/IContentManager.cpp +++ b/src/Content/IContentManager.cpp @@ -15,7 +15,6 @@ // limitations under the License. // - #include #include #include "IContentManager.h" @@ -26,7 +25,7 @@ #include "ContentAudio.h" #include "ContentManager.h" #include "ContentUtility.h" - +#include namespace DeviceAPI { namespace Content { @@ -47,25 +46,25 @@ IMediacontentManager::~IMediacontentManager() void IMediacontentManager::findFolder(IEventFindFolderPtr &ptr) { - LogDebug("IMediacontentManager::called findFolders"); + LoggerD("IMediacontentManager::called findFolders"); WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(ptr); } void IMediacontentManager::updateMedia(IEventUpdateMediaPtr &ptr) { - LogDebug("IMediacontentManager::called updateMedia"); + LoggerD("IMediacontentManager::called updateMedia"); WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(ptr); } void IMediacontentManager::browseFolder(IEventBrowseFolderPtr &ptr) { - LogDebug("IMediacontentManager::called IEventBrowseFolder"); + LoggerD("IMediacontentManager::called IEventBrowseFolder"); WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(ptr); } void IMediacontentManager::updateMediaItems(IEventUpdateMediaItemsPtr &ptr) { - LogDebug("IMediacontentManager::called IEventBrowseFolder"); + LoggerD("IMediacontentManager::called IEventBrowseFolder"); WrtDeviceApis::Commons::EventRequestReceiver::PostRequest(ptr); } @@ -81,7 +80,7 @@ struct scanCallbackData static gboolean _scan_file_completed_cb(void *user_data) { - LogDebug("called _scan_file_completed_cb:"); + LoggerD("called _scan_file_completed_cb:"); scanCallbackData *data = static_cast(user_data); @@ -126,20 +125,20 @@ static gboolean _scan_file_completed_cb(void *user_data) static void _scan_file_thread(void *user_data, Ecore_Thread *thread){ - LogDebug("_scan_file_thread::called"); + LoggerD("_scan_file_thread::called"); scanCallbackData *data = static_cast(user_data); data->result = media_content_scan_file(data->path.c_str()); - LogDebug("native error code:" << data->result); + LoggerD("native error code:" << data->result); g_idle_add(_scan_file_completed_cb, data); } bool IMediacontentManager::scanFile(scanCompletedCallback callback, std::string path, void* user_data) { - LogDebug("ContentManager::called scan"); + LoggerD("ContentManager::called scan"); bool ret = false; if( !path.empty() ) { - LogDebug("ContentManager::path:" << path); + LoggerD("ContentManager::path:" << path); scanCallbackData *data = new scanCallbackData(); data->path = path; @@ -160,7 +159,7 @@ bool IMediacontentManager::scanFile(scanCompletedCallback callback, std::string static bool mediaItemCallback(media_info_h info, void* user_data) { media_content_type_e type; - LogDebug("mediaItemCallback is called"); + LoggerD("mediaItemCallback is called"); if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_media_type( info, &type) ) { @@ -302,13 +301,13 @@ static void content_notification_cb( err_msg = "scanning is failed by unknown reason"; } - LogDebug("ContentListener is called:" + err_msg ); + LoggerD("ContentListener is called:" + err_msg ); } bool IMediacontentManager::setListener( void* user_data) { - LogDebug("ContentManager::called setListener"); + LoggerD("ContentManager::called setListener"); bool ret = false; if(media_content_set_db_updated_cb(content_notification_cb,user_data) == MEDIA_CONTENT_ERROR_NONE) @@ -320,7 +319,7 @@ bool IMediacontentManager::setListener( void* user_data) bool IMediacontentManager::unsetListener() { - LogDebug("ContentManager::called unsetListener"); + LoggerD("ContentManager::called unsetListener"); bool ret = false; if(media_content_unset_db_updated_cb() == MEDIA_CONTENT_ERROR_NONE) diff --git a/src/Content/IContentManager.h b/src/Content/IContentManager.h index a3c45eb..f5fb059 100755 --- a/src/Content/IContentManager.h +++ b/src/Content/IContentManager.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "IEventGetDirectories.h" #include "IEventUpdate.h" @@ -31,8 +30,6 @@ #include "ContentMedia.h" #include "ContentImage.h" - - namespace DeviceAPI { namespace Content { diff --git a/src/Content/IEventUpdate.h b/src/Content/IEventUpdate.h old mode 100755 new mode 100644 index 17c3b63..94a8efc --- a/src/Content/IEventUpdate.h +++ b/src/Content/IEventUpdate.h @@ -23,6 +23,7 @@ #include #include #include "ContentMedia.h" +#include namespace DeviceAPI { namespace Content { @@ -33,14 +34,14 @@ class IEventUpdateMedia : public WrtDeviceApis::Commons::IEvent #include #include "ContentMedia.h" +#include namespace DeviceAPI { namespace Content { @@ -34,7 +35,7 @@ class IEventUpdateMediaItems : public WrtDeviceApis::Commons::IEvent #include #include #include @@ -28,7 +26,7 @@ #include "ContentConverter.h" #include "AudioLyricsUtil.h" #include "ContentUtility.h" - +#include #define TIZEN_CONTENT_AUDIO_ATTRIBUTENAME "AudioContent" #define TIZEN_CONTENT_AUDIO_ALBUM "album" @@ -88,23 +86,23 @@ JSClassRef JSAudio::m_jsClassRef = JSClassCreate(JSAudio::getClassInfo()); void JSAudio::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); AudioPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentAudioPtr privateData(new MediacontentAudio()); priv = new AudioPrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("new Private Object is created" ); + LoggerD("new Private Object is created" ); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); } } void JSAudio::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); AudioPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; if (priv != NULL) { @@ -116,7 +114,7 @@ void JSAudio::finalize(JSObjectRef object) const JSClassRef JSAudio::getClassRef() { - LogDebug("JSAudio::getClassRef()"); + LoggerD("JSAudio::getClassRef()"); if (!m_jsClassRef) { @@ -133,7 +131,7 @@ const JSClassDefinition* JSAudio::getClassInfo() MediacontentAudioPtr JSAudio::getAudioObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); AudioPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { @@ -153,7 +151,7 @@ JSValueRef JSAudio::getPropertyAlbum( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -164,7 +162,7 @@ JSValueRef JSAudio::getPropertyAlbum( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -175,7 +173,7 @@ JSValueRef JSAudio::getPropertyArtist( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyArtist::entered"); + LoggerD("getPropertyArtist::entered"); Try { Converter converter(context); @@ -187,7 +185,7 @@ JSValueRef JSAudio::getPropertyArtist( } for( unsigned int i=0; i < audio->getAudioArtist().size(); i++){ string artist = audio->getAudioArtist().at(i); - LogDebug("artist : " << artist); + LoggerD("artist : " << artist); JSValueRef val = converter.toJSValueRef(artist); if(!JSSetArrayElement(context, jsResult, i, val)){ ThrowMsg(UnknownException, "Could not insert value into js array"); @@ -198,7 +196,7 @@ JSValueRef JSAudio::getPropertyArtist( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -211,7 +209,7 @@ JSValueRef JSAudio::getPropertyGenre( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyGenre::entered"); + LoggerD("getPropertyGenre::entered"); Try { Converter converter(context); @@ -235,7 +233,7 @@ JSValueRef JSAudio::getPropertyGenre( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -247,7 +245,7 @@ JSValueRef JSAudio::getPropertyComposer( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyComposer::entered"); + LoggerD("getPropertyComposer::entered"); Try { Converter converter(context); @@ -269,7 +267,7 @@ JSValueRef JSAudio::getPropertyComposer( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -280,7 +278,7 @@ JSValueRef JSAudio::getPropertyCopyright( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -291,7 +289,7 @@ JSValueRef JSAudio::getPropertyCopyright( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -302,7 +300,7 @@ JSValueRef JSAudio::getPropertyLyrics( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { MediaConverterFactory::ConverterType converter = MediaConverterFactory::getConverter(context); @@ -321,7 +319,7 @@ JSValueRef JSAudio::getPropertyLyrics( JSContextRef globalContext = priv->getContext(); //check lyrics state - LogDebug("lyrics state : " << audio->getLyricsState()); + LoggerD("lyrics state : " << audio->getLyricsState()); if ( CONTENT_LYRIC_UNKNOWN == audio->getLyricsState() || CONTENT_LYRIC_EXISTENT == audio->getLyricsState() ) @@ -344,14 +342,14 @@ JSValueRef JSAudio::getPropertyLyrics( if (mediaContent && (audio->getLyricsState() != CONTENT_LYRIC_NON_EXISTENT)) { - LogDebug(" lyrics success "); + LoggerD(" lyrics success "); JSObjectRef jsobject; jsobject = JSMediaLyrics::createJSObject(globalContext, mediaContent); return jsobject; } else { - LogDebug(" lyrics success "); + LoggerD(" lyrics success "); audio->setAudioLyricNonExistent(); } } @@ -359,7 +357,7 @@ JSValueRef JSAudio::getPropertyLyrics( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); @@ -371,7 +369,7 @@ JSValueRef JSAudio::getPropertyBitrate( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -380,7 +378,7 @@ JSValueRef JSAudio::getPropertyBitrate( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -391,7 +389,7 @@ JSValueRef JSAudio::getPropertyTrackNum( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -400,7 +398,7 @@ JSValueRef JSAudio::getPropertyTrackNum( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -411,7 +409,7 @@ JSValueRef JSAudio::getPropertyDuration( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -420,7 +418,7 @@ JSValueRef JSAudio::getPropertyDuration( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -431,7 +429,7 @@ JSValueRef JSAudio::getPropertySize( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -441,7 +439,7 @@ JSValueRef JSAudio::getPropertySize( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -453,7 +451,7 @@ bool JSAudio::setPropertyAlbum( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -465,7 +463,7 @@ bool JSAudio::setPropertyAlbum( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -480,7 +478,7 @@ bool JSAudio::setPropertyArtist( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -513,7 +511,7 @@ bool JSAudio::setPropertyArtist( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); return DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -528,7 +526,7 @@ bool JSAudio::setPropertyComposer( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -557,7 +555,7 @@ bool JSAudio::setPropertyComposer( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); return DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -571,7 +569,7 @@ bool JSAudio::setPropertyGenre( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -601,7 +599,7 @@ bool JSAudio::setPropertyGenre( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); return DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -615,7 +613,7 @@ bool JSAudio::setPropertyTrackNumber( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -627,7 +625,7 @@ bool JSAudio::setPropertyTrackNumber( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } diff --git a/src/Content/JSAudioLyrics.cpp b/src/Content/JSAudioLyrics.cpp old mode 100755 new mode 100644 index ae1e3fc..c2ee428 --- a/src/Content/JSAudioLyrics.cpp +++ b/src/Content/JSAudioLyrics.cpp @@ -15,14 +15,13 @@ // limitations under the License. // - -#include #include #include #include #include #include "JSAudioLyrics.h" +#include namespace DeviceAPI { namespace Content { @@ -67,31 +66,31 @@ JSClassRef JSMediaLyrics::m_jsClassRef = JSClassCreate(JSMediaLyrics::getClassIn void JSMediaLyrics::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); LyricsPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentLyricsPtr privateData(new MediacontentLyrics()); priv = new LyricsPrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("private object is created"); + LoggerD("private object is created"); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); } } void JSMediaLyrics::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); LyricsPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; delete priv; } const JSClassRef JSMediaLyrics::getClassRef() { - LogDebug("JSMediaLyrics::getClassRef()"); + LoggerD("JSMediaLyrics::getClassRef()"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); @@ -106,7 +105,7 @@ const JSClassDefinition* JSMediaLyrics::getClassInfo() MediacontentLyricsPtr JSMediaLyrics::getLyricsObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); LyricsPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { @@ -127,7 +126,7 @@ JSValueRef JSMediaLyrics::getPropertyLyricsType( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -138,7 +137,7 @@ JSValueRef JSMediaLyrics::getPropertyLyricsType( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -151,7 +150,7 @@ JSValueRef JSMediaLyrics::getPropertyTimeStamps( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -184,7 +183,7 @@ JSValueRef JSMediaLyrics::getPropertyTimeStamps( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -197,7 +196,7 @@ JSValueRef JSMediaLyrics::getPropertyTexts( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -224,7 +223,7 @@ JSValueRef JSMediaLyrics::getPropertyTexts( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -237,7 +236,7 @@ JSObjectRef JSMediaLyrics::createJSObject(JSContextRef context, LyricsPrivObject *priv = new LyricsPrivObject(context, mediaContent); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; diff --git a/src/Content/JSContent.cpp b/src/Content/JSContent.cpp old mode 100755 new mode 100644 index 88514e3..b01bbb0 --- a/src/Content/JSContent.cpp +++ b/src/Content/JSContent.cpp @@ -15,16 +15,13 @@ // limitations under the License. // - -#include #include #include #include #include #include - - #include "JSContent.h" +#include namespace DeviceAPI { namespace Content { @@ -91,24 +88,24 @@ JSClassRef JSMedia::m_jsClassRef = JSClassCreate(JSMedia::getClassInfo()); void JSMedia::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); MediaPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentMediaPtr privateData(new MediacontentMedia()); priv = new MediaPrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("new event is created" ); + LoggerD("new event is created" ); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); } } void JSMedia::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); MediaPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; if (priv != NULL) { @@ -121,7 +118,7 @@ void JSMedia::finalize(JSObjectRef object) const JSClassRef JSMedia::getClassRef() { - LogDebug("JSMedia::getClassRef()"); + LoggerD("JSMedia::getClassRef()"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); @@ -136,7 +133,7 @@ const JSClassDefinition* JSMedia::getClassInfo() MediacontentMediaPtr JSMedia::getMediaObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); MediaPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { @@ -156,7 +153,7 @@ JSValueRef JSMedia::getPropertyId( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -166,7 +163,7 @@ JSValueRef JSMedia::getPropertyId( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -178,7 +175,7 @@ JSValueRef JSMedia::getPropertyMimeType( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -187,7 +184,7 @@ JSValueRef JSMedia::getPropertyMimeType( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -200,17 +197,17 @@ JSValueRef JSMedia::getPropertyDisplayName( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyDisplayName::entered"); + LoggerD("getPropertyDisplayName::entered"); Try { Converter converter(context); MediacontentMediaPtr media = getMediaObject(object); - LogDebug("getDisplayName:"<getDisplayName()); + LoggerD("getDisplayName:"<getDisplayName()); return converter.toJSValueRef(media->getDisplayName()); } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -221,17 +218,17 @@ JSValueRef JSMedia::getPropertyTitle( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyDisplayName::entered"); + LoggerD("getPropertyDisplayName::entered"); Try { Converter converter(context); MediacontentMediaPtr media = getMediaObject(object); - LogDebug("getTitle:"<getTitle()); + LoggerD("getTitle:"<getTitle()); return converter.toJSValueRef(media->getTitle()); } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -243,7 +240,7 @@ JSValueRef JSMedia::getPropertyFilePath( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -252,7 +249,7 @@ JSValueRef JSMedia::getPropertyFilePath( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -264,7 +261,7 @@ JSValueRef JSMedia::getPropertyThumbnailPath( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -284,7 +281,7 @@ JSValueRef JSMedia::getPropertyThumbnailPath( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -295,7 +292,7 @@ JSValueRef JSMedia::getPropertyDescription( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyDescription::entered"); + LoggerD("getPropertyDescription::entered"); Try { Converter converter(context); @@ -307,7 +304,7 @@ JSValueRef JSMedia::getPropertyDescription( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -319,7 +316,7 @@ JSValueRef JSMedia::getPropertyModifiedDate( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -331,7 +328,7 @@ JSValueRef JSMedia::getPropertyModifiedDate( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -342,7 +339,7 @@ JSValueRef JSMedia::getPropertyReleasedDate( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -354,7 +351,7 @@ JSValueRef JSMedia::getPropertyReleasedDate( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); @@ -367,7 +364,7 @@ JSValueRef JSMedia::getPropertyRating( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -376,7 +373,7 @@ JSValueRef JSMedia::getPropertyRating( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -387,7 +384,7 @@ JSValueRef JSMedia::getPropertyType( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyType::entered"); + LoggerD("getPropertyType::entered"); Try { Converter converter(context); @@ -396,7 +393,7 @@ JSValueRef JSMedia::getPropertyType( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -408,18 +405,18 @@ JSValueRef JSMedia::getPropertySize( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyType::entered"); + LoggerD("getPropertyType::entered"); Try { Converter converter(context); MediacontentMediaPtr media = getMediaObject(object); - LogDebug("size:" << media->getSize()); + LoggerD("size:" << media->getSize()); double var = (double)media->getSize(); //casting. return converter.toJSValueRef(var); } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); @@ -455,7 +452,7 @@ JSValueRef JSMedia::getPropertyEditableAttr( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -469,19 +466,19 @@ bool JSMedia::setPropertyRating( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); MediacontentMediaPtr objMedia = getMediaObject(object); int rating = converter.toInt(value); - LogDebug("Inserted value : " << rating); + LoggerD("Inserted value : " << rating); if(rating < 0) { rating = 0; - LogDebug("Rating value set 0 as inserted value is too small"); + LoggerD("Rating value set 0 as inserted value is too small"); } if ( objMedia->getRating() != rating) @@ -493,7 +490,7 @@ bool JSMedia::setPropertyRating( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -508,14 +505,14 @@ bool JSMedia::setPropertyDisplayName( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); MediacontentMediaPtr objMedia = getMediaObject(object); string displayName = converter.toString(value); - LogDebug("Inserted value : " << displayName); + LoggerD("Inserted value : " << displayName); if ((objMedia->getDescription()).compare(displayName) != 0) { @@ -526,7 +523,7 @@ bool JSMedia::setPropertyDisplayName( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } @@ -540,14 +537,14 @@ bool JSMedia::setPropertyDescription( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); MediacontentMediaPtr objMedia = getMediaObject(object); string description = converter.toString(value); - LogDebug("Inserted value : " << description); + LoggerD("Inserted value : " << description); if ( (objMedia->getDescription()).compare(description) != 0 ) { @@ -558,7 +555,7 @@ bool JSMedia::setPropertyDescription( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } diff --git a/src/Content/JSContentManager.cpp b/src/Content/JSContentManager.cpp old mode 100755 new mode 100644 index b13041b..24c6e72 --- a/src/Content/JSContentManager.cpp +++ b/src/Content/JSContentManager.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include @@ -55,7 +53,7 @@ #include "ContentFilterConverter.h" #include "ContentUtility.h" #include "JSWebAPIException.h" - +#include using namespace DeviceAPI::Common; using namespace DeviceAPI::Tizen; @@ -116,7 +114,7 @@ JSValueRef JSMediacontentManager::getFolders( const JSValueRef arguments[], JSValueRef* exception ) { - LogDebug("JSContentManagerManager::getFolders entered"); + LoggerD("JSContentManagerManager::getFolders entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; @@ -167,27 +165,27 @@ JSValueRef JSMediacontentManager::getFolders( } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -206,7 +204,7 @@ JSValueRef JSMediacontentManager::findItems( const JSValueRef arguments[], JSValueRef* exception ) { - LogDebug("JSContentManagerManager::find entered"); + LoggerD("JSContentManagerManager::find entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; @@ -312,27 +310,27 @@ JSValueRef JSMediacontentManager::findItems( } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -349,7 +347,7 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSContentManagerManager::updateItemsBatch entered"); + LoggerD("JSContentManagerManager::updateItemsBatch entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; privateObject = static_cast(JSObjectGetPrivate(thisObject)); @@ -417,27 +415,27 @@ JSValueRef JSMediacontentManager::updateItemsBatch(JSContextRef context, } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -455,7 +453,7 @@ JSValueRef JSMediacontentManager::updateItem( const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSContentManagerManager::updateItem entered"); + LoggerD("JSContentManagerManager::updateItem entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; @@ -528,27 +526,27 @@ JSValueRef JSMediacontentManager::updateItem( } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -582,7 +580,7 @@ JSValueRef JSMediacontentManager::scanFile( const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSContentManagerManager::scanFile entered"); + LoggerD("JSContentManagerManager::scanFile entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; @@ -633,27 +631,27 @@ JSValueRef JSMediacontentManager::scanFile( } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -670,7 +668,7 @@ JSValueRef JSMediacontentManager::setChangeListener( const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSContentManagerManager::setChangeListener entered"); + LoggerD("JSContentManagerManager::setChangeListener entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; @@ -713,7 +711,7 @@ JSValueRef JSMediacontentManager::unsetChangeListener( const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSContentManagerManager::unsetChangeListener entered"); + LoggerD("JSContentManagerManager::unsetChangeListener entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MediacontentManagerPrivObject *privateObject; privateObject = static_cast(JSObjectGetPrivate(thisObject)); @@ -759,11 +757,11 @@ const JSClassDefinition* JSMediacontentManager::getClassInfo() void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("JSContentManager initialize entered"); + LoggerD("JSContentManager initialize entered"); MediacontentManagerPrivObject *privateObject = static_cast(JSObjectGetPrivate(object)); if (NULL == privateObject) { - LogDebug("Create ContenttManagerPrivObject"); + LoggerD("Create ContenttManagerPrivObject"); IMediacontentManagerPtr contentManager = MediacontentFactory::getInstance().createMediacontentManagerObject(); privateObject = new MediacontentManagerPrivObject(context, contentManager); if (!JSObjectSetPrivate(object, static_cast(privateObject))) @@ -776,11 +774,11 @@ void JSMediacontentManager::initialize(JSContextRef context, JSObjectRef object) void JSMediacontentManager::finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); MediacontentManagerPrivObject* priv = static_cast (JSObjectGetPrivate(object)); if(priv != NULL) { - LogDebug("Deleting coordinates object"); + LoggerD("Deleting coordinates object"); delete priv; JSObjectSetPrivate(object, NULL); priv = NULL; diff --git a/src/Content/JSFolder.cpp b/src/Content/JSFolder.cpp old mode 100755 new mode 100644 index d105fff..a5192da --- a/src/Content/JSFolder.cpp +++ b/src/Content/JSFolder.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -24,7 +22,7 @@ #include "ContentFactory.h" #include "ContentController.h" #include "JSFolder.h" - +#include namespace DeviceAPI { namespace Content { @@ -79,25 +77,25 @@ JSClassRef JSFolder::m_jsClassRef = JSClassCreate(JSFolder::getClassInfo()); void JSFolder::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); FolderPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentFolderPtr privateData(new MediacontentFolder()); priv = new FolderPrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("new event is created" ); + LoggerD("new event is created" ); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); } } void JSFolder::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); FolderPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; if (priv != NULL) { @@ -127,7 +125,7 @@ const JSClassDefinition* JSFolder::getClassInfo() MediacontentFolderPtr JSFolder::getFolderObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); FolderPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { ThrowMsg(NullPointerException, "Private object is null"); @@ -147,7 +145,7 @@ JSValueRef JSFolder::getPropertyId( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -157,7 +155,7 @@ JSValueRef JSFolder::getPropertyId( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -169,7 +167,7 @@ JSValueRef JSFolder::getPropertyName( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -178,7 +176,7 @@ JSValueRef JSFolder::getPropertyName( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -190,7 +188,7 @@ JSValueRef JSFolder::getPropertyPath( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getPropertyPath::entered"); + LoggerD("getPropertyPath::entered"); Try { Converter converter(context); @@ -199,7 +197,7 @@ JSValueRef JSFolder::getPropertyPath( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -211,7 +209,7 @@ JSValueRef JSFolder::getPropertyStorageType( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -220,7 +218,7 @@ JSValueRef JSFolder::getPropertyStorageType( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -232,7 +230,7 @@ JSValueRef JSFolder::getPropertyModifiedDate( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -244,7 +242,7 @@ JSValueRef JSFolder::getPropertyModifiedDate( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -256,7 +254,7 @@ JSValueRef JSFolder::getPropertyMediaId( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -287,7 +285,7 @@ JSValueRef JSFolder::getPropertyMediaId( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); diff --git a/src/Content/JSImage.cpp b/src/Content/JSImage.cpp old mode 100755 new mode 100644 index 12d2511..2c7fce1 --- a/src/Content/JSImage.cpp +++ b/src/Content/JSImage.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -29,7 +27,7 @@ #include "JSUtil.h" #include "JSImage.h" - +#include #define TIZEN_CONTENT_IMAGE_ATTRIBUTENAME "ImageContent" #define TIZEN_CONTENT_IMAGE_GEOLOCATION "geolocation" @@ -82,17 +80,17 @@ JSClassRef JSImage::m_jsClassRef = JSClassCreate(JSImage::getClassInfo()); void JSImage::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); ImagePrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentImagePtr privateData(new MediacontentImage()); priv = new ImagePrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("new private object is created" ); + LoggerD("new private object is created" ); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); MediacontentImagePtr image = getImageObject(object); DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude())); JSUtil::setProperty(context, object, TIZEN_CONTENT_IMAGE_GEOLOCATION, @@ -103,7 +101,7 @@ void JSImage::initialize(JSContextRef context, JSObjectRef object) void JSImage::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); ImagePrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; if (priv != NULL) { @@ -115,7 +113,7 @@ void JSImage::finalize(JSObjectRef object) const JSClassRef JSImage::getClassRef() { - LogDebug("JSImage::getClassRef()"); + LoggerD("JSImage::getClassRef()"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); @@ -130,7 +128,7 @@ const JSClassDefinition* JSImage::getClassInfo() MediacontentImagePtr JSImage::getImageObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); ImagePrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { ThrowMsg(NullPointerException, "Private object is null"); @@ -149,21 +147,21 @@ JSValueRef JSImage::getPropertyGeoLocation( JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); MediacontentImagePtr image = getImageObject(object); - LogDebug("lati :" << image->getImageLatitude()); - LogDebug("longi :" << image->getImageLongitude()); + LoggerD("lati :" << image->getImageLatitude()); + LoggerD("longi :" << image->getImageLongitude()); DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(image->getImageLatitude(),image->getImageLongitude())); return JSSimpleCoordinates::createJSObject(context,geoPtr); } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -175,7 +173,7 @@ JSValueRef JSImage::getPropertyWidth( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -184,7 +182,7 @@ JSValueRef JSImage::getPropertyWidth( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -196,7 +194,7 @@ JSValueRef JSImage::getPropertyHeight( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -205,7 +203,7 @@ JSValueRef JSImage::getPropertyHeight( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -216,7 +214,7 @@ JSValueRef JSImage::getPropertyOrientation( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -227,7 +225,7 @@ JSValueRef JSImage::getPropertyOrientation( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -239,14 +237,14 @@ bool JSImage::setPropertyOrientation( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); MediacontentImagePtr objImg = getImageObject(object); string orientation = converter.toString(value); - LogDebug("Inserted value : " << orientation); + LoggerD("Inserted value : " << orientation); if ((objImg->getImageOrientation()).compare(orientation) !=0 ) { @@ -257,7 +255,7 @@ bool JSImage::setPropertyOrientation( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR); } @@ -271,7 +269,7 @@ bool JSImage::setPropertyGeolocation( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -288,7 +286,7 @@ bool JSImage::setPropertyGeolocation( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } diff --git a/src/Content/JSVideo.cpp b/src/Content/JSVideo.cpp old mode 100755 new mode 100644 index 2a7e7cd..500a619 --- a/src/Content/JSVideo.cpp +++ b/src/Content/JSVideo.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -26,6 +24,7 @@ #include "ContentConverter.h" #include "JSVideo.h" #include "JSUtil.h" +#include #define TIZEN_CONTENT_VIDEO_ATTRIBUTENAME "VideoContent" #define TIZEN_CONTENT_VIDEO_GEOLOCATION "geolocation" @@ -80,17 +79,17 @@ JSClassRef JSVideo::m_jsClassRef = JSClassCreate(JSVideo::getClassInfo()); void JSVideo::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); VideoPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ); if (!priv) { MediacontentVideoPtr privateData(new MediacontentVideo()); priv = new VideoPrivObject(context, privateData); JSObjectSetPrivate(object, static_cast(priv)); - LogDebug("new pravite object is created" ); + LoggerD("new pravite object is created" ); } else { - LogDebug("private object already exists"); + LoggerD("private object already exists"); MediacontentVideoPtr video = getVideoObject(object); DeviceAPI::Tizen::SimpleCoordinatesPtr geoPtr(new SimpleCoordinates(video->getVideoLatitude(),video->getVideoLongitude())); JSUtil::setProperty(context, object, TIZEN_CONTENT_VIDEO_GEOLOCATION, @@ -101,7 +100,7 @@ void JSVideo::initialize(JSContextRef context, JSObjectRef object) void JSVideo::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); VideoPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; if (priv != NULL) { @@ -116,7 +115,7 @@ void JSVideo::finalize(JSObjectRef object) const JSClassRef JSVideo::getClassRef() { - LogDebug("JSVideo::getClassRef()"); + LoggerD("JSVideo::getClassRef()"); if (!m_jsClassRef) { @@ -132,7 +131,7 @@ const JSClassDefinition* JSVideo::getClassInfo() MediacontentVideoPtr JSVideo::getVideoObject(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); VideoPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if(!priv) { @@ -152,7 +151,7 @@ JSValueRef JSVideo::getPropertyGeoLocation( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -162,7 +161,7 @@ JSValueRef JSVideo::getPropertyGeoLocation( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -174,7 +173,7 @@ bool JSVideo::setPropertyGeoLocation( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -191,7 +190,7 @@ bool JSVideo::setPropertyGeoLocation( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR); } return false; @@ -204,7 +203,7 @@ JSValueRef JSVideo::getPropertyAlbum( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -215,7 +214,7 @@ JSValueRef JSVideo::getPropertyAlbum( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -227,7 +226,7 @@ JSValueRef JSVideo::getPropertyArtist( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -239,7 +238,7 @@ JSValueRef JSVideo::getPropertyArtist( for( unsigned int i=0; i < video->getVideoArtist().size(); i++) { string artist = video->getVideoArtist().at(i); - LogDebug("artist : " << artist); + LoggerD("artist : " << artist); JSValueRef val = converter.toJSValueRef(artist); if(!JSSetArrayElement(context, jsResult, i, val)){ @@ -249,7 +248,7 @@ JSValueRef JSVideo::getPropertyArtist( return jsResult; } Catch(Exception){ - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeNull(context); } @@ -261,7 +260,7 @@ JSValueRef JSVideo::getPropertyDuration( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -272,7 +271,7 @@ JSValueRef JSVideo::getPropertyDuration( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -283,7 +282,7 @@ JSValueRef JSVideo::getPropertyWidth( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -294,7 +293,7 @@ JSValueRef JSVideo::getPropertyWidth( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -306,7 +305,7 @@ JSValueRef JSVideo::getPropertyHeight( JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -317,7 +316,7 @@ JSValueRef JSVideo::getPropertyHeight( } Catch(Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } @@ -329,7 +328,7 @@ bool JSVideo::setPropertyArtists( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -354,7 +353,7 @@ bool JSVideo::setPropertyArtists( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } return false; @@ -367,7 +366,7 @@ bool JSVideo::setPropertyAlbum( JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { Converter converter(context); @@ -381,7 +380,7 @@ bool JSVideo::setPropertyAlbum( } Catch(Exception) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); DeviceAPI::Common::JSTizenExceptionFactory::postException(context, exception, DeviceAPI::Common::JSTizenException::TYPE_MISMATCH_ERROR); } return false; diff --git a/src/Content/plugin_initializer.cpp b/src/Content/plugin_initializer.cpp old mode 100755 new mode 100644 index 2d13ffa..c6eb519 --- a/src/Content/plugin_initializer.cpp +++ b/src/Content/plugin_initializer.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -26,6 +23,7 @@ #include "JSContentManager.h" #include "ContentAsyncCallbackManager.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis; @@ -37,20 +35,20 @@ namespace Content { void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\content] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\content] on_frame_load_callback (" << context << ")"); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\content] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\content] on_frame_unload_callback (" << context << ")"); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); MediaContentAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); } void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\content] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\content] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try @@ -59,14 +57,14 @@ void on_widget_start_callback(int widgetId) } Catch(WrtDeviceApis::Commons::Exception) { - LogError("WrtAccess intialization failed"); + LoggerE("WrtAccess intialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\content] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\content] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Content"); TIME_TRACER_RELEASE(); Try @@ -75,7 +73,7 @@ void on_widget_stop_callback(int widgetId) } Catch(WrtDeviceApis::Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } diff --git a/src/DataControl/DataControlConverter.cpp b/src/DataControl/DataControlConverter.cpp old mode 100755 new mode 100644 index d06d456..2d1a9c0 --- a/src/DataControl/DataControlConverter.cpp +++ b/src/DataControl/DataControlConverter.cpp @@ -25,6 +25,7 @@ #include "DataType.h" #include #include +#include using namespace std; using namespace WrtDeviceApis::Commons; @@ -87,18 +88,18 @@ JSValueRef DataControlConverter::toFunctionOrNull(const JSValueRef& arg) { if (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, arg)) { - LogDebug("null."); + LoggerD("null."); return NULL; } else if (JSValueIsObject(m_context, arg) == false) { - LogDebug("undefined, not object"); + LoggerD("undefined, not object"); ThrowMsg(ConversionException, "Not a function nor JS null."); } else if (Validator(m_context).isCallback(arg)) { - LogDebug("Function OK"); + LoggerD("Function OK"); return arg; } @@ -115,7 +116,7 @@ JSValueRef DataControlConverter::toFunction(const JSValueRef& arg) } else if (Validator(m_context).isCallback(arg)) { - LogDebug("Function OK"); + LoggerD("Function OK"); return arg; } diff --git a/src/DataControl/DataControlConverter.h b/src/DataControl/DataControlConverter.h index 768532a..a042a60 100755 --- a/src/DataControl/DataControlConverter.h +++ b/src/DataControl/DataControlConverter.h @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include "RowData.h" diff --git a/src/DataControl/DataControlListener.cpp b/src/DataControl/DataControlListener.cpp old mode 100755 new mode 100644 index 4b22ae5..69a785b --- a/src/DataControl/DataControlListener.cpp +++ b/src/DataControl/DataControlListener.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include @@ -29,9 +28,9 @@ #include #include #include +#include using namespace DeviceAPI::Common; - using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -51,14 +50,14 @@ DataControlListener::DataControlListener() : //, // EventGetIndexedRowAnswerReceiver(ThreadEnum::NULL_THREAD) { - LogDebug("entered"); + LoggerD("entered"); } DataControlListener::~DataControlListener() { - LogDebug("entered"); + LoggerD("entered"); } @@ -71,7 +70,7 @@ DataControlListener& DataControlListener::getInstance() void DataControlListener::MakeErrorJSCallBack(JSCallbackManagerPtr cbm, JSContextRef globalContext, unsigned int error, unsigned int reqid, std::string errorMsg) { - LogDebug("Enter"); + LoggerD("Enter"); JSValueRef err[2]; DataControlConverter converter(globalContext); @@ -115,7 +114,7 @@ void DataControlListener::MakeErrorJSCallBack(JSCallbackManagerPtr cbm, JSContex break; case ExceptionCodes::EventCancelledException: - LogDebug("Enter - Event was cancled, callback will be silently discarded"); + LoggerD("Enter - Event was cancled, callback will be silently discarded"); return; case ExceptionCodes::UnknownException: default: @@ -143,7 +142,7 @@ void DataControlListener::OnAnswerReceived(const EventInsertPtr& event) { JSValueRef successArray[2]; int insertRowId = event->getInsertRowId(); - LogDebug(event->getInsertRowId()); + LoggerD(event->getInsertRowId()); successArray[0] = converter.toJSValueRef(event->getReqId()); successArray[1] = converter.toJSValueRef(insertRowId); @@ -186,7 +185,7 @@ void DataControlListener::OnAnswerReceived(const EventSelectPtr& event) JSValueRef successArray[2]; successArray[0] = JSSelectObjectArrayValues::createJSObject(globalContext, path); successArray[1] = converter.toJSValueRef(event->getReqId()); - LogDebug(event->getReqId()); + LoggerD(event->getReqId()); callbackManager->callOnSuccess(successArray, 2); } else @@ -266,7 +265,7 @@ void DataControlListener::OnAnswerReceived(const EventGetValuePtr& event) JSValueRef successArray[2]; successArray[0] = converter.toJSValueRef(result); successArray[1] = converter.toJSValueRef(event->getReqId()); - LogDebug(event->getReqId()); + LoggerD(event->getReqId()); callbackManager->callOnSuccess(successArray, 2); } else diff --git a/src/DataControl/EventAddValue.h b/src/DataControl/EventAddValue.h old mode 100755 new mode 100644 index 79d728e..2f2a709 --- a/src/DataControl/EventAddValue.h +++ b/src/DataControl/EventAddValue.h @@ -21,6 +21,7 @@ #include #include +#include namespace DeviceAPI { namespace DataControl { @@ -44,7 +45,7 @@ public: void setKey(const std::string &key) {m_key = key;} void setValue(const std::string &value) { m_value = value;} - EventAddValue() { LogDebug("entered"); } + EventAddValue() { LoggerD("entered"); } ~EventAddValue() { } }; diff --git a/src/DataControl/EventDelete.h b/src/DataControl/EventDelete.h old mode 100755 new mode 100644 index 5296d6d..08db100 --- a/src/DataControl/EventDelete.h +++ b/src/DataControl/EventDelete.h @@ -21,7 +21,7 @@ #include #include - +#include namespace DeviceAPI { namespace DataControl { @@ -42,7 +42,7 @@ public: void setWhere(const std::string& where) { m_where = where; } void setErrorMsg(const std::string& errorMsg) { m_errorMsg = errorMsg;} - EventDelete() { LogDebug("entered"); } + EventDelete() { LoggerD("entered"); } ~EventDelete() { } }; diff --git a/src/DataControl/EventGetIndexedRow.h b/src/DataControl/EventGetIndexedRow.h old mode 100755 new mode 100644 index 6b9c1f8..0f011e5 --- a/src/DataControl/EventGetIndexedRow.h +++ b/src/DataControl/EventGetIndexedRow.h @@ -22,6 +22,7 @@ #include #include #include "RowData.h" +#include namespace DeviceAPI { namespace DataControl { @@ -30,7 +31,7 @@ class EventGetIndexedRow: public WrtDeviceApis::Commons::IEvent #include #include +#include namespace DeviceAPI { namespace DataControl { @@ -45,7 +46,7 @@ public: void addResultValue(const std::string &value) { m_result.push_back(value);} - EventGetValue() { LogDebug("entered"); } + EventGetValue() { LoggerD("entered"); } ~EventGetValue() { } }; diff --git a/src/DataControl/EventInsert.h b/src/DataControl/EventInsert.h old mode 100755 new mode 100644 index d46b271..779198a --- a/src/DataControl/EventInsert.h +++ b/src/DataControl/EventInsert.h @@ -22,6 +22,7 @@ #include #include #include "RowData.h" +#include namespace DeviceAPI { namespace DataControl { @@ -43,7 +44,7 @@ public: void setRowData(const RowDataPtr& rowData) { m_rowData = rowData;} void setErrorMsg(const std::string &msg) { m_errorMsg = msg; } void setRowId(const long &id) { m_insertRowId = id;} - EventInsert() { LogDebug("entered"); m_insertRowId = -1;} + EventInsert() { LoggerD("entered"); m_insertRowId = -1;} ~EventInsert() { } }; diff --git a/src/DataControl/EventRemoveValue.h b/src/DataControl/EventRemoveValue.h old mode 100755 new mode 100644 index 2037d34..2bdee43 --- a/src/DataControl/EventRemoveValue.h +++ b/src/DataControl/EventRemoveValue.h @@ -20,7 +20,8 @@ #define TIZENAPIS_API_EVENT_REMOVE_VALUE_H_ #include -#include +#include +#include namespace DeviceAPI { namespace DataControl { @@ -43,7 +44,7 @@ public: void setValue(const std::string &value) { m_value = value;} void setErrorMsg(const std::string &msg) { m_errorMsg = msg; } - EventRemoveValue() { LogDebug("entered"); } + EventRemoveValue() { LoggerD("entered"); } ~EventRemoveValue() { } }; diff --git a/src/DataControl/EventSelect.h b/src/DataControl/EventSelect.h old mode 100755 new mode 100644 index 6e33599..c50e09e --- a/src/DataControl/EventSelect.h +++ b/src/DataControl/EventSelect.h @@ -22,6 +22,7 @@ #include #include #include "RowData.h" +#include namespace DeviceAPI { namespace DataControl { @@ -40,7 +41,7 @@ private : std::string m_errorMsg; public: EventSelect() { - LogDebug("entered"); + LoggerD("entered"); m_reqId = 0; m_where = ""; m_order = ""; diff --git a/src/DataControl/EventUpdate.h b/src/DataControl/EventUpdate.h old mode 100755 new mode 100644 index e8a0e65..13d5e07 --- a/src/DataControl/EventUpdate.h +++ b/src/DataControl/EventUpdate.h @@ -22,7 +22,7 @@ #include #include #include "RowData.h" - +#include namespace DeviceAPI { namespace DataControl { @@ -46,7 +46,7 @@ public: void setWhere(const std::string& where) { m_where = where; } void setErrorMsg(const std::string& errorMsg) { m_errorMsg = errorMsg;} - EventUpdate() { LogDebug("entered"); } + EventUpdate() { LoggerD("entered"); } ~EventUpdate() { } }; diff --git a/src/DataControl/EventUpdateValue.h b/src/DataControl/EventUpdateValue.h old mode 100755 new mode 100644 index 478211f..c418861 --- a/src/DataControl/EventUpdateValue.h +++ b/src/DataControl/EventUpdateValue.h @@ -21,6 +21,7 @@ #include #include +#include namespace DeviceAPI { namespace DataControl { @@ -46,7 +47,7 @@ public: void setOldValue(const std::string& value) { m_oldValue = value;} void setNewValue(const std::string& value) { m_newValue = value;} - EventUpdateValue() { LogDebug("entered"); } + EventUpdateValue() { LoggerD("entered"); } ~EventUpdateValue() { } }; diff --git a/src/DataControl/JSDataControlManager.cpp b/src/DataControl/JSDataControlManager.cpp old mode 100755 new mode 100644 index af6ca63..7fd5eeb --- a/src/DataControl/JSDataControlManager.cpp +++ b/src/DataControl/JSDataControlManager.cpp @@ -33,6 +33,12 @@ #include "DataControlListener.h" #include "plugin_config.h" +#include +#include +#include +#include + + using namespace std; using namespace DPL; using namespace WrtDeviceApis; @@ -90,19 +96,19 @@ const JSClassDefinition* JSDataControlManager::getClassInfo() void JSDataControlManager::initialize(JSContextRef context, JSObjectRef object) { JSDataControlManagerPriv *priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("JSDataControlManager::initialize"); + LoggerD("JSDataControlManager::initialize"); if (priv != NULL) { - LogError("already exist"); + LoggerE("already exist"); } else { priv = new JSDataControlManagerPriv(context); - LogDebug("OK creation"); + LoggerD("OK creation"); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } @@ -111,7 +117,7 @@ void JSDataControlManager::initialize(JSContextRef context, JSObjectRef object) void JSDataControlManager::finalize(JSObjectRef object) { - LogDebug("JSDataControlManager::Finalrize"); + LoggerD("JSDataControlManager::Finalrize"); JSDataControlManagerPriv *priv = static_cast(JSObjectGetPrivate(object)); @@ -135,10 +141,29 @@ JSValueRef JSDataControlManager::getDataControlConsumer ( JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); - JSValueRef reserveArguments[3]; + + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toString(0, false); + validator.toString(1, false); + validator.toString(2, false); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + JSValueRef reserveArguments[3]; JSDataControlManagerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); Try @@ -176,26 +201,26 @@ JSValueRef JSDataControlManager::getDataControlConsumer ( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } diff --git a/src/DataControl/JSMappedDataControlConsumer.cpp b/src/DataControl/JSMappedDataControlConsumer.cpp old mode 100755 new mode 100644 index 4448190..98826f5 --- a/src/DataControl/JSMappedDataControlConsumer.cpp +++ b/src/DataControl/JSMappedDataControlConsumer.cpp @@ -26,6 +26,10 @@ #include #include #include +#include +#include +#include +#include #include "DataControlFactory.h" #include "JSMappedDataControlConsumer.h" #include "DataControlAsyncCallbackManager.h" @@ -103,7 +107,7 @@ void JSMappedDataControlConsumer::finalize(JSObjectRef object) { JSMappedDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { - LogError("Private object is null"); + LoggerE("Private object is null"); } delete priv; @@ -153,7 +157,7 @@ JSValueRef JSMappedDataControlConsumer::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -164,9 +168,30 @@ JSValueRef JSMappedDataControlConsumer::addValue( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toString(1, false); + validator.toString(2, false); + validator.toFunction(3, true); + validator.toFunction(4, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + DataControlConverter converter(context); JSMappedDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; @@ -222,26 +247,26 @@ JSValueRef JSMappedDataControlConsumer::addValue( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -255,9 +280,31 @@ JSValueRef JSMappedDataControlConsumer::updateValue( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toString(1, false); + validator.toString(2, false); + validator.toString(3, false); + validator.toFunction(4, false); + validator.toFunction(5, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + DataControlConverter converter(context); JSMappedDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; @@ -315,26 +362,26 @@ JSValueRef JSMappedDataControlConsumer::updateValue( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -349,7 +396,7 @@ JSValueRef JSMappedDataControlConsumer::getValue( JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); JSMappedDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); @@ -363,6 +410,25 @@ JSValueRef JSMappedDataControlConsumer::getValue( return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } + + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toString(1, false); + validator.toFunction(2, false); + validator.toFunction(3, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } JSContextRef globalContext = priv->getContext(); DataControlConverter converter(globalContext); @@ -409,26 +475,26 @@ JSValueRef JSMappedDataControlConsumer::getValue( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -441,9 +507,30 @@ JSValueRef JSMappedDataControlConsumer::removeValue( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toString(1, false); + validator.toString(2, false); + validator.toFunction(3, false); + validator.toFunction(4, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + DataControlConverter converter(context); JSMappedDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; @@ -500,26 +587,26 @@ JSValueRef JSMappedDataControlConsumer::removeValue( Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } diff --git a/src/DataControl/JSSQLDataControlConsumer.cpp b/src/DataControl/JSSQLDataControlConsumer.cpp old mode 100755 new mode 100644 index a833612..122b771 --- a/src/DataControl/JSSQLDataControlConsumer.cpp +++ b/src/DataControl/JSSQLDataControlConsumer.cpp @@ -26,6 +26,10 @@ #include #include #include +#include +#include +#include +#include #include "DataControlFactory.h" #include "JSSQLDataControlConsumer.h" #include "DataControlAsyncCallbackManager.h" @@ -103,7 +107,7 @@ void JSSQLDataControlConsumer::finalize(JSObjectRef object) { JSSQLDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { - LogError("Private object is null"); + LoggerE("Private object is null"); } delete priv; @@ -153,7 +157,7 @@ JSValueRef JSSQLDataControlConsumer::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -164,9 +168,29 @@ JSValueRef JSSQLDataControlConsumer::insert( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toObject(1, false); + validator.toFunction(2, true); + validator.toFunction(3, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + DataControlConverter converter(context); JSSQLDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; @@ -220,26 +244,26 @@ JSValueRef JSSQLDataControlConsumer::insert( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -253,9 +277,29 @@ JSValueRef JSSQLDataControlConsumer::update( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toObject(1, false); + validator.toString(2, false); + validator.toFunction(3, true); + validator.toFunction(4, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + DataControlConverter converter(context); JSSQLDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; @@ -312,26 +356,26 @@ JSValueRef JSSQLDataControlConsumer::update( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -346,9 +390,32 @@ JSValueRef JSSQLDataControlConsumer::select( JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toArrayObject(1, false); + validator.toString(2, false); + validator.toFunction(3, false); + validator.toFunction(4, true); + validator.toULong(5, true); + validator.toULong(6, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + JSSQLDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; JSValueRef errorCallBack = NULL; @@ -384,7 +451,7 @@ JSValueRef JSSQLDataControlConsumer::select( unsigned int reqId = converter.toULong(reserveArguments[0]); - LogDebug(reqId); + LoggerD(reqId); std::vector columns = converter.toVectorOfStrings(reserveArguments[1]); @@ -394,7 +461,7 @@ JSValueRef JSSQLDataControlConsumer::select( std::string where = converter.toString(reserveArguments[2]); - LogDebug(where); + LoggerD(where); successCallback = converter.toFunctionOrNull(reserveArguments[3]); @@ -428,26 +495,26 @@ JSValueRef JSSQLDataControlConsumer::select( } Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } @@ -460,15 +527,34 @@ JSValueRef JSSQLDataControlConsumer::remove( JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); + // argument validation with new validator + try + { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toULong(0, false); + validator.toString(1, false); + validator.toFunction(2, true); + validator.toFunction(3, true); + } + catch (const BasePlatformException &err) + { + return JSWebAPIException::throwException(context, exception, err); + } + catch (...) + { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + DataControlConverter converter(context); JSSQLDataControlConsumerPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); JSValueRef successCallback = NULL; JSValueRef errorCallBack = NULL; size_t index = 0; - JSValueRef reserveArguments[5]; + JSValueRef reserveArguments[4]; if (priv == NULL) { @@ -484,7 +570,7 @@ JSValueRef JSSQLDataControlConsumer::remove( AceSecurityStatus status = DATACONTROL_CHECK_ACCESS(DATACONTROL_FUNC_CONSUMER); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - for (index = 0; index < 5; index++) + for (index = 0; index < 4; index++) { if (index < argumentCount) reserveArguments[index] = arguments[index]; @@ -518,26 +604,26 @@ JSValueRef JSSQLDataControlConsumer::remove( Catch (WrtDeviceApis::Commons::ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error"); } Catch (WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgumentException"); + LoggerE("InvalidArgumentException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "type mismatch error"); } Catch(WrtDeviceApis::Commons::UnsupportedException) { - LogError("UnsupportException"); + LoggerE("UnsupportException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Unsupport Exception"); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("UnkownException"); + LoggerE("UnkownException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unkown error"); } diff --git a/src/DataControl/JSSelectObjectArrayValues.cpp b/src/DataControl/JSSelectObjectArrayValues.cpp old mode 100755 new mode 100644 index ac4cf4d..bd48806 --- a/src/DataControl/JSSelectObjectArrayValues.cpp +++ b/src/DataControl/JSSelectObjectArrayValues.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include @@ -25,6 +24,7 @@ #include "DataControlConverter.h" #include "JSSelectObjectArrayValues.h" #include "DataControlConverter.h" +#include #define FUNCTION_CONCAT "concat" #define FUNCTION_JOIN "join" @@ -113,7 +113,7 @@ JSValueRef JSSelectObjectArrayValues::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); @@ -158,7 +158,7 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, { Try { - LogDebug("Enter"); + LoggerD("Enter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -169,7 +169,7 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, DataControlConverter converter(priv->getContext()); int index = converter.toSizeT(propertyName); - LogDebug(index); + LoggerD(index); ISelectDataObjectPtr SelectDataOjbect = priv->getObject(); if (index < SelectDataOjbect->getRowNumber()) @@ -179,7 +179,7 @@ bool JSSelectObjectArrayValues::hasProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return false; } @@ -191,7 +191,7 @@ JSValueRef JSSelectObjectArrayValues::getProperty(JSContextRef context, { Try { - LogDebug("Eneter"); + LoggerD("Eneter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -202,7 +202,7 @@ JSValueRef JSSelectObjectArrayValues::getProperty(JSContextRef context, DataControlConverter converter(priv->getContext()); size_t index = converter.toSizeT(propertyName); - LogDebug(index); + LoggerD(index); ISelectDataObjectPtr SelectDataOjbect = priv->getObject(); if (index >= SelectDataOjbect->getRowNumber()) @@ -231,7 +231,7 @@ JSValueRef JSSelectObjectArrayValues::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); @@ -281,7 +281,7 @@ bool JSSelectObjectArrayValues::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); }*/ return false; @@ -314,7 +314,7 @@ bool JSSelectObjectArrayValues::deleteProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch"); }*/ return false; @@ -326,7 +326,7 @@ void JSSelectObjectArrayValues::getPropertyNames(JSContextRef context, { Try { - LogDebug("Eneter"); + LoggerD("Eneter"); JSSelectObjectArrayValuesPriv* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) @@ -346,7 +346,7 @@ void JSSelectObjectArrayValues::getPropertyNames(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } } diff --git a/src/DataControl/MappedDataControlConsumer.cpp b/src/DataControl/MappedDataControlConsumer.cpp old mode 100755 new mode 100644 index b2b58f5..9369f43 --- a/src/DataControl/MappedDataControlConsumer.cpp +++ b/src/DataControl/MappedDataControlConsumer.cpp @@ -92,7 +92,7 @@ static std::vector getDataArrayFromBundle(bundle *b, std::string ke static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventGetValuePendingEvent *pendingEvent = NULL; MappedDataControlConsumer *consumer = NULL; @@ -104,7 +104,7 @@ static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsv { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -120,7 +120,7 @@ static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsv for (index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 3) @@ -154,7 +154,7 @@ static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsv } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -169,7 +169,7 @@ static void MappedDataControlGetValueCallback(bundle* b, int request_code, appsv static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventAddValuePendingEvent *pendingEvent = NULL; @@ -180,7 +180,7 @@ static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsv { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -196,7 +196,7 @@ static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsv for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -216,7 +216,7 @@ static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsv } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -231,11 +231,11 @@ static void MappedDataControlAddValueCallback(bundle* b, int request_code, appsv static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); if (data == NULL) { - LogDebug("Data or Bundle error"); + LoggerD("Data or Bundle error"); return; } @@ -247,7 +247,7 @@ static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, ap { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -263,7 +263,7 @@ static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, ap for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -284,7 +284,7 @@ static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, ap } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -298,7 +298,7 @@ static void MappedDataControlRemoveValueCallback(bundle* b, int request_code, ap static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventUpdateValuePendingEvent* pendingEvent = NULL; MappedDataControlConsumer *consumer = NULL; @@ -308,7 +308,7 @@ static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, ap { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -324,7 +324,7 @@ static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, ap for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -344,7 +344,7 @@ static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, ap } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -359,7 +359,7 @@ static void MappedDataControlUpdateValueCallback(bundle* b, int request_code, ap } MappedDataControlConsumer::MappedDataControlConsumer() { - LogDebug("Enter"); + LoggerD("Enter"); m_appId = ""; m_type = "";; @@ -370,7 +370,7 @@ MappedDataControlConsumer::MappedDataControlConsumer() MappedDataControlConsumer::~MappedDataControlConsumer() { - LogDebug("Enter"); + LoggerD("Enter"); } DPL::Mutex MappedDataControlConsumer::m_mutex; @@ -424,18 +424,18 @@ std::string MappedDataControlConsumer::getApplicationId(const std::string& provI if (m_appId.length() == 0) { - LogDebug("need " << passId); + LoggerD("need " << passId); if( pkgmgr_datacontrol_get_info(passId, OSP_PKGINFO_MAP_TYPE, &appId, &access) < 0) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get appId error"); } - LogDebug("need2"); + LoggerD("need2"); if (appId) { - LogDebug(appId); + LoggerD(appId); appIdStr = appId; free(appId); } @@ -565,7 +565,7 @@ void MappedDataControlConsumer::removeReqId(unsigned int reqId) void MappedDataControlConsumer::OnRequestReceived(const EventAddValuePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -639,7 +639,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventAddValuePtr& event) { event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } @@ -654,7 +654,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventAddValuePtr& event) void MappedDataControlConsumer::OnRequestReceived(const EventRemoveValuePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -719,7 +719,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventRemoveValuePtr& eve } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -736,7 +736,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventRemoveValuePtr& eve void MappedDataControlConsumer::OnRequestReceived(const EventGetValuePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -801,7 +801,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventGetValuePtr& event) } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -816,7 +816,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventGetValuePtr& event) void MappedDataControlConsumer::OnRequestReceived(const EventUpdateValuePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -882,7 +882,7 @@ void MappedDataControlConsumer::OnRequestReceived(const EventUpdateValuePtr& eve } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } diff --git a/src/DataControl/RowData.h b/src/DataControl/RowData.h old mode 100755 new mode 100644 index cc2b818..ac700b8 --- a/src/DataControl/RowData.h +++ b/src/DataControl/RowData.h @@ -23,6 +23,7 @@ #include #include #include +#include namespace DeviceAPI { namespace DataControl { @@ -37,7 +38,7 @@ public: RowData(std::vector& keys, std::vector& values) { - LogDebug("entered"); + LoggerD("entered"); if (keys.size() == 0) { diff --git a/src/DataControl/SelectDataObject.cpp b/src/DataControl/SelectDataObject.cpp old mode 100755 new mode 100644 index 926e569..dd10c35 --- a/src/DataControl/SelectDataObject.cpp +++ b/src/DataControl/SelectDataObject.cpp @@ -32,7 +32,7 @@ namespace DataControl { SelectDataObject::SelectDataObject() { - LogDebug("Enter"); + LoggerD("Enter"); m_colCount = 0; m_rowCount = 0; @@ -41,33 +41,33 @@ SelectDataObject::SelectDataObject() SelectDataObject::~SelectDataObject() { - LogDebug("Enter"); + LoggerD("Enter"); m_istream.close(); if (unlink(m_filePath.c_str()) != 0) { - LogError("Error while removing SelectDataObject."); + LoggerE("Error while removing SelectDataObject."); } } void SelectDataObject::openResultPath(const std::string& filepath) { - LogDebug("Enter"); + LoggerD("Enter"); m_filePath = filepath; m_istream.open(m_filePath.c_str(), std::ios::binary); if (m_istream.is_open()) { - LogDebug("load header"); + LoggerD("load header"); loadHeader(); - LogDebug("print header"); // debug + LoggerD("print header"); // debug printHeader(); } else { - LogDebug("fail open" << filepath); + LoggerD("fail open" << filepath); } } @@ -79,7 +79,7 @@ void SelectDataObject::getIndexedRow(const EventGetIndexedRowPtr& event) void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); char *buf = NULL; try @@ -133,7 +133,7 @@ void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event) m_istream.read((char*)&type, sizeof(type)); // skip type m_istream.read((char*)&size, sizeof(int)); // read size - LogDebug(type << " - " << size << " "); + LoggerD(type << " - " << size << " "); if (memorizedSize < size) { @@ -196,7 +196,7 @@ void SelectDataObject::OnRequestReceived(const EventGetIndexedRowPtr& event) } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } @@ -263,11 +263,11 @@ void SelectDataObject::loadHeader() } void SelectDataObject::printHeader() { - LogDebug("Eneter"); + LoggerD("Eneter"); for (size_t index = 0; index < m_headerInfo.size(); index++) { - LogDebug(m_headerInfo[index].m_type << " " << m_headerInfo[index].m_name); + LoggerD(m_headerInfo[index].m_type << " " << m_headerInfo[index].m_name); } } @@ -277,14 +277,14 @@ void SelectDataObject::moveOneRow() int index = 0; if (m_istream.good() == false) - LogDebug("Error"); + LoggerD("Error"); for (index = 0; index < m_colCount; index++) { size = 0; m_istream.seekg(sizeof(int), std::ios::cur); // skip type m_istream.read((char*)&size, sizeof(int)); // read size - LogDebug(size << " "); + LoggerD(size << " "); m_istream.seekg(size, std::ios::cur); // skip data } diff --git a/src/DataControl/SqlDataControlConsumer.cpp b/src/DataControl/SqlDataControlConsumer.cpp old mode 100755 new mode 100644 index 5d6e50f..21b1f62 --- a/src/DataControl/SqlDataControlConsumer.cpp +++ b/src/DataControl/SqlDataControlConsumer.cpp @@ -93,7 +93,7 @@ static std::vector getDataArrayFromBundle(bundle *b, std::string ke static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventSelectPendingEvent *pendingEvent = NULL; SQLDataControlConsumer *consumer = NULL; @@ -103,7 +103,7 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -119,7 +119,7 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 3) @@ -141,7 +141,7 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -156,7 +156,7 @@ static void sqldataControlSelectCallback(bundle* b, int request_code, appsvc_res static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventInsertPendingEvent *pendingEvent = NULL; @@ -167,7 +167,7 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -183,7 +183,7 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -202,14 +202,14 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res std::stringstream sstr(result[2]); long insertRowid = 0; sstr >> insertRowid; - LogDebug(result[2] << insertRowid); + LoggerD(result[2] << insertRowid); event->setRowId(insertRowid); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None); } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -224,11 +224,11 @@ static void sqldataControlInsertCallback(bundle* b, int request_code, appsvc_res static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); if (data == NULL) { - LogDebug("Data or Bundle error"); + LoggerD("Data or Bundle error"); return; } @@ -240,7 +240,7 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -256,7 +256,7 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -277,7 +277,7 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -291,7 +291,7 @@ static void sqldataControlDeleteCallback(bundle* b, int request_code, appsvc_res static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_result_val res, void* data) { - LogDebug("Enter"); + LoggerD("Enter"); EventUpdatePendingEvent* pendingEvent = NULL; SQLDataControlConsumer *consumer = NULL; @@ -301,7 +301,7 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res { if (data == NULL) { - LogDebug("data null, can not send result to JS Layer"); + LoggerD("data null, can not send result to JS Layer"); return; } @@ -317,7 +317,7 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res for (size_t index = 0; index < result.size(); index++) { - LogDebug(result[index]); + LoggerD(result[index]); } if (result.size() < 2) @@ -337,7 +337,7 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -352,7 +352,7 @@ static void sqldataControlUpdateCallback(bundle* b, int request_code, appsvc_res } SQLDataControlConsumer::SQLDataControlConsumer() { - LogDebug("Enter"); + LoggerD("Enter"); m_appId = ""; m_type = "";; @@ -364,7 +364,7 @@ SQLDataControlConsumer::SQLDataControlConsumer() SQLDataControlConsumer::~SQLDataControlConsumer() { - LogDebug("Enter"); + LoggerD("Enter"); } DPL::Mutex SQLDataControlConsumer::m_mutex; @@ -451,18 +451,18 @@ std::string SQLDataControlConsumer::getApplicationId(const std::string& provId) if (m_appId.length() == 0) { - LogDebug("need " << passId); + LoggerD("need " << passId); if( pkgmgr_datacontrol_get_info(passId, OSP_PKGINFO_SQL_TYPE, &appId, &access) < 0) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "get appId error"); } - LogDebug("need2"); + LoggerD("need2"); if (appId) { - LogDebug(appId); + LoggerD(appId); appIdStr = appId; free(appId); } @@ -555,7 +555,7 @@ void SQLDataControlConsumer::updateData(const EventUpdatePtr& event) void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -646,7 +646,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event) { event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } @@ -661,7 +661,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventInsertPtr& event) void SQLDataControlConsumer::OnRequestReceived(const EventDeletePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -733,7 +733,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventDeletePtr& event) } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -750,7 +750,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventDeletePtr& event) void SQLDataControlConsumer::OnRequestReceived(const EventSelectPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -874,7 +874,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventSelectPtr& event) } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } @@ -889,7 +889,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventSelectPtr& event) void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); bundle* passData = NULL; try @@ -986,7 +986,7 @@ void SQLDataControlConsumer::OnRequestReceived(const EventUpdatePtr& event) } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); event->setErrorMsg(ex.GetMessage()); } diff --git a/src/DataControl/plugin_initializer.cpp b/src/DataControl/plugin_initializer.cpp old mode 100755 new mode 100644 index 0e0d849..db350ec --- a/src/DataControl/plugin_initializer.cpp +++ b/src/DataControl/plugin_initializer.cpp @@ -15,13 +15,13 @@ // limitations under the License. // -#include #include #include #include #include "JSDataControlManager.h" #include "DataControlAsyncCallbackManager.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -31,7 +31,7 @@ namespace DataControl { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\DataControl ] on_widget_start_callback ("<(context)); } diff --git a/src/DataSync/DataSyncConverter.cpp b/src/DataSync/DataSyncConverter.cpp old mode 100755 new mode 100644 index 12cc2ab..310ff6e --- a/src/DataSync/DataSyncConverter.cpp +++ b/src/DataSync/DataSyncConverter.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include @@ -25,6 +23,7 @@ #include "JSSyncServiceInfo.h" #include "JSSyncProfileInfo.h" #include "JSSyncStatistics.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -64,7 +63,7 @@ std::string DataSyncConverter::toTizenValue(SyncInfo::SyncMode abstractValue) co return TIZEN_DATA_SYNC_MODE_PUSH; default: { - LogWarning("Invalid sync mode."); + LoggerW("Invalid sync mode."); return ""; } } @@ -106,7 +105,7 @@ std::string DataSyncConverter::toTizenValue(SyncInfo::SyncType abstractValue) co return TIZEN_DATA_SYNC_TYPE_REFRESH_FROM_SERVER; default: { - LogWarning("Invalid sync type."); + LoggerW("Invalid sync type."); return ""; } } @@ -156,7 +155,7 @@ std::string DataSyncConverter::toTizenValue(SyncInfo::SyncInterval abstractValue return TIZEN_DATA_SYNC_INTERVAL_1_MONTH; default: { - LogWarning("Invalid sync interval."); + LoggerW("Invalid sync interval."); return ""; } } @@ -182,7 +181,7 @@ std::string DataSyncConverter::toTizenValue(SyncServiceInfo::SyncServiceType abs return TIZEN_DATA_SYNC_SERVICE_TYPE_EVENT; default: { - LogWarning("Invalid sync service type."); + LoggerW("Invalid sync service type."); return ""; } } @@ -201,7 +200,7 @@ std::string DataSyncConverter::toTizenValue(SyncStatistics::SyncStatus abstractV return TIZEN_DATA_SYNC_STATUS_NONE; default: { - LogWarning("Invalid sync status type."); + LoggerW("Invalid sync status type."); return ""; } } @@ -218,7 +217,7 @@ SyncServiceInfoListPtr DataSyncConverter::toServiceInfoList(JSValueRef serviceIn std::vector resultVector; JSObjectRef objArg = toJSObjectRef(serviceInfoList); - LogDebug("Array length "< -#include #include #include #include @@ -28,6 +27,7 @@ #include "JSDataSyncManager.h" #include "IDataSyncManager.h" #include +#include namespace DeviceAPI { namespace DataSync { @@ -61,14 +61,14 @@ class DataSyncListenerCanceller : public DeviceAPI::Common::IListenerItem { DataSyncManagerPrivObject *privateObject = static_cast(JSObjectGetPrivate(m_object)); if (!privateObject) { - LogWarning("Object is null."); + LoggerW("Object is null."); return; } IDataSyncManagerPtr datasyncManager = privateObject->getObject(); Try { - LogDebug("Remove change listeners for datasync operation with id: "<setForSynchronousCall(); datasyncManager->stopSync(dplEvent); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/DataSync/DataSyncManager.cpp b/src/DataSync/DataSyncManager.cpp old mode 100755 new mode 100644 index f5aa191..c710213 --- a/src/DataSync/DataSyncManager.cpp +++ b/src/DataSync/DataSyncManager.cpp @@ -21,11 +21,9 @@ #include "SyncServiceInfo.h" #include "SyncProfileInfo.h" -#include - #include - #include +#include using namespace WrtDeviceApis::Commons; @@ -36,12 +34,12 @@ int DataSyncManager::m_instanceCount = 0; DataSyncManager::DataSyncManager() { - LogInfo("Initialize the datasync manager with count: "<setProfileId(profileDirName); } if(NULL==progress) { - LogWarning("Null status."); + LoggerW("Null status."); eventPtr->setSessionStatus(OnDataSyncStateChanged::UNDEFINED_STATUS); } else if(0==strcmp(progress, "DONE")) { eventPtr->setSessionStatus(OnDataSyncStateChanged::COMPLETE_STATUS); @@ -97,7 +95,7 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use // Error cases should be redefined and transferred based on the error value. eventPtr->setSessionStatus(OnDataSyncStateChanged::FAIL_STATUS); } else { - LogWarning("Wrong status."); + LoggerW("Wrong status."); eventPtr->setSessionStatus(OnDataSyncStateChanged::UNDEFINED_STATUS); } @@ -111,7 +109,7 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } if(profileDirName) { @@ -136,7 +134,7 @@ static int datasync_state_changed_cb(sync_agent_event_data_s* request, void *use static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_data) { - LogDebug("DataSync progress called."); + LoggerD("DataSync progress called."); char *profileDirName = NULL; int syncType = 0; @@ -151,14 +149,14 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat int isFromServer, totalPerOperation, syncedPerOperation, totalPerDb, syncedPerDb; - LogDebug("Get progress info."); + LoggerD("Get progress info."); sync_agent_get_event_data_param(request, &profileDirName); sync_agent_get_event_data_param(request, &syncType); sync_agent_get_event_data_param(request, &uri); sync_agent_get_event_data_param(request, &progressStatus); sync_agent_get_event_data_param(request, &operationType); - LogDebug("profileDirName: "<setProfileId(profileDirName); @@ -179,7 +177,7 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat } else if(SYNC_AGENT_SRC_URI_CALENDAR==uri) { eventPtr->setServiceType(SyncServiceInfo::EVENT_SERVICE_TYPE); } else { - LogWarning("Wrong service type."); + LoggerW("Wrong service type."); eventPtr->setServiceType(SyncServiceInfo::UNDEFINED_SERVICE_TYPE); } @@ -197,7 +195,7 @@ static int datasync_progress_cb(sync_agent_event_data_s* request, void *user_dat } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } if(profileDirName) { @@ -229,7 +227,7 @@ static sync_agent_ds_sync_mode_e convertToPlatformSyncMode(SyncInfo::SyncMode sy } else if(SyncInfo::PUSH_MODE==syncMode) { return SYNC_AGENT_SYNC_MODE_PUSH; } else { - LogWarning("Error while converting a sync mode."); + LoggerW("Error while converting a sync mode."); } return SYNC_AGENT_SYNC_MODE_MANUAL; @@ -244,7 +242,7 @@ static SyncInfo::SyncMode convertToSyncMode(sync_agent_ds_sync_mode_e syncMode) } else if(SYNC_AGENT_SYNC_MODE_PUSH==syncMode) { return SyncInfo::PUSH_MODE; } else { - LogWarning("Error while converting a sync mode."); + LoggerW("Error while converting a sync mode."); } return SyncInfo::UNDEFINED_MODE; @@ -265,7 +263,7 @@ static sync_agent_ds_sync_type_e convertToPlatformSyncType(SyncInfo::SyncType sy } else if(SyncInfo::REFRESH_FROM_SERVER_TYPE==syncType) { return SYNC_AGENT_SYNC_TYPE_REFRESH_FROM_SERVER; } else { - LogWarning("Error while converting a sync type."); + LoggerW("Error while converting a sync type."); } return SYNC_AGENT_SYNC_TYPE_UPDATE_BOTH; @@ -286,7 +284,7 @@ static SyncInfo::SyncType convertToSyncType(sync_agent_ds_sync_type_e syncType) } else if(SYNC_AGENT_SYNC_TYPE_REFRESH_FROM_SERVER==syncType) { return SyncInfo::REFRESH_FROM_SERVER_TYPE; } else { - LogWarning("Error while converting a sync type."); + LoggerW("Error while converting a sync type."); } return SyncInfo::UNDEFINED_TYPE; @@ -311,7 +309,7 @@ static sync_agent_ds_sync_interval_e convertToPlatformSyncInterval(SyncInfo::Syn } else if(SyncInfo::INTERVAL_1_MONTH==syncInterval) { return SYNC_AGENT_SYNC_INTERVAL_1_MONTH; } else { - LogWarning("Error while converting a sync interval."); + LoggerW("Error while converting a sync interval."); } return SYNC_AGENT_SYNC_INTERVAL_1_WEEK; @@ -336,7 +334,7 @@ static SyncInfo::SyncInterval convertToSyncInterval(sync_agent_ds_sync_interval_ } else if(SYNC_AGENT_SYNC_INTERVAL_1_MONTH==syncInterval) { return SyncInfo::INTERVAL_1_MONTH; } else { - LogWarning("Error while converting a sync interval."); + LoggerW("Error while converting a sync interval."); } return SyncInfo::INTERVAL_UNDEFINED; @@ -349,7 +347,7 @@ static sync_agent_ds_service_type_e convertToPlatformSyncServiceType(SyncService } else if(SyncServiceInfo::EVENT_SERVICE_TYPE==serviceType) { return SYNC_AGENT_CALENDAR; } else { - LogWarning("Error while converting a sync service type."); + LoggerW("Error while converting a sync service type."); } return SYNC_AGENT_CONTACT; @@ -362,7 +360,7 @@ static SyncServiceInfo::SyncServiceType convertToSyncServiceType(sync_agent_ds_s } else if(SYNC_AGENT_CALENDAR==serviceType) { return SyncServiceInfo::EVENT_SERVICE_TYPE; } else { - LogWarning("Error while converting a sync service type."); + LoggerW("Error while converting a sync service type."); } return SyncServiceInfo::UNDEFINED_SERVICE_TYPE; @@ -375,7 +373,7 @@ static sync_agent_ds_src_uri_e convertToPlatformSourceUri(SyncServiceInfo::SyncS } else if(SyncServiceInfo::EVENT_SERVICE_TYPE==serviceType) { return SYNC_AGENT_SRC_URI_CALENDAR; } else { - LogWarning("Error while converting a sync service."); + LoggerW("Error while converting a sync service."); } return SYNC_AGENT_SRC_URI_CONTACT; @@ -392,7 +390,7 @@ static SyncStatistics::SyncStatus convertToSyncStatus(char* status) } else if(0==strcmp(status, "No")) { return SyncStatistics::NONE_STATUS; } else { - LogWarning("Error while converting a sync status."); + LoggerW("Error while converting a sync status."); } return SyncStatistics::UNDEFINED_STATUS; @@ -422,7 +420,7 @@ void DataSyncManager::OnRequestReceived(const IEventAddProfilePtr &event) if(profile_list) { g_list_free(profile_list); } - LogDebug("numProfiles: "<getSyncInfo()->getUrl()); + LoggerD("url: "<getSyncInfo()->getUrl()); ret = sync_agent_ds_create_profile_info(&profile_h); if (SYNC_AGENT_DS_SUCCESS!=ret) { @@ -453,7 +451,7 @@ void DataSyncManager::OnRequestReceived(const IEventAddProfilePtr &event) sync_agent_ds_sync_mode_e syncMode = convertToPlatformSyncMode(profile->getSyncInfo()->getSyncMode()); sync_agent_ds_sync_type_e syncType = convertToPlatformSyncType(profile->getSyncInfo()->getSyncType()); sync_agent_ds_sync_interval_e syncInterval = convertToPlatformSyncInterval(profile->getSyncInfo()->getSyncInterval()); - LogDebug("syncMode: "<at(i)->getPassword(); enable = categories->at(i)->getEnable(); - LogDebug("serviceType: "<setResult(false); event->setExceptionCode(ExceptionCodes::OutOfRangeException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -539,7 +537,7 @@ void DataSyncManager::OnRequestReceived(const IEventUpdateProfilePtr &event) ThrowMsg(NullPointerException, "SyncProfileInfo is NULL."); } - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; @@ -564,7 +562,7 @@ void DataSyncManager::OnRequestReceived(const IEventUpdateProfilePtr &event) sync_agent_ds_sync_mode_e syncMode = convertToPlatformSyncMode(profile->getSyncInfo()->getSyncMode()); sync_agent_ds_sync_type_e syncType = convertToPlatformSyncType(profile->getSyncInfo()->getSyncType()); sync_agent_ds_sync_interval_e syncInterval = convertToPlatformSyncInterval(profile->getSyncInfo()->getSyncInterval()); - LogDebug("syncMode: "<at(i)->getPassword(); enable = categories->at(i)->getEnable(); - LogDebug("serviceType: "<setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -625,7 +623,7 @@ void DataSyncManager::OnRequestReceived(const IEventRemoveProfilePtr &event) Try { - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; @@ -646,13 +644,13 @@ void DataSyncManager::OnRequestReceived(const IEventRemoveProfilePtr &event) } Catch(NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -666,7 +664,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetMaxProfilesNumPtr &event) { Try { - LogDebug("Return maximum number of supported profiles: "<setNumMaxProfiles(MAX_PROFILES_NUM); @@ -674,7 +672,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetMaxProfilesNumPtr &event) } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -697,10 +695,10 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilesNumPtr &event) int numProfiles=0; for (iter = profile_list; iter != NULL; iter = g_list_next(iter)) { sync_agent_ds_free_profile_info((ds_profile_h) iter->data); - LogDebug("Free sync_agent_ds_profile_info for index: "<setNumProfiles(numProfiles); @@ -708,7 +706,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilesNumPtr &event) } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -720,7 +718,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event) Try { - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; @@ -752,7 +750,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event) profile->getSyncInfo()->setId(server_info.id); profile->getSyncInfo()->setPassword(server_info.password); - LogDebug("Url: "<getSyncInfo()->getUrl()); + LoggerD("Url: "<getSyncInfo()->getUrl()); sync_agent_ds_sync_info sync_info; ret = sync_agent_ds_get_sync_info(profile_h, &sync_info); @@ -763,7 +761,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event) profile->getSyncInfo()->setSyncType(convertToSyncType(sync_info.sync_type)); profile->getSyncInfo()->setSyncInterval(convertToSyncInterval(sync_info.interval)); - LogDebug("Sync mode: "<service_type) { - LogDebug("Skip unsupported sync service type: "<service_type); + LoggerD("Skip unsupported sync service type: "<service_type); continue; } @@ -793,7 +791,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event) serviceInfo->setServerDatabaseUri(category_info->tgt_uri); } - LogDebug("Service type: "<getSyncServiceType()<<", DB URI: "<getServerDatabaseUri()); + LoggerD("Service type: "<getSyncServiceType()<<", DB URI: "<getServerDatabaseUri()); profile->getServiceInfo()->push_back(serviceInfo); } if(category_list) { @@ -806,13 +804,13 @@ void DataSyncManager::OnRequestReceived(const IEventGetProfilePtr &event) } Catch(NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -837,7 +835,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) ThrowMsg(PlatformException, "Platform error while getting all profiles: "<data; SyncProfileInfoPtr profile( new SyncProfileInfo() ); @@ -852,7 +850,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) ss<setProfileId(ss.str()); - LogDebug("Processing a profile with id: "<getProfileId()); + LoggerD("Processing a profile with id: "<getProfileId()); char *profileName = NULL; ret = sync_agent_ds_get_profile_name(profile_h, &profileName); @@ -870,7 +868,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) profile->getSyncInfo()->setId(server_info.id); profile->getSyncInfo()->setPassword(server_info.password); - LogDebug("Url: "<getSyncInfo()->getUrl()); + LoggerD("Url: "<getSyncInfo()->getUrl()); sync_agent_ds_sync_info sync_info; ret = sync_agent_ds_get_sync_info(profile_h, &sync_info); @@ -881,7 +879,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) profile->getSyncInfo()->setSyncType(convertToSyncType(sync_info.sync_type)); profile->getSyncInfo()->setSyncInterval(convertToSyncInterval(sync_info.interval)); - LogDebug("Sync mode: "<service_type) { - LogDebug("Skip unsupported sync service type: "<service_type); + LoggerD("Skip unsupported sync service type: "<service_type); continue; } @@ -911,14 +909,14 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) serviceInfo->setServerDatabaseUri(category_info->tgt_uri); } - LogDebug("Service type: "<getSyncServiceType()<<", DB URI: "<getServerDatabaseUri()); + LoggerD("Service type: "<getSyncServiceType()<<", DB URI: "<getServerDatabaseUri()); profile->getServiceInfo()->push_back(serviceInfo); } if(category_list) { g_list_free(category_list); } - LogDebug("Adding a profile to the list."); + LoggerD("Adding a profile to the list."); event->getProfiles()->push_back(profile); } @@ -926,12 +924,12 @@ void DataSyncManager::OnRequestReceived(const IEventGetAllProfilesPtr &event) } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } - LogDebug("Free profiles list."); + LoggerD("Free profiles list."); for (iter = profile_list; iter != NULL; iter = g_list_next(iter)) { sync_agent_ds_free_profile_info((ds_profile_h) iter->data); } @@ -946,7 +944,7 @@ void DataSyncManager::OnRequestReceived(const IEventStartSyncPtr &event) Try { - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; sync_agent_event_error_e err= SYNC_AGENT_EVENT_FAIL; @@ -975,7 +973,7 @@ void DataSyncManager::OnRequestReceived(const IEventStartSyncPtr &event) } if(event->getEmitter()) { - LogDebug("Attaching the emitter with profileId: "<getProfileId()); + LoggerD("Attaching the emitter with profileId: "<getProfileId()); m_changeEmitters[std::string("Sync") + event->getProfileId()] = event->getEmitter(); } @@ -983,13 +981,13 @@ void DataSyncManager::OnRequestReceived(const IEventStartSyncPtr &event) } Catch(NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -1005,7 +1003,7 @@ void DataSyncManager::OnRequestReceived(const IEventStopSyncPtr &event) Try { - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; @@ -1026,13 +1024,13 @@ void DataSyncManager::OnRequestReceived(const IEventStopSyncPtr &event) } Catch(NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } @@ -1049,7 +1047,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev Try { - LogDebug("id: "<getProfileId()); + LoggerD("id: "<getProfileId()); sync_agent_ds_error_e ret = SYNC_AGENT_DS_FAIL; @@ -1070,7 +1068,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev } int statistics_count = g_list_length(statistics_list); - LogDebug("statistics_count: "<setServiceType(convertToSyncServiceType(SYNC_AGENT_CONTACT)); } else if(1==i) { - LogDebug("Statistics for event."); + LoggerD("Statistics for event."); statisticsPtr->setServiceType(convertToSyncServiceType(SYNC_AGENT_CALENDAR)); } else { - LogWarning("Unsupported category for statistics: "<dbsynced); + LoggerD("dbsynced: "<dbsynced); statisticsPtr->setSyncStatus(convertToSyncStatus(statistics->dbsynced)); statisticsPtr->setClientToServerTotal(statistics->client2server_total); statisticsPtr->setClientToServerAdded(statistics->client2server_nrofadd); @@ -1099,7 +1097,7 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev statisticsPtr->setServerToClientUpdated(statistics->server2client_nrofreplace); statisticsPtr->setServerToClientRemoved(statistics->server2client_nrofdelete); - LogDebug("ClientToServerTotal: "<getClientToServerTotal()<<", ServerToClientTotal: "<getServerToClientTotal()); + LoggerD("ClientToServerTotal: "<getClientToServerTotal()<<", ServerToClientTotal: "<getServerToClientTotal()); statisticsList->push_back(statisticsPtr); } @@ -1113,13 +1111,13 @@ void DataSyncManager::OnRequestReceived(const IEventGetLastSyncStatisticsPtr &ev } Catch(NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::NotFoundException); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); event->setResult(false); event->setExceptionCode(ExceptionCodes::PlatformException); } diff --git a/src/DataSync/DataSyncResponseDispatcher.cpp b/src/DataSync/DataSyncResponseDispatcher.cpp old mode 100755 new mode 100644 index 7b8d052..1c12839 --- a/src/DataSync/DataSyncResponseDispatcher.cpp +++ b/src/DataSync/DataSyncResponseDispatcher.cpp @@ -15,15 +15,14 @@ // limitations under the License. // - #include "DataSyncResponseDispatcher.h" #include "DataSyncConverter.h" #include "DataSyncMultiCallback.h" -#include #include #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -52,7 +51,7 @@ void DataSyncResponseDispatcher::onAnswerReceived(const OnDataSyncStateChangedPt DataSyncStateChangeCallbackPrivateDataPtr multiCallbacks = DPL::StaticPointerCast(event->getPrivateData()); if (!multiCallbacks) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -63,7 +62,7 @@ void DataSyncResponseDispatcher::onAnswerReceived(const OnDataSyncStateChangedPt DataSyncConverter converter(context); JSValueRef profileId = converter.toJSValueRef(event->getProfileId()); if( OnDataSyncStateChanged::PROGRESS_STATUS==event->getSessionStatus() ) { - LogDebug("Sync progress: "<getSyncedPerService()<<"/"<getTotalPerService()); + LoggerD("Sync progress: "<getSyncedPerService()<<"/"<getTotalPerService()); JSValueRef serviceType = converter.toJSValueRef(converter.toTizenValue(event->getServiceType())); JSValueRef isFromServer = converter.toJSValueRef(event->getIsFromServer()); JSValueRef totalPerService = converter.toJSValueRef(event->getTotalPerService()); @@ -71,13 +70,13 @@ void DataSyncResponseDispatcher::onAnswerReceived(const OnDataSyncStateChangedPt JSValueRef objParam[5] = {profileId, serviceType, isFromServer, totalPerService, syncedPerService}; multiCallbacks->getOnProgress()->callOnSuccess(objParam, 5); } else if ( OnDataSyncStateChanged::COMPLETE_STATUS==event->getSessionStatus() ) { - LogDebug("Sync completed."); + LoggerD("Sync completed."); multiCallbacks->getOnCompleted()->callOnSuccess(profileId); } else if ( OnDataSyncStateChanged::STOP_STATUS==event->getSessionStatus() ) { - LogDebug("Sync stopped."); + LoggerD("Sync stopped."); multiCallbacks->getOnStopped()->callOnSuccess(profileId); } else if ( OnDataSyncStateChanged::FAIL_STATUS==event->getSessionStatus()) { - LogDebug("Sync failed with: "<getExceptionCode()); + LoggerD("Sync failed with: "<getExceptionCode()); JSValueRef errorObject; if (ExceptionCodes::PlatformException==event->getExceptionCode()) { //errorObject = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NETWORK_ERROR, event->getErrorMessage()); @@ -88,15 +87,15 @@ void DataSyncResponseDispatcher::onAnswerReceived(const OnDataSyncStateChangedPt JSValueRef objParam[2] = {profileId, errorObject}; multiCallbacks->getOnFailed()->callOnSuccess(objParam, 2); } else { - LogWarning("Wrong sync session state."); + LoggerW("Wrong sync session state."); } } else { - LogWarning("Failed result received."); + LoggerW("Failed result received."); } } Catch(Exception) { - LogError("Error during processing answer."); + LoggerE("Error during processing answer."); } } diff --git a/src/DataSync/JSDataSyncManager.cpp b/src/DataSync/JSDataSyncManager.cpp old mode 100755 new mode 100644 index a1b0677..0d2f23f --- a/src/DataSync/JSDataSyncManager.cpp +++ b/src/DataSync/JSDataSyncManager.cpp @@ -15,11 +15,7 @@ // limitations under the License. // - -#include - #include - #include #include #include @@ -32,7 +28,6 @@ #include "OnDataSyncStateChanged.h" #include "DataSyncManager.h" - #include "JSDataSyncManager.h" #include "DataSyncConverter.h" #include "JSSyncInfo.h" @@ -42,6 +37,7 @@ #include "DataSyncResponseDispatcher.h" #include "DataSyncMultiCallback.h" #include "DataSyncListenerManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -90,14 +86,14 @@ JSClassRef JSDataSyncManager::m_jsClassRef = JSClassCreate(JSDataSyncManager::ge void JSDataSyncManager::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogInfo("Create datasync manager private object."); + LoggerI("Create datasync manager private object."); IDataSyncManagerPtr datasync(new DataSyncManager()); DataSyncManagerPrivObject *priv = new DataSyncManagerPrivObject(context, datasync); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogInfo("Private object already set."); + LoggerI("Private object already set."); } } @@ -105,7 +101,7 @@ void JSDataSyncManager::finalize(JSObjectRef object) { DataSyncManagerPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogInfo("Deleting datasync manager private object."); + LoggerI("Deleting datasync manager private object."); delete priv; JSObjectSetPrivate(object, NULL); } @@ -161,7 +157,7 @@ JSValueRef JSDataSyncManager::add(JSContextRef context, ThrowMsg(ConversionException, "Parameter conversion failed."); } - LogDebug("profileName: "<getProfileName()); + LoggerD("profileName: "<getProfileName()); IEventAddProfilePtr dplEvent(new IEventAddProfile()); @@ -170,7 +166,7 @@ JSValueRef JSDataSyncManager::add(JSContextRef context, datasyncManager->addProfile(dplEvent); if (dplEvent->getResult()) { - LogDebug("Add succeeded with id: "<getProfile()->getProfileId()); + LoggerD("Add succeeded with id: "<getProfile()->getProfileId()); return JSValueMakeUndefined(context); } else { if (ExceptionCodes::OutOfRangeException==dplEvent->getExceptionCode()) { @@ -182,27 +178,27 @@ JSValueRef JSDataSyncManager::add(JSContextRef context, } Catch(OutOfRangeException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, "QuotaExceededError", _rethrown_exception.GetMessage()); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -244,7 +240,7 @@ JSValueRef JSDataSyncManager::update(JSContextRef context, ThrowMsg(ConversionException, "Parameter conversion failed."); } - LogDebug("profileName: "<getProfileName()); + LoggerD("profileName: "<getProfileName()); IEventUpdateProfilePtr dplEvent(new IEventUpdateProfile()); @@ -253,7 +249,7 @@ JSValueRef JSDataSyncManager::update(JSContextRef context, datasyncManager->updateProfile(dplEvent); if (dplEvent->getResult()) { - LogDebug("Update succeeded with id: "<getProfile()->getProfileId()); + LoggerD("Update succeeded with id: "<getProfile()->getProfileId()); return JSValueMakeUndefined(context); } else { ThrowMsg(UnknownException, "Update failed by unknown reason."); @@ -261,22 +257,22 @@ JSValueRef JSDataSyncManager::update(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -309,7 +305,7 @@ JSValueRef JSDataSyncManager::remove(JSContextRef context, profileId = converter.toString(arguments[0]); } - LogDebug("profileId: "<removeProfile(dplEvent); if (dplEvent->getResult()) { - LogDebug("Remove succeeded with id: "<getProfileId()); + LoggerD("Remove succeeded with id: "<getProfileId()); return JSValueMakeUndefined(context); } else { if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) { @@ -330,27 +326,27 @@ JSValueRef JSDataSyncManager::remove(JSContextRef context, } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -384,7 +380,7 @@ JSValueRef JSDataSyncManager::getMaxProfilesNum(JSContextRef context, datasyncManager->getMaxProfilesNum(dplEvent); if (dplEvent->getResult()) { - LogDebug("Max number of profiles: "<getNumMaxProfiles()); + LoggerD("Max number of profiles: "<getNumMaxProfiles()); return converter.toJSValueRef(dplEvent->getNumMaxProfiles()); } else { ThrowMsg(UnknownException, "Get the max number of profiles failed by unknown reason."); @@ -392,22 +388,22 @@ JSValueRef JSDataSyncManager::getMaxProfilesNum(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -441,7 +437,7 @@ JSValueRef JSDataSyncManager::getProfilesNum(JSContextRef context, datasyncManager->getProfilesNum(dplEvent); if (dplEvent->getResult()) { - LogDebug("Number of profiles: "<getNumProfiles()); + LoggerD("Number of profiles: "<getNumProfiles()); return converter.toJSValueRef(dplEvent->getNumProfiles()); } else { ThrowMsg(UnknownException, "Get the number of profiles failed by unknown reason."); @@ -449,22 +445,22 @@ JSValueRef JSDataSyncManager::getProfilesNum(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -497,7 +493,7 @@ JSValueRef JSDataSyncManager::get(JSContextRef context, profileId = converter.toString(arguments[0]); } - LogDebug("profileId: "<getProfile(dplEvent); if (dplEvent->getResult()) { - LogDebug("Get succeeded with id: "<getProfileId()); + LoggerD("Get succeeded with id: "<getProfileId()); return JSSyncProfileInfo::createJSSyncProfileInfo(context, dplEvent->getProfile()); } else { if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) { @@ -518,27 +514,27 @@ JSValueRef JSDataSyncManager::get(JSContextRef context, } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -572,7 +568,7 @@ JSValueRef JSDataSyncManager::getAll(JSContextRef context, datasyncManager->getAllProfiles(dplEvent); if (dplEvent->getResult()) { - LogDebug("Getting all profiles succeeded with length: "<getProfiles()->size()); + LoggerD("Getting all profiles succeeded with length: "<getProfiles()->size()); return converter.toJSValueRefProfileInfoList(dplEvent->getProfiles()); } else { ThrowMsg(UnknownException, "Getting all profiles failed by unknown reason."); @@ -580,22 +576,22 @@ JSValueRef JSDataSyncManager::getAll(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } @@ -629,15 +625,15 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context, if (argumentCount>=1) { profileId = converter.toString(arguments[0]); } - LogDebug("profileId: "<=2) { - LogDebug("Process the listener callback."); + LoggerD("Process the listener callback."); if (JSValueIsObject(context, arguments[1])) { - LogDebug("Non-null callbacks."); + LoggerD("Non-null callbacks."); JSObjectRef objectCallbacks = converter.toJSObjectRef(arguments[1]); JSCallbackManagerPtr onProgressCbm(NULL), onCompletedCbm(NULL), onStoppedCbm(NULL), onFailedCbm(NULL); @@ -685,16 +681,16 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context, emitter->setListener(&DataSyncResponseDispatcher::getInstance()); emitter->setEventPrivateData(DPL::StaticPointerCast(privData)); - LogDebug("Set the emitter."); + LoggerD("Set the emitter."); dplEvent->setEmitter(emitter); } else if (JSValueIsNull(context, arguments[1]) || JSValueIsUndefined(context, arguments[1]) ) { - LogDebug("Null or undefined listener."); + LoggerD("Null or undefined listener."); } else { ThrowMsg(ConversionException, "Wrong second parameter type."); } } - LogDebug("Proceed the start sync event to the platform."); + LoggerD("Proceed the start sync event to the platform."); dplEvent->setProfileId(profileId); dplEvent->setForSynchronousCall(); @@ -702,13 +698,13 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context, if (dplEvent->getResult()) { if(dplEvent->getEmitter()) { - LogDebug("watcherId: "<(canceller); DataSyncListenerManagerSingleton::Instance().registerListener(listenerItem, globalContext); } - LogDebug("Starting the sync succeeded."); + LoggerD("Starting the sync succeeded."); } else { switch (dplEvent->getExceptionCode()) { case ExceptionCodes::NotFoundException: @@ -725,27 +721,27 @@ JSValueRef JSDataSyncManager::startSync(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -779,7 +775,7 @@ JSValueRef JSDataSyncManager::stopSync(JSContextRef context, if (argumentCount>=1) { profileId = converter.toString(arguments[0]); } - LogDebug("profileId: "<stopSync(dplEvent); if (dplEvent->getResult()) { - LogDebug("Stop sync succeeded."); + LoggerD("Stop sync succeeded."); } else { if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) { ThrowMsg(NotFoundException, "Id not found."); @@ -799,27 +795,27 @@ JSValueRef JSDataSyncManager::stopSync(JSContextRef context, } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -855,7 +851,7 @@ JSValueRef JSDataSyncManager::getLastSyncStatistics(JSContextRef context, profileId = converter.toString(arguments[0]); } - LogDebug("profileId: "<getLastSyncStatistics(dplEvent); if (dplEvent->getResult()) { - LogDebug("Get sync statistics succeeded with length: "<getSyncStatistics()->size()); + LoggerD("Get sync statistics succeeded with length: "<getSyncStatistics()->size()); return converter.toJSValueRefSyncStatisticsList(dplEvent->getSyncStatistics()); } else { if (ExceptionCodes::NotFoundException==dplEvent->getExceptionCode()) { @@ -876,27 +872,27 @@ JSValueRef JSDataSyncManager::getLastSyncStatistics(JSContextRef context, } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } } diff --git a/src/DataSync/JSSyncInfo.cpp b/src/DataSync/JSSyncInfo.cpp old mode 100755 new mode 100644 index 076ae96..4ab0054 --- a/src/DataSync/JSSyncInfo.cpp +++ b/src/DataSync/JSSyncInfo.cpp @@ -19,10 +19,10 @@ #include "JSSyncInfo.h" #include "DataSyncConverter.h" -#include #include #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -88,14 +88,14 @@ void JSSyncInfo::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create JSSyncInfo private object."); + LoggerD("Create JSSyncInfo private object."); SyncInfoPtr syncInfo( new SyncInfo() ); SyncInfoPrivateObject *priv = new SyncInfoPrivateObject(context, syncInfo); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -103,7 +103,7 @@ void JSSyncInfo::finalize(JSObjectRef object) { SyncInfoPrivateObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("Deleting JSSyncInfo private object."); + LoggerD("Deleting JSSyncInfo private object."); delete priv; JSObjectSetPrivate(object, NULL); } @@ -138,7 +138,7 @@ void JSSyncInfo::setPrivateObject(const SyncInfoPtr &syncInfo, } Catch(Exception) { - LogError("Error during setting JSSyncInfo object."); + LoggerE("Error during setting JSSyncInfo object."); } } @@ -167,7 +167,7 @@ JSObjectRef JSSyncInfo::constructor(JSContextRef context, syncInfo->setSyncMode(converter.toSyncMode(converter.toString(arguments[3]))); } - LogDebug("url: "<getUrl()<<", id: "<getId()<<", password: "<getPassword()<<", mode: "<getSyncMode()); + LoggerD("url: "<getUrl()<<", id: "<getId()<<", password: "<getPassword()<<", mode: "<getSyncMode()); if (SyncInfo::MANUAL_MODE==syncInfo->getSyncMode()) { if (argumentCount>=5) { @@ -178,29 +178,29 @@ JSObjectRef JSSyncInfo::constructor(JSContextRef context, syncInfo->setSyncInterval(converter.toSyncInterval(converter.toString(arguments[4]))); } } else { - LogDebug("The sync mode should be push."); + LoggerD("The sync mode should be push."); } return createJSSyncInfo(context, syncInfo); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -238,12 +238,12 @@ JSValueRef JSSyncInfo::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_SYNC_INFO_INTERVAL)) { return converter.toJSValueRef(converter.toTizenValue(syncInfo->getSyncInterval())); } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -285,12 +285,12 @@ bool JSSyncInfo::setProperty(JSContextRef context, syncInfo->setSyncInterval(converter.toSyncInterval(converter.toString(value))); return true; } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/DataSync/JSSyncProfileInfo.cpp b/src/DataSync/JSSyncProfileInfo.cpp old mode 100755 new mode 100644 index 3c963cf..414d47f --- a/src/DataSync/JSSyncProfileInfo.cpp +++ b/src/DataSync/JSSyncProfileInfo.cpp @@ -21,11 +21,11 @@ #include "JSSyncServiceInfo.h" #include "DataSyncConverter.h" -#include #include #include #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -89,14 +89,14 @@ void JSSyncProfileInfo::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create JSSyncProfileInfo private object."); + LoggerD("Create JSSyncProfileInfo private object."); SyncProfileInfoPtr syncProfileInfo( new SyncProfileInfo() ); SyncProfileInfoPrivateObject *priv = new SyncProfileInfoPrivateObject(context, syncProfileInfo); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -104,7 +104,7 @@ void JSSyncProfileInfo::finalize(JSObjectRef object) { SyncProfileInfoPrivateObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("Deleting JSSyncProfileInfo private object."); + LoggerD("Deleting JSSyncProfileInfo private object."); delete priv; JSObjectSetPrivate(object, NULL); } @@ -139,7 +139,7 @@ void JSSyncProfileInfo::setPrivateObject(const SyncProfileInfoPtr &syncProfileIn } Catch(Exception) { - LogError("Error during setting JSSyncProfileInfo object."); + LoggerE("Error during setting JSSyncProfileInfo object."); } } @@ -171,28 +171,28 @@ JSObjectRef JSSyncProfileInfo::constructor(JSContextRef context, syncProfileInfo->setServiceInfo(converter.toServiceInfoList(arguments[2])); } - LogDebug("profileName: "<getProfileName()<<", syncInfo url: "<getSyncInfo()->getUrl()<<", serviceInfo.length: "<getServiceInfo()->size()); + LoggerD("profileName: "<getProfileName()<<", syncInfo url: "<getSyncInfo()->getUrl()<<", serviceInfo.length: "<getServiceInfo()->size()); return createJSSyncProfileInfo(context, syncProfileInfo); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -224,12 +224,12 @@ JSValueRef JSSyncProfileInfo::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_SYNC_PROFILE_INFO_SERVICE_INFO)) { return converter.toJSValueRefServiceInfoList(syncProfileInfo->getServiceInfo()); } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -262,12 +262,12 @@ bool JSSyncProfileInfo::setProperty(JSContextRef context, syncProfileInfo->setServiceInfo(converter.toServiceInfoList(value)); return true; } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/DataSync/JSSyncServiceInfo.cpp b/src/DataSync/JSSyncServiceInfo.cpp old mode 100755 new mode 100644 index b66e07b..3b0d488 --- a/src/DataSync/JSSyncServiceInfo.cpp +++ b/src/DataSync/JSSyncServiceInfo.cpp @@ -17,12 +17,11 @@ #include "JSSyncServiceInfo.h" - -#include #include #include #include #include "DataSyncConverter.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -87,14 +86,14 @@ void JSSyncServiceInfo::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create JSSyncServiceInfo private object."); + LoggerD("Create JSSyncServiceInfo private object."); SyncServiceInfoPtr syncServiceInfo( new SyncServiceInfo() ); SyncServiceInfoPrivateObject *priv = new SyncServiceInfoPrivateObject(context, syncServiceInfo); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -102,7 +101,7 @@ void JSSyncServiceInfo::finalize(JSObjectRef object) { SyncServiceInfoPrivateObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("Deleting JSSyncServiceInfo private object."); + LoggerD("Deleting JSSyncServiceInfo private object."); delete priv; JSObjectSetPrivate(object, NULL); } @@ -137,7 +136,7 @@ void JSSyncServiceInfo::setPrivateObject(const SyncServiceInfoPtr &syncServiceIn } Catch(Exception) { - LogError("Error during setting JSSyncServiceInfo object."); + LoggerE("Error during setting JSSyncServiceInfo object."); } } @@ -169,28 +168,28 @@ JSObjectRef JSSyncServiceInfo::constructor(JSContextRef context, syncServiceInfo->setPassword(converter.toString(arguments[4])); } - LogDebug("enable: "<getEnable()<<", serviceType: "<getSyncServiceType()<<", serverDatabaseUri: "<getServerDatabaseUri()<<", id: "<getId()<<", password: "<getPassword()); + LoggerD("enable: "<getEnable()<<", serviceType: "<getSyncServiceType()<<", serverDatabaseUri: "<getServerDatabaseUri()<<", id: "<getId()<<", password: "<getPassword()); return createJSSyncServiceInfo(context, syncServiceInfo); } Catch(UnsupportedException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::NOT_SUPPORTED_ERROR, _rethrown_exception.GetMessage()); } Catch(InvalidArgumentException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -226,12 +225,12 @@ JSValueRef JSSyncServiceInfo::getProperty(JSContextRef context, // For a privacy reason. return JSValueMakeNull(context); } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -270,12 +269,12 @@ bool JSSyncServiceInfo::setProperty(JSContextRef context, syncServiceInfo->setPassword(converter.toString(value)); return true; } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return true; diff --git a/src/DataSync/JSSyncStatistics.cpp b/src/DataSync/JSSyncStatistics.cpp old mode 100755 new mode 100644 index 440b48e..2bb1260 --- a/src/DataSync/JSSyncStatistics.cpp +++ b/src/DataSync/JSSyncStatistics.cpp @@ -19,10 +19,10 @@ #include "JSSyncStatistics.h" #include "DataSyncConverter.h" -#include #include #include #include +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -93,14 +93,14 @@ void JSSyncStatistics::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { - LogDebug("Create JSSyncStatistics private object."); + LoggerD("Create JSSyncStatistics private object."); SyncStatisticsPtr syncStatistics( new SyncStatistics() ); SyncStatisticsPrivateObject *priv = new SyncStatisticsPrivateObject(context, syncStatistics); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -108,7 +108,7 @@ void JSSyncStatistics::finalize(JSObjectRef object) { SyncStatisticsPrivateObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("Deleting JSSyncStatistics private object."); + LoggerD("Deleting JSSyncStatistics private object."); delete priv; JSObjectSetPrivate(object, NULL); } @@ -143,7 +143,7 @@ void JSSyncStatistics::setPrivateObject(const SyncStatisticsPtr &syncStatistics, } Catch(Exception) { - LogError("Error during setting JSSyncStatistics object."); + LoggerE("Error during setting JSSyncStatistics object."); } } @@ -190,12 +190,12 @@ JSValueRef JSSyncStatistics::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_SYNC_STATISTICS_CLIENT_TO_SERVER_REMOVED)) { return converter.toJSValueRef(syncStatistics->getClientToServerRemoved()); } else { - LogDebug("Wrong property name."); + LoggerD("Wrong property name."); } } Catch(Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); diff --git a/src/DataSync/plugin_initializer.cpp b/src/DataSync/plugin_initializer.cpp old mode 100755 new mode 100644 index 05ac4c6..83ba01a --- a/src/DataSync/plugin_initializer.cpp +++ b/src/DataSync/plugin_initializer.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -27,6 +24,7 @@ #include "JSSyncServiceInfo.h" #include "JSSyncProfileInfo.h" #include "DataSyncListenerManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace DeviceAPI::Common; @@ -36,34 +34,34 @@ namespace DataSync { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\DataSync] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\DataSync] on_widget_start_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch (Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\DataSync] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\DataSync] on_widget_stop_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch (Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\DataSync] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\DataSync] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\DataSync] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\DataSync] on_frame_unload_callback (" << context << ")"); DataSyncListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); } diff --git a/src/Download/DownloadCallback.cpp b/src/Download/DownloadCallback.cpp index eb46d58..d6f678c 100755 --- a/src/Download/DownloadCallback.cpp +++ b/src/Download/DownloadCallback.cpp @@ -34,12 +34,12 @@ DownloadCallback::DownloadCallback(JSContextRef globalCtx, JSObjectRef object) mCallbackUserData = new MultiCallbackUserData(globalCtx); // onprogress - JSValueRef onprogress = JSUtil::getProperty(globalCtx, object, "onprogress"); - if (JSValueIsUndefined(globalCtx, onprogress)) { - onprogress = NULL; - } else { - JSObjectRef cbObj = JSValueToObject(globalCtx, onprogress, NULL); - if (JSObjectIsFunction(globalCtx, cbObj)) { + JSStringRef onprogress = JSStringCreateWithUTF8CString("onprogress"); + bool has_onprogress = JSObjectHasProperty(globalCtx, object, onprogress); + JSStringRelease(onprogress); + if (has_onprogress) { + JSObjectRef cbObj = JSUtil::JSValueToObject(globalCtx, JSUtil::getProperty(globalCtx, object, "onprogress")); + if( JSObjectIsFunction(globalCtx, cbObj) ){ mCallbackUserData->setCallback("onprogress", cbObj); } else { throw TypeMismatchException("onprogress is not a callback function."); @@ -47,12 +47,12 @@ DownloadCallback::DownloadCallback(JSContextRef globalCtx, JSObjectRef object) } // onpaused - JSValueRef onpaused = JSUtil::getProperty(globalCtx, object, "onpaused"); - if (JSValueIsUndefined(globalCtx, onpaused)) { - onpaused = NULL; - } else { - JSObjectRef cbObj = JSValueToObject(globalCtx, onpaused, NULL); - if (JSObjectIsFunction(globalCtx, cbObj)) { + JSStringRef onpaused = JSStringCreateWithUTF8CString("onpaused"); + bool has_onpaused = JSObjectHasProperty(globalCtx, object, onpaused); + JSStringRelease(onpaused); + if (has_onpaused) { + JSObjectRef cbObj = JSUtil::JSValueToObject(globalCtx, JSUtil::getProperty(globalCtx, object, "onpaused")); + if( JSObjectIsFunction(globalCtx, cbObj) ){ mCallbackUserData->setCallback("onpaused", cbObj); } else { throw TypeMismatchException("onpaused is not a callback function."); @@ -60,12 +60,12 @@ DownloadCallback::DownloadCallback(JSContextRef globalCtx, JSObjectRef object) } // oncanceled - JSValueRef oncanceled = JSUtil::getProperty(globalCtx, object, "oncanceled"); - if (JSValueIsUndefined(globalCtx, oncanceled)) { - oncanceled = NULL; - } else { - JSObjectRef cbObj = JSValueToObject(globalCtx, oncanceled, NULL); - if (JSObjectIsFunction(globalCtx, cbObj)) { + JSStringRef oncanceled = JSStringCreateWithUTF8CString("oncanceled"); + bool has_oncanceled = JSObjectHasProperty(globalCtx, object, oncanceled); + JSStringRelease(oncanceled); + if (has_oncanceled) { + JSObjectRef cbObj = JSUtil::JSValueToObject(globalCtx, JSUtil::getProperty(globalCtx, object, "oncanceled")); + if( JSObjectIsFunction(globalCtx, cbObj) ){ mCallbackUserData->setCallback("oncanceled", cbObj); } else { throw TypeMismatchException("oncanceled is not a callback function."); @@ -73,12 +73,12 @@ DownloadCallback::DownloadCallback(JSContextRef globalCtx, JSObjectRef object) } // oncompleted - JSValueRef oncompleted = JSUtil::getProperty(globalCtx, object, "oncompleted"); - if (JSValueIsUndefined(globalCtx, oncompleted)) { - oncompleted = NULL; - } else { - JSObjectRef cbObj = JSValueToObject(globalCtx, oncompleted, NULL); - if (JSObjectIsFunction(globalCtx, cbObj)) { + JSStringRef oncompleted = JSStringCreateWithUTF8CString("oncompleted"); + bool has_oncompleted = JSObjectHasProperty(globalCtx, object, oncompleted); + JSStringRelease(oncompleted); + if (has_oncompleted) { + JSObjectRef cbObj = JSUtil::JSValueToObject(globalCtx, JSUtil::getProperty(globalCtx, object, "oncompleted")); + if( JSObjectIsFunction(globalCtx, cbObj) ){ mCallbackUserData->setCallback("oncompleted", cbObj); } else { throw TypeMismatchException("oncompleted is not a callback function."); @@ -86,12 +86,12 @@ DownloadCallback::DownloadCallback(JSContextRef globalCtx, JSObjectRef object) } // onfailed - JSValueRef onfailed = JSUtil::getProperty(globalCtx, object, "onfailed"); - if (JSValueIsUndefined(globalCtx, onfailed)) { - onfailed = NULL; - } else { - JSObjectRef cbObj = JSValueToObject(globalCtx, onfailed, NULL); - if (JSObjectIsFunction(globalCtx, cbObj)) { + JSStringRef onfailed = JSStringCreateWithUTF8CString("onfailed"); + bool has_onfailed = JSObjectHasProperty(globalCtx, object, onfailed); + JSStringRelease(onfailed); + if (has_onfailed) { + JSObjectRef cbObj = JSUtil::JSValueToObject(globalCtx, JSUtil::getProperty(globalCtx, object, "onfailed")); + if( JSObjectIsFunction(globalCtx, cbObj) ){ mCallbackUserData->setCallback("onfailed", cbObj); } else { throw TypeMismatchException("onfailed is not a callback function."); diff --git a/src/Download/DownloadManager.cpp b/src/Download/DownloadManager.cpp index f489683..4cd771f 100644 --- a/src/Download/DownloadManager.cpp +++ b/src/Download/DownloadManager.cpp @@ -112,7 +112,7 @@ static std::string _get_download_error(int err) } if (!success) { - LogError("Platform error %d <%s>", err, msg.c_str()); + LoggerE("Platform error %d <%s>", err, msg.c_str()); } return msg; @@ -185,14 +185,14 @@ static gboolean downloadEventCB(void *data) { ret = download_destroy(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { - LogWarning("Platform error while destroying download handle. downloadId=" << downloadId); + LoggerW("Platform error while destroying download handle. downloadId=" << downloadId); } std::string virtualPath; try { virtualPath = DeviceAPI::Filesystem::Utils::toVirtualPath(NULL, fullPath); } catch (...) { - LogWarning("Platform error while converting fullPath."); + LoggerW("Platform error while converting fullPath."); virtualPath = fullPath; } @@ -218,14 +218,14 @@ static gboolean downloadEventCB(void *data) { std::string errMessage; ret = download_get_error(downloadId, (download_error_e*)&err); if (ret != DOWNLOAD_ERROR_NONE) { - LogWarning("Platform error while getting download error. "); + LoggerW("Platform error while getting download error. "); } else { errMessage = _get_download_error(err); } ret = download_destroy(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { - LogWarning("Platform error while destroying download handle. downloadId=" << downloadId); + LoggerW("Platform error while destroying download handle. downloadId=" << downloadId); } UnknownException error(errMessage.c_str()); @@ -247,7 +247,7 @@ static gboolean downloadEventCB(void *data) { ret = download_destroy(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { - LogWarning("Platform error while destroying download handle. downloadId=" << downloadId); + LoggerW("Platform error while destroying download handle. downloadId=" << downloadId); } callback->oncanceled(downloadId); @@ -255,11 +255,11 @@ static gboolean downloadEventCB(void *data) { break; } default: - LogWarning("State changed is ignored."); + LoggerW("State changed is ignored."); break; } } catch (const BasePlatformException &err) { - LogError("download_state_changed_cb: %s", err.getMessage().c_str()); + LoggerE("download_state_changed_cb: %s", err.getMessage().c_str()); } delete fnData; @@ -268,7 +268,7 @@ static gboolean downloadEventCB(void *data) { static void download_state_changed_cb(int downloadId, download_state_e state, void *user_data) { - LogDebug("download_state_changed_cb, downloadId=%d, state=%d", downloadId, (int)state); + LoggerD("download_state_changed_cb, downloadId=%d, state=%d", downloadId, (int)state); DOWNLOAD_EVENT_DATA_T *data = new DOWNLOAD_EVENT_DATA_T; data->downloadId = downloadId; data->state = state; @@ -282,7 +282,7 @@ static void download_state_changed_cb(int downloadId, download_state_e state, vo static void download_progress_cb(int downloadId, unsigned long long received, void *user_data) { - LogDebug("download_progress_cb, downloadId=%d, received=%ld", downloadId, received); + LoggerD("download_progress_cb, downloadId=%d, received=%ld", downloadId, received); DOWNLOAD_EVENT_DATA_T *data = new DOWNLOAD_EVENT_DATA_T; data->downloadId = downloadId; data->state = DOWNLOAD_STATE_DOWNLOADING; @@ -330,7 +330,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download int ret; int downloadId = 0; - LogDebug("entered"); + LoggerD("entered"); if (!request) { throw TypeMismatchException("request is NULL."); @@ -342,7 +342,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download std::string networkType = request->getNetworkType(); std::map httpHeader = request->getHttpHeader(); - LogDebug("url <%s>, destination <%s>, fileName <%s>", url.c_str(), destination.c_str(), fileName.c_str()); + LoggerD("url <%s>, destination <%s>, fileName <%s>", url.c_str(), destination.c_str(), fileName.c_str()); if (url.empty()) { throw InvalidValuesException("Invalid DownloadRequest.url."); @@ -364,10 +364,10 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download DeviceAPI::Filesystem::IPathPtr path = DeviceAPI::Filesystem::Utils::fromVirtualPath(NULL, destination); fullPath = path->getFullPath(); } catch (...) { - LogWarning("Converting virtual path is failed. [%s]", destination.c_str()); + LoggerW("Converting virtual path is failed. [%s]", destination.c_str()); fullPath = destination; } - LogDebug("Converted FullPath = <%s>", fullPath.c_str()); + LoggerD("Converted FullPath = <%s>", fullPath.c_str()); ret = download_set_destination(downloadId, fullPath.c_str()); if (ret != DOWNLOAD_ERROR_NONE) { throw UnknownException(("Platform error while setting destination. " + _get_download_error(ret)).c_str()); @@ -420,7 +420,7 @@ long DownloadManager::start(DownloadRequest *request, DownloadCallback *download throw UnknownException(("Platform error while starting download. " + _get_download_error(ret)).c_str()); } - LogDebug("downloadId: %d", downloadId); + LoggerD("downloadId: %d", downloadId); setCallbackToMap(downloadId, downloadCallback); @@ -431,7 +431,7 @@ void DownloadManager::cancel(long downloadId) { int ret; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_cancel(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { @@ -448,7 +448,7 @@ void DownloadManager::pause(long downloadId) { int ret; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_pause(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { @@ -465,7 +465,7 @@ void DownloadManager::resume(long downloadId) { int ret; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_start(downloadId); if (ret != DOWNLOAD_ERROR_NONE) { @@ -484,7 +484,7 @@ std::string DownloadManager::getState(long downloadId) download_state_e state; std::string result; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_get_state(downloadId, &state); if (ret != DOWNLOAD_ERROR_NONE) { @@ -518,7 +518,7 @@ std::string DownloadManager::getState(long downloadId) break; default: result = "undefined"; - LogWarning("Unknown DownloadState was returned."); + LoggerW("Unknown DownloadState was returned."); break; } @@ -538,7 +538,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId) char *fieldValue = NULL; int fieldLength = 0; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_get_url(downloadId, &url); if (ret != DOWNLOAD_ERROR_NONE) { @@ -594,7 +594,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId) for (i = 0; i < fieldLength; i++) { ret = download_get_http_header_field(downloadId, fieldNames[i], &fieldValue); if (ret != DOWNLOAD_ERROR_NONE) { - LogWarning("Platform error while getting http header field. " << _get_download_error(ret)); + LoggerW("Platform error while getting http header field. " << _get_download_error(ret)); } httpHeader.insert(make_pair(std::string(fieldNames[i]), std::string(fieldValue))); free(fieldNames[i]); @@ -614,7 +614,7 @@ DownloadRequest* DownloadManager::getDownloadRequest(long downloadId) try { virtualPath = DeviceAPI::Filesystem::Utils::toVirtualPath(NULL, destination); } catch (...) { - LogWarning("Platform error while converting destination path."); + LoggerW("Platform error while converting destination path."); virtualPath = destination; } request->setDestination(virtualPath); @@ -652,7 +652,7 @@ std::string DownloadManager::getMIMEType(long downloadId) char *mimeType = NULL; std::string result(""); - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_get_mime_type(downloadId, &mimeType); if (ret != DOWNLOAD_ERROR_NONE) { @@ -680,7 +680,7 @@ void DownloadManager::setListener(long downloadId, DownloadCallback *downloadCal { int ret; - LogDebug("entered. downloadId = %d", downloadId); + LoggerD("entered. downloadId = %d", downloadId); ret = download_set_state_changed_cb(downloadId, download_state_changed_cb, this); if (ret != DOWNLOAD_ERROR_NONE) { diff --git a/src/Download/JSDownloadManager.cpp b/src/Download/JSDownloadManager.cpp index accf54d..a18a550 100644 --- a/src/Download/JSDownloadManager.cpp +++ b/src/Download/JSDownloadManager.cpp @@ -146,11 +146,11 @@ JSValueRef JSDownloadManager::startDownload(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSUtil::toJSValueRef(context, downloadId); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.start()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -185,11 +185,11 @@ JSValueRef JSDownloadManager::setListener(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.setListener()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -219,11 +219,11 @@ JSValueRef JSDownloadManager::cancelDownload(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.cancel()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -253,11 +253,11 @@ JSValueRef JSDownloadManager::pauseDownload(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.pause()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -287,11 +287,11 @@ JSValueRef JSDownloadManager::resumeDownload(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.resume()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -322,11 +322,11 @@ JSValueRef JSDownloadManager::getState(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSUtil::toJSValueRef(context, ret); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.resume()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -358,11 +358,11 @@ JSValueRef JSDownloadManager::getDownloadRequest(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return obj; } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.resume()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -392,11 +392,11 @@ JSValueRef JSDownloadManager::getMIMEType(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSUtil::toJSValueRef(context, ret); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in tizen.download.resume()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } diff --git a/src/Download/JSDownloadRequest.cpp b/src/Download/JSDownloadRequest.cpp old mode 100755 new mode 100644 index 23e8726..f937907 --- a/src/Download/JSDownloadRequest.cpp +++ b/src/Download/JSDownloadRequest.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "JSDownloadRequest.h" @@ -49,7 +50,7 @@ JSClassDefinition JSDownloadRequest::m_classInfo = { finalize, NULL, //hasProperty, NULL, //getProperty, - NULL, //setProperty, + setProperty, //setProperty, NULL, //deleteProperty, NULL, //getPropertyNames, NULL, //callAsFunction, @@ -76,21 +77,35 @@ JSClassRef JSDownloadRequest::getClassRef() void JSDownloadRequest::initialize(JSContextRef context, JSObjectRef object) { - if (!JSObjectGetPrivate(object)) { - DownloadRequest *priv = new DownloadRequest(); - if (!JSObjectSetPrivate(object, static_cast(priv))) { - delete priv; - } - } + if (!JSObjectGetPrivate(object)) { + DownloadRequest *priv = new DownloadRequest(); + if (!JSObjectSetPrivate(object, static_cast(priv))) { + delete priv; + } + } } void JSDownloadRequest::finalize(JSObjectRef object) { - DownloadRequest *priv = static_cast(JSObjectGetPrivate(object)); - if (priv) { - JSObjectSetPrivate(object, NULL); - delete priv; - } + DownloadRequest *priv = static_cast(JSObjectGetPrivate(object)); + if (priv) { + JSObjectSetPrivate(object, NULL); + delete priv; + } +} + +bool JSDownloadRequest::setProperty(JSContextRef context, JSObjectRef object, + JSStringRef propertyName, JSValueRef value, JSValueRef* exception) +{ + if (JSStringIsEqualToUTF8CString(propertyName, "networkType")) { + if (JSUtil::JSValueToString(context, value).compare("CELLULAR") && + JSUtil::JSValueToString(context, value).compare("WIFI") && + JSUtil::JSValueToString(context, value).compare("ALL")) + { + return true; + } + } + return false; } JSObjectRef JSDownloadRequest::constructor(JSContextRef context, @@ -99,56 +114,64 @@ JSObjectRef JSDownloadRequest::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - ArgumentValidator validator(context, argumentCount, arguments); + ArgumentValidator validator(context, argumentCount, arguments); - JSObjectRef obj = JSObjectMake(context, getClassRef(), NULL); + JSObjectRef obj = JSObjectMake(context, getClassRef(), NULL); - // constructor + // constructor JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor"); JSObjectSetProperty(context, obj, ctorName, constructor, - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); JSStringRelease(ctorName); - DownloadRequest *priv = new DownloadRequest(); + DownloadRequest *priv = new DownloadRequest(); - try { - priv->setUrl(validator.toString(0, true, "")); - } catch (const BasePlatformException& err) { - LogWarning("url convertion is failed. %s", err.getMessage().c_str()); - } + try { + priv->setUrl(validator.toString(0, true, "")); + } catch (const BasePlatformException& err) { + LoggerW("url convertion is failed. %s", err.getMessage().c_str()); + } - try { - priv->setDestination(validator.toString(1, true, "")); - } catch (const BasePlatformException& err) { - LogWarning("destination convertion is failed. %s", err.getMessage().c_str()); - } + try { + priv->setDestination(validator.toString(1, true, "")); + } catch (const BasePlatformException& err) { + LoggerW("destination convertion is failed. %s", err.getMessage().c_str()); + } - try { - priv->setFileName(validator.toString(2, true, "")); - } catch (const BasePlatformException& err) { - LogWarning("fileName convertion is failed. %s", err.getMessage().c_str()); - } + try { + priv->setFileName(validator.toString(2, true, "")); + } catch (const BasePlatformException& err) { + LoggerW("fileName convertion is failed. %s", err.getMessage().c_str()); + } - try { - priv->setNetworkType(validator.toString(3, true, "")); - } catch (const BasePlatformException& err) { - LogWarning("networkType convertion is failed. %s", err.getMessage().c_str()); - } + try { + std::string networkType = validator.toString(3, true, "ALL"); + if (networkType.compare("CELLULAR") && networkType.compare("WIFI") && networkType.compare("ALL")) { + delete priv; + TypeMismatchException err("networkType is invalid."); + JSObjectRef errObj = JSWebAPIErrorFactory::makeErrorObject(context, err); + *exception = errObj; + return errObj; + } + priv->setNetworkType(networkType); + } catch (const BasePlatformException& err) { + LoggerW("networkType convertion is failed. %s", err.getMessage().c_str()); + } - try { - priv->setHttpHeader(validator.toStringMap(4, true)); - } catch (const BasePlatformException& err) { - LogWarning("httpHeader convertion is failed. %s", err.getMessage().c_str()); - } + try { + priv->setHttpHeader(validator.toStringMap(4, true)); + } catch (const BasePlatformException& err) { + LoggerW("httpHeader convertion is failed. %s", err.getMessage().c_str()); + } - setPrivateObject(context, obj, priv); + setPrivateObject(context, obj, priv); return obj; } DownloadRequest* JSDownloadRequest::getPrivateObject(JSContextRef context, JSObjectRef object) { - DownloadRequest *priv = static_cast(JSObjectGetPrivate(object)); + DownloadRequest *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { throw TypeMismatchException("DownloadRequest's private object is NULL."); } @@ -178,31 +201,31 @@ DownloadRequest* JSDownloadRequest::getPrivateObject(JSContextRef context, JSObj void JSDownloadRequest::setPrivateObject(JSContextRef context, JSObjectRef object, DownloadRequest* priv) { - if (!priv) { - throw TypeMismatchException("DownloadRequest's private object is NULL."); - } + if (!priv) { + throw TypeMismatchException("DownloadRequest's private object is NULL."); + } JSObjectSetPrivate(object, static_cast(priv)); - // url - JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_URL, - JSUtil::toJSValueRef(context, priv->getUrl()), kJSPropertyAttributeNone); + // url + JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_URL, + JSUtil::toJSValueRef(context, priv->getUrl()), kJSPropertyAttributeNone); - // destination - JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_DESTINATION, - JSUtil::toJSValueRef(context, priv->getDestination()), kJSPropertyAttributeNone); + // destination + JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_DESTINATION, + JSUtil::toJSValueRef(context, priv->getDestination()), kJSPropertyAttributeNone); - // fileName - JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_FILE_NAME, - JSUtil::toJSValueRef(context, priv->getFileName()), kJSPropertyAttributeNone); + // fileName + JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_FILE_NAME, + JSUtil::toJSValueRef(context, priv->getFileName()), kJSPropertyAttributeNone); - // networkType - JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_NETWORK_TYPE, - JSUtil::toJSValueRef(context, priv->getNetworkType()), kJSPropertyAttributeNone); + // networkType + JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_NETWORK_TYPE, + JSUtil::toJSValueRef(context, priv->getNetworkType()), kJSPropertyAttributeNone); - // httpHeader - JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_HTTP_HEADER, - JSUtil::toJSValueRef(context, priv->getHttpHeader()), kJSPropertyAttributeNone); + // httpHeader + JSUtil::setProperty(context, object, TIZEN_DOWNLOAD_REQUEST_HTTP_HEADER, + JSUtil::toJSValueRef(context, priv->getHttpHeader()), kJSPropertyAttributeNone); } } // Download diff --git a/src/Download/JSDownloadRequest.h b/src/Download/JSDownloadRequest.h index 2e735fe..fc80478 100644 --- a/src/Download/JSDownloadRequest.h +++ b/src/Download/JSDownloadRequest.h @@ -55,11 +55,6 @@ private: */ static void finalize(JSObjectRef object); - static JSValueRef getProperty(JSContextRef context, - JSObjectRef object, - JSStringRef propertyName, - JSValueRef* exception); - static bool setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, diff --git a/src/Download/plugin_initializer.cpp b/src/Download/plugin_initializer.cpp index 166ec11..a10c8d4 100644 --- a/src/Download/plugin_initializer.cpp +++ b/src/Download/plugin_initializer.cpp @@ -45,36 +45,36 @@ class_definition_options_t DownloadRequestOptions = void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Download] on_widget_start_callback (%d)", widgetId); + LoggerD("[Tizen\\Download] on_widget_start_callback (%d)", widgetId); TIME_TRACER_INIT(); try { WrtAccessSingleton::Instance().initialize(widgetId); } catch (...) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Download] on_widget_stop_callback (%d)", widgetId); + LoggerD("[Tizen\\Download] on_widget_stop_callback (%d)", widgetId); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Download"); TIME_TRACER_RELEASE(); try { WrtAccessSingleton::Instance().deinitialize(widgetId); } catch (...) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\Download] on_frame_load_callback (%p)", context); + LoggerD("[Tizen\\Download] on_frame_load_callback (%p)", context); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Download] on_frame_unload_callback (%p)", context); + LoggerD("[Tizen\\Download] on_frame_unload_callback (%p)", context); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/Filesystem/Converter.cpp b/src/Filesystem/Converter.cpp index 7cfea33..3501f5d 100755 --- a/src/Filesystem/Converter.cpp +++ b/src/Filesystem/Converter.cpp @@ -17,7 +17,6 @@ #include "Converter.h" -#include #include "IManager.h" #include "IPath.h" @@ -27,6 +26,7 @@ #include "JSFile.h" #include "Encodings.h" #include "JSStorage.h" +#include namespace { const char* PROPERTY_FILEFILTER_NAME = "name"; diff --git a/src/Filesystem/FilesystemListenerManager.h b/src/Filesystem/FilesystemListenerManager.h old mode 100755 new mode 100644 index fe6bf93..5860ed8 --- a/src/Filesystem/FilesystemListenerManager.h +++ b/src/Filesystem/FilesystemListenerManager.h @@ -20,12 +20,12 @@ #include #include -#include #include #include #include #include "IManager.h" #include "StorageStaticController.h" +#include namespace DeviceAPI { namespace Filesystem { @@ -59,10 +59,10 @@ public: virtual void cancelListener() { Try { - LogDebug("Remove change listener"); + LoggerD("Remove change listener"); IManager::getInstance().removeStorageStateChangeListener(m_watchId); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Filesystem/FilesystemUtils.cpp b/src/Filesystem/FilesystemUtils.cpp old mode 100755 new mode 100644 index eae82dc..2835ecd --- a/src/Filesystem/FilesystemUtils.cpp +++ b/src/Filesystem/FilesystemUtils.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include #include "Enums.h" @@ -27,6 +25,7 @@ #include #include #include "FilesystemUtils.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -79,19 +78,19 @@ const PathToRootMap& getPathToRootMap() IPathPtr fromVirtualPath(JSContextRef context, const std::string& arg) { - LogDebug("arg:[" << arg << "]"); + LoggerD("arg:[" << arg << "]"); // uri path, strip file:// if (isUriPath(arg)) { std::string stripPath = arg.substr(strlen("file://")); - LogDebug("uri absolute path" << stripPath); + LoggerD("uri absolute path" << stripPath); IPathPtr result = IPath::create(stripPath); return result; } if (!isPathValid(arg)) { - LogDebug("virtual path is invalid:[" << arg << "]"); + LoggerD("virtual path is invalid:[" << arg << "]"); ThrowMsg(Commons::ConversionException, "Not found path component."); } @@ -116,7 +115,7 @@ IPathPtr fromVirtualPath(JSContextRef context, if (it == rootToPath.end()) { //ThrowMsg(Commons::NotFoundException, "Location not found."); - LogDebug("Allow non virtual root path " << arg); + LoggerD("Allow non virtual root path " << arg); return IPath::create(arg); } @@ -150,7 +149,7 @@ std::string toVirtualPath(JSContextRef context, const std::string& arg) { } path.erase(pos, path.size()); } - LogDebug("Allow non virtual root path"); + LoggerD("Allow non virtual root path"); return arg; // ThrowMsg(Commons::ConversionException, "Path doesn't contain a valid location type."); @@ -196,19 +195,19 @@ void toUTF8String(std::string fromEncoding, const char* from, const size_t fromL size_t outputLength= 0; try { -// LogDebug("from " << fromEncodingSet << " to UTF8 conversion " << fromLength); +// LoggerD("from " << fromEncodingSet << " to UTF8 conversion " << fromLength); cd = iconv_open("UTF-8", fromEncodingSet); if (cd == (iconv_t) -1) { - LogDebug("charset conversion exception iconv -1"); + LoggerD("charset conversion exception iconv -1"); ThrowMsg(Commons::PlatformException, "charset conversion exception"); } if (fromLength == 0) { - LogDebug("from length 0"); + LoggerD("from length 0"); ThrowMsg(Commons::PlatformException, "Couldn't allocate output buffer."); } @@ -220,12 +219,12 @@ void toUTF8String(std::string fromEncoding, const char* from, const size_t fromL ret = iconv(cd, (char**)&from, (size_t*)&fromLength, &buf, &outputLength); - LogDebug(fromLength << " " << outputLength); + LoggerD(fromLength << " " << outputLength); if (ret < 0) { iconv_close(cd); - LogDebug("charset conversion exception ret " << ret); + LoggerD("charset conversion exception ret " << ret); ThrowMsg(Commons::PlatformException, "charset conversion exception"); } @@ -237,7 +236,7 @@ void toUTF8String(std::string fromEncoding, const char* from, const size_t fromL } Catch(std::bad_alloc) { - LogDebug("Couldn't allocate output buffer."); + LoggerD("Couldn't allocate output buffer."); ThrowMsg(Commons::PlatformException, "Couldn't allocate output buffer."); } } diff --git a/src/Filesystem/JSFile.cpp b/src/Filesystem/JSFile.cpp old mode 100755 new mode 100644 index 7ec39e7..476dcae --- a/src/Filesystem/JSFile.cpp +++ b/src/Filesystem/JSFile.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -39,6 +38,11 @@ #include #include #include +#include +#include +#include +#include + #include #include "FilesystemUtils.h" #include "Converter.h" @@ -47,6 +51,7 @@ #include "JSFilestream.h" #include "ResponseDispatcher.h" #include "FilesystemAsyncCallbackManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -178,7 +183,7 @@ JSValueRef JSFile::getProperty(JSContextRef context, PrivateObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error"); } @@ -271,7 +276,7 @@ JSValueRef JSFile::getProperty(JSContextRef context, } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } /* else if (JSStringIsEqualToUTF8CString(propertyName, PROPERTY_READ_ONLY)) { @@ -320,7 +325,7 @@ JSValueRef JSFile::getProperty(JSContextRef context, return converter.toJSValueRef(children.size()); } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); }*/ return JSValueMakeUndefined(context); @@ -350,7 +355,7 @@ JSValueRef JSFile::toUri(JSContextRef context, TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); PrivateObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error"); } @@ -388,7 +393,21 @@ JSValueRef JSFile::listFiles(JSContextRef context, return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error"); } - LogDebug("OK"); + LoggerD("OK"); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(0, false); + validator.toFunction(1, true); + validator.toObject(2, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } JSContextRef globalContext = privateObject->getContext(); size_t index = 0; @@ -468,6 +487,19 @@ JSValueRef JSFile::openStream(JSContextRef context, return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error"); } + // argument validation with new validator + try { + ArgumentValidator validator(context, argumentCount, arguments); + validator.toFunction(1, false); + validator.toFunction(2, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + JSContextRef globalContext = privateObject->getContext(); JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext); @@ -556,6 +588,20 @@ JSValueRef JSFile::readAsText(JSContextRef context, } + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(0, false); + validator.toFunction(1, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + JSContextRef globalContext = privateObject->getContext(); AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_READ_AS_TEXT); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -641,6 +687,19 @@ JSValueRef JSFile::copyTo(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_COPY_TO); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(3, true); + validator.toFunction(4, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + try { @@ -727,7 +786,20 @@ JSValueRef JSFile::moveTo(JSContextRef context, JSContextRef globalContext = privateObject->getContext(); - LogDebug("OK"); + LoggerD("OK"); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(3, true); + validator.toFunction(4, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } size_t index = 0; JSValueRef reserveArguments[5]; @@ -919,20 +991,11 @@ JSValueRef JSFile::resolve(JSContextRef context, Converter converter(context); - - - try { - - - if (argc < 1) { ThrowMsg(InvalidArgumentException, "Invalid path name"); } - - - IPathPtr path = converter.toPath(argv[0]); INodePtr node = privateObject->getObject()->getNode()->getChild(path); node->setPermissions(privateObject->getObject()->getNode()->getPermissions()); @@ -983,15 +1046,25 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context, JSContextRef globalContext = privateObject->getContext(); - LogDebug("OK"); + LoggerD("OK"); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(2, true); + validator.toFunction(3, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } size_t index = 0; JSValueRef reserveArguments[4]; JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext); - - - try { for (index = 0; index < 4; index++) { if (index < argc) @@ -1036,7 +1109,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context, if (!eventResolve->getResult() || (eventResolve->getExceptionCode() != WrtDeviceApis::Commons::ExceptionCodes::None)) { if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) - ThrowMsg(NotFoundException, "Not found error"); + ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Not found error"); else ThrowMsg(PlatformException, "IO Error"); } @@ -1082,7 +1155,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context, const JSValueRef argv[], JSValueRef* exception) { - LogDebug("<<<"); + LoggerD("<<<"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); PrivateObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); @@ -1090,6 +1163,18 @@ JSValueRef JSFile::deleteFile(JSContextRef context, if (!privateObject) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type mismatch error"); } + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(1, true); + validator.toFunction(2, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } JSContextRef globalContext = privateObject->getContext(); @@ -1139,11 +1224,12 @@ JSValueRef JSFile::deleteFile(JSContextRef context, if (!eventResolve->getResult() ||(eventResolve->getExceptionCode() != WrtDeviceApis::Commons::ExceptionCodes::None)) { if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException){ - LogDebug("POST IO NOT_FOUND_ERROR"); - ThrowMsg(NotFoundException, "Not found error"); + LoggerD("POST IO NOT_FOUND_ERROR"); + ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Not found error"); + } - LogDebug("POST IO ERROR"); + LoggerD("POST IO ERROR"); cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, "IO error")); return JSValueMakeUndefined(context); } @@ -1152,7 +1238,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context, ThrowMsg(InvalidArgumentException, "Invalid directory"); } - LogDebug("try to call async event"); + LoggerD("try to call async event"); EventRemovePtr eventRemove(new EventRemove(path)); eventRemove->setForAsynchronousCall(&ResponseDispatcher::getInstance()); eventRemove->setPrivateData(DPL::StaticPointerCast (cbm)); @@ -1162,7 +1248,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context, } } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogDebug("Platform Exception !!!!!!!! post io error"); + LoggerD("Platform Exception !!!!!!!! post io error"); cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::IO_ERROR, ex.GetMessage())); } catch(const WrtDeviceApis::Commons::ConversionException& ex) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, ex.GetMessage()); @@ -1176,7 +1262,7 @@ JSValueRef JSFile::deleteFile(JSContextRef context, cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, ex.GetMessage())); } - LogDebug(">>>"); + LoggerD(">>>"); TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } diff --git a/src/Filesystem/JSFilestream.cpp b/src/Filesystem/JSFilestream.cpp old mode 100755 new mode 100644 index a80d699..49a76b9 --- a/src/Filesystem/JSFilestream.cpp +++ b/src/Filesystem/JSFilestream.cpp @@ -19,7 +19,6 @@ #include "JSFilestream.h" #include -#include #include #include @@ -32,6 +31,7 @@ #include "Encodings.h" #include "plugin_config.h" #include "FilesystemUtils.h" +#include namespace { const char* PLUGIN_NAME = "FileStream"; @@ -137,7 +137,7 @@ JSValueRef JSFilestream::getProperty(JSContextRef context, return converter.toJSValueRef(static_cast(bytes)); } } catch (const WrtDeviceApis::Commons::ConversionException& ex) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -161,7 +161,7 @@ bool JSFilestream::setProperty(JSContextRef context, return true; } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogWarning("trying to set incorrect value"); + LoggerW("trying to set incorrect value"); } return false; @@ -462,7 +462,7 @@ JSValueRef JSFilestream::writeBase64(JSContextRef context, Converter converter(context); try { - LogDebug("OK"); + LoggerD("OK"); JSValueRef undefinedValue = JSValueMakeUndefined(context); std::string base64; diff --git a/src/Filesystem/JSFilesystemManager.cpp b/src/Filesystem/JSFilesystemManager.cpp old mode 100755 new mode 100644 index 0b4dca5..83f4906 --- a/src/Filesystem/JSFilesystemManager.cpp +++ b/src/Filesystem/JSFilesystemManager.cpp @@ -17,9 +17,6 @@ #include "JSFilesystemManager.h" - -#include - #include #include "EventResolve.h" #include "IManager.h" @@ -38,7 +35,10 @@ #include #include #include - +#include +#include +#include +#include #include "JSFile.h" #include "FilesystemUtils.h" #include "Converter.h" @@ -48,6 +48,7 @@ #include "ResponseDispatcher.h" #include "FilesystemAsyncCallbackManager.h" #include "FilesystemListenerManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -55,6 +56,7 @@ using namespace DeviceAPI::Common; using namespace WrtDeviceApis; + namespace { const char* PLUGIN_NAME = "FileSystemManager"; const char* PROPERTY_MAXPATHLENGTH = "maxPathLength"; @@ -63,7 +65,7 @@ JSValueRef getFunctionOrNull(JSContextRef ctx, JSValueRef arg) { if (Validator(ctx).isCallback(arg)) { return arg; - } else if (!JSValueIsNull(ctx, arg) && !JSValueIsUndefined(ctx, arg)) { + } else if (!JSValueIsNull(ctx, arg) && !JSValueIsUndefined(ctx, arg)) { ThrowMsg(ConversionException, "Not a function nor JS null."); } return NULL; @@ -146,7 +148,7 @@ void JSFilesystemManager::initialize(JSContextRef context, int widgetId = WrtAccessSingleton::Instance().getWidgetId(); WidgetDB::Api::IWidgetDBPtr widgetDB = WidgetDB::Api::getWidgetDB(widgetId); - LogDebug(widgetDB->getWidgetInstallationPath()); + LoggerD(widgetDB->getWidgetInstallationPath()); std::string wgtpackage = "wgt-package"; std::string wgtprivate = "wgt-private"; std::string wgtprivatetemp = "wgt-private-tmp"; @@ -196,14 +198,31 @@ JSValueRef JSFilesystemManager::getStorage(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_GET_STORAGE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toString(0, false); + validator.toFunction(1, false); + validator.toFunction(2, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + if (argc < 2) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } + + + JSContextRef globalContext = privateObject->getContext(); ConverterPtr converter = ConverterFactory::getConverter(globalContext); JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext); - + try { JSValueRef onSuccess = getFunction(globalContext, argv[1]); @@ -253,10 +272,23 @@ JSValueRef JSFilesystemManager::getStorageList(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_LIST_STORAGE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(0, false); + validator.toFunction(1, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } if (argc < 1) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } + JSContextRef globalContext = privateObject->getContext(); ConverterPtr converter = ConverterFactory::getConverter(globalContext); @@ -312,12 +344,27 @@ JSValueRef JSFilesystemManager::addStorageStateListener(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_ADD_STORAGE_LISTENER); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toFunction(0, false); + validator.toFunction(1, true); + } + catch (const BasePlatformException &err) { + LogDebug("Exception"); + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + + if (argc < 1) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "TYPE_MISMATCH_ERROR"); } - JSContextRef globalContext = privateObject->getContext(); JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext); ConverterPtr converter = ConverterFactory::getConverter(globalContext); @@ -371,18 +418,33 @@ JSValueRef JSFilesystemManager::removeStorageStateListener(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_REMOVE_STORAGE_LISTENER); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + LogDebug("a"); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toLong(0, false); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } + if (argc < 1) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } + JSContextRef globalContext = privateObject->getContext(); ConverterPtr converter = ConverterFactory::getConverter(globalContext); try { long id = static_cast(converter->toLong(argv[0])); - LogDebug("id:" << id); + LoggerD("id:" << id); if (id >= 0) { @@ -416,7 +478,7 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context, JSValueRef* exception) { - LogDebug("<<<"); + LoggerD("<<<"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); PrivateObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); @@ -427,28 +489,46 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context, AceSecurityStatus status = FILESYSTEM_CHECK_ACCESS(FILESYSTEM_FUNCTION_API_MGR_RESOLVE_ID); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + + // argument validation with new validator + try { + ArgumentValidator validator(context, argc, argv); + validator.toString(0, false); + validator.toFunction(1, false); + validator.toFunction(2, true); + validator.toString(3, true); + } + catch (const BasePlatformException &err) { + return JSWebAPIException::throwException(context, exception, err); + } catch (...) { + DeviceAPI::Common::UnknownException err(""); + return JSWebAPIException::throwException(context, exception, err); + } if (argc < 2) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } + LogDebug("resolve"); + + + + JSContextRef globalContext = privateObject->getContext(); ConverterPtr converter = ConverterFactory::getConverter(globalContext); size_t index = 0; - JSValueRef reserveArguments[4]; JSCallbackManagerPtr cbm = JSCallbackManager::createObject(globalContext); - - - + JSValueRef reserveArguments[4]; try { for (index = 0; index < 4; index++) { if (index < argc) reserveArguments[index] = argv[index]; else - reserveArguments[index] = JSValueMakeUndefined(context); + reserveArguments[index] = JSValueMakeUndefined(context); } + JSValueRef onSuccess = getFunction(globalContext, reserveArguments[1]); JSValueRef onError = NULL; @@ -462,14 +542,14 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context, std::string virtualPath; path = Utils::fromVirtualPath(globalContext, converter->toString(reserveArguments[0])); virtualPath = converter->toString(reserveArguments[0]); - LogDebug("virtualPath:[" << virtualPath << "]"); + LoggerD("virtualPath:[" << virtualPath << "]"); int permissions = PERM_READ | PERM_WRITE; if (argc > 3) { std::string perms = converter->toString(reserveArguments[3]); - LogDebug("perms:[" << perms << "]"); + LoggerD("perms:[" << perms << "]"); if (("r" != perms) && ("rw" != perms) && ("w" != perms) && ("a" != perms)) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Invalid permission"); } else if ("r" == perms) { diff --git a/src/Filesystem/JSStorage.cpp b/src/Filesystem/JSStorage.cpp old mode 100755 new mode 100644 index 1cee07b..6cc105c --- a/src/Filesystem/JSStorage.cpp +++ b/src/Filesystem/JSStorage.cpp @@ -18,13 +18,13 @@ #include #include -#include #include //#include #include #include "StorageProperties.h" #include "JSStorage.h" #include "Converter.h" +#include namespace DeviceAPI { namespace Filesystem { @@ -152,7 +152,7 @@ JSValueRef JSStorage::getProperty(JSContextRef context, return convert.toJSValueRef(STATE_UNMOUNTABLE); }*/ } Catch(Commons::Exception) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); } diff --git a/src/Filesystem/Manager.cpp b/src/Filesystem/Manager.cpp old mode 100755 new mode 100644 index d2176fa..7dff757 --- a/src/Filesystem/Manager.cpp +++ b/src/Filesystem/Manager.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -35,6 +34,7 @@ #include "Node.h" #include "Utils.h" #include +#include namespace { const char* PATH_DOWNLOADS = "/opt/usr/media/Downloads"; @@ -87,7 +87,7 @@ bool Manager::getSupportedDeviceCB(int storage, storage_type_e type, storage_sta snprintf(buf, size, "removable%d", storage); lable.append(buf); } - LogDebug(lable << "state" << state); + LoggerD(lable << "state" << state); storageItem->setId(storage); storageItem->setLabel(lable); @@ -293,7 +293,7 @@ void Manager::find(const IPathPtr& path, void Manager::copyElement( const std::string &src, const std::string &dest, bool recursive) const { - LogDebug("Copying src: " << src << " to: " << dest); + LoggerD("Copying src: " << src << " to: " << dest); //element is a file: if (EINA_TRUE != ecore_file_is_dir(src.c_str())) { @@ -304,7 +304,7 @@ void Manager::copyElement( } //element is a directory -> create it: if (EINA_TRUE != ecore_file_mkdir(dest.c_str())) { - LogDebug("Failed to create destination directory"); + LoggerD("Failed to create destination directory"); ThrowMsg(Commons::PlatformException, "Failed to copy directory"); } //copy all elements of directory: @@ -326,7 +326,7 @@ void Manager::copyElement( { free(data); } - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); ReThrowMsg(Commons::PlatformException, "Failed to copy element"); } free(data); @@ -382,7 +382,7 @@ void Manager::removeStorageStateChangeListener(EventStorageStateChangedEmitter:: } if (found == false) { -// LogDebug("no exist" << id); +// LoggerD("no exist" << id); ThrowMsg(Commons::NotFoundException, "The " << id << "is not exist"); } } @@ -423,7 +423,7 @@ void Manager::OnRequestReceived(const EventResolvePtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } } @@ -498,7 +498,7 @@ void Manager::OnRequestReceived(const EventCopyPtr& event) { Try { INodePtr srcNode = Node::resolve(event->getSource()); - LogDebug(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_READ); + LoggerD(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_READ); if ((srcNode->getMode() & PM_USER_READ/*PERM_READ*/) == 0) { ThrowMsg(Commons::SecurityException, "Not enough permissions to read source node."); @@ -579,19 +579,19 @@ void Manager::OnRequestReceived(const EventCopyPtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } } //Destination is not exist. Start copy now. - LogDebug(dest->getFullPath().c_str()); + LoggerD(dest->getFullPath().c_str()); copyElement(realSrc, realDest); event->setResult(Node::resolve(dest)); } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } //file is copied already so we don't allow cancelling anymore. @@ -605,7 +605,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) IPathPtr dest = event->getDestination(); INodePtr srcNode = Node::resolve(src); - LogDebug(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_WRITE); + LoggerD(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_WRITE); if ((srcNode->getMode() & PM_USER_WRITE/*PERM_WRITE*/) == 0) { ThrowMsg(Commons::SecurityException, @@ -633,7 +633,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) } Catch(Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); ReThrowMsg(Commons::PlatformException, "Could not get destination's parent node."); } @@ -652,7 +652,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) "No access to platform destination node."); } - LogDebug(dest->getFullPath().c_str()); + LoggerD(dest->getFullPath().c_str()); if (S_ISDIR(info.st_mode) && srcNode->getType() == NT_FILE) { dest->append("/" + src->getName()); @@ -676,7 +676,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) errno = 0; - LogDebug(dest->getFullPath().c_str()); + LoggerD(dest->getFullPath().c_str()); if (0 != ::rename(src->getFullPath().c_str(), dest->getFullPath().c_str())) { @@ -685,7 +685,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) { case EXDEV: { - LogDebug(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_READ); + LoggerD(std::hex << srcNode->getMode() << " " << std::hex << PM_USER_READ); if ((srcNode->getMode() & PM_USER_READ /*PERM_READ*/) == 0) { ThrowMsg(Commons::SecurityException, @@ -699,9 +699,9 @@ void Manager::OnRequestReceived(const EventMovePtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); - LogError("Exception while removing dest directory"); + LoggerE("Exception while removing dest directory"); } } @@ -713,7 +713,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) node->remove(event->getOptions()); } Catch(Commons::Exception) { - LogError("Exception: " + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } break; @@ -730,7 +730,7 @@ void Manager::OnRequestReceived(const EventMovePtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } @@ -743,7 +743,7 @@ void Manager::OnRequestReceived(const EventCreatePtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } } @@ -757,7 +757,7 @@ void Manager::OnRequestReceived(const EventRemovePtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } event->setCancelAllowed(false); @@ -774,7 +774,7 @@ void Manager::OnRequestReceived(const EventFindPtr& event) event->setResult(result); } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(Commons::ExceptionCodes::PlatformException); } event->setCancelAllowed(true); @@ -851,7 +851,7 @@ void Manager::setupLocation(std::string location, const char* path) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); return; } } diff --git a/src/Filesystem/Node.cpp b/src/Filesystem/Node.cpp old mode 100755 new mode 100644 index 06f6581..9e72030 --- a/src/Filesystem/Node.cpp +++ b/src/Filesystem/Node.cpp @@ -34,6 +34,7 @@ #include "Enums.h" #include "Manager.h" #include "NodeFilterMatcher.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -50,7 +51,7 @@ INodePtr Node::resolve(const IPathPtr& path) struct stat syminfo; if (lstat(path->getFullPath().c_str(), &info) != 0) { - LogError("File: " << path->getFullPath().c_str() << " error no" <getFullPath().c_str() << " error no" <::PostRequest(event); } @@ -261,7 +262,7 @@ IStreamPtr Node::open(int mode) void Node::open(const EventOpenPtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); EventRequestReceiver::PostRequest(event); } @@ -333,7 +334,7 @@ int Node::getMode() const void Node::read(const EventReadTextPtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); EventRequestReceiver::PostRequest(event); } @@ -367,7 +368,7 @@ struct stat Node::stat(const IPathPtr& path) if (::stat(path->getFullPath().c_str(), &result) != 0) { - LogError("File: " << path->getFullPath().c_str()); + LoggerE("File: " << path->getFullPath().c_str()); ThrowMsg(Commons::PlatformException, "Node does not exist or no access"); } return result; @@ -384,14 +385,14 @@ Node::Node(const IPathPtr& path, Node* Node::createAsFile(const IPathPtr& path, int /* options */) { - LogDebug("ENTER"); + LoggerD("ENTER"); createAsFileInternal(path); return new Node(path, NT_FILE); } void Node::createAsFileInternal(const IPathPtr& path) { - LogDebug("ENTER"); + LoggerD("ENTER"); FILE* file = std::fopen(path->getFullPath().c_str(), "wb"); if (!file) { ThrowMsg(Commons::PlatformException, @@ -445,7 +446,7 @@ void Node::removeAsDirectory(const IPathPtr& path, if (recursive) { DIR* dir = opendir(path->getFullPath().c_str()); if (!dir) { - LogError("File: " << path->getFullPath().c_str()); + LoggerE("File: " << path->getFullPath().c_str()); ThrowMsg(Commons::PlatformException, "Node does not exist or access denied."); } @@ -493,7 +494,7 @@ void Node::OnRequestReceived(const EventListNodesPtr& event) } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } @@ -510,7 +511,7 @@ void Node::OnRequestReceived(const EventOpenPtr& event) catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } //event can be cancelled before executing this code. @@ -525,11 +526,11 @@ void Node::OnRequestReceived(const EventReadTextPtr& event) { Try { event->setResult(readText()); - LogDebug("LEAVIN GRACEFULLY"); + LoggerD("LEAVIN GRACEFULLY"); } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setExceptionCode(ex.getCode()); } //this function doesn't change state of the platform, diff --git a/src/Filesystem/Path.cpp b/src/Filesystem/Path.cpp old mode 100755 new mode 100644 index 0104255..1232a91 --- a/src/Filesystem/Path.cpp +++ b/src/Filesystem/Path.cpp @@ -15,17 +15,16 @@ // limitations under the License. // - -#include + #include #include #include #include #include -#include #include #include #include #include "Path.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -95,7 +94,7 @@ Path::Path() void Path::reset(const std::string& str) { if (!isValid(str)) { - LogDebug(str << "empty string"); + LoggerD(str << "empty string"); ThrowMsg(Commons::NotFoundException, "Not a valid path: " + str + "."); } diff --git a/src/Filesystem/PathUtils.cpp b/src/Filesystem/PathUtils.cpp index 808d2c6..b31d12b 100755 --- a/src/Filesystem/PathUtils.cpp +++ b/src/Filesystem/PathUtils.cpp @@ -15,9 +15,9 @@ // limitations under the License. // - #include "PathUtils.h" -#include +#include + namespace DeviceAPI { namespace Filesystem { namespace PathUtils { diff --git a/src/Filesystem/ResponseDispatcher.cpp b/src/Filesystem/ResponseDispatcher.cpp old mode 100755 new mode 100644 index e2548a6..e8f9f23 --- a/src/Filesystem/ResponseDispatcher.cpp +++ b/src/Filesystem/ResponseDispatcher.cpp @@ -17,7 +17,6 @@ #include "ResponseDispatcher.h" -#include #include #include @@ -32,6 +31,7 @@ #include "FilesystemAsyncCallbackManager.h" #include "Encodings.h" #include "FilesystemUtils.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -61,7 +61,7 @@ ResponseDispatcher::ResponseDispatcher() : void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); EventGetNodeDataPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); @@ -88,7 +88,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event) void ResponseDispatcher::OnAnswerReceived(const EventListNodesPtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); JSFile::ListFilesPrivateDataPtr privData = DPL::DynamicPointerCast(event->getPrivateData()); @@ -119,7 +119,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListNodesPtr& event) void ResponseDispatcher::OnAnswerReceived(const EventOpenPtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::SharedPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); @@ -144,7 +144,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventOpenPtr& event) void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::SharedPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); @@ -175,7 +175,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event) void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::SharedPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); @@ -207,7 +207,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event) void ResponseDispatcher::OnAnswerReceived(const EventRemovePtr& event) { - LogDebug("--| ENTER"); + LoggerD("--| ENTER"); DPL::SharedPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); @@ -233,7 +233,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemovePtr& event) void ResponseDispatcher::OnAnswerReceived(const EventReadTextPtr& event) { - LogDebug("--| ENTER"); + LoggerD("--| ENTER"); DPL::SharedPtr data = DPL::DynamicPointerCast(event->getPrivateData()); Assert(NULL != data); diff --git a/src/Filesystem/StorageStaticController.cpp b/src/Filesystem/StorageStaticController.cpp old mode 100755 new mode 100644 index 538cd00..b20ab82 --- a/src/Filesystem/StorageStaticController.cpp +++ b/src/Filesystem/StorageStaticController.cpp @@ -15,9 +15,7 @@ // limitations under the License. // - #include -#include #include #include #include @@ -28,6 +26,7 @@ #include "StorageStaticController.h" #include "JSStorage.h" #include "Converter.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -58,7 +57,7 @@ void StorageStaticController::onAnswerReceived( JSValueRef result = converter.toJSValueRef(event->getResult(), context); callbackManager->callOnSuccess(result); } catch(Commons::ConversionException) { - LogError("Conversion exception while processing EventStorageStateChanged"); + LoggerE("Conversion exception while processing EventStorageStateChanged"); } } diff --git a/src/Filesystem/Stream.cpp b/src/Filesystem/Stream.cpp old mode 100755 new mode 100644 index 64098b8..cb95fa5 --- a/src/Filesystem/Stream.cpp +++ b/src/Filesystem/Stream.cpp @@ -26,6 +26,7 @@ #include #include "Manager.h" #include "Node.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -255,7 +256,7 @@ IStreamPtr Stream::write_(T arg) checkForWriting(); if (!(m_stream << arg)) { - LogError("Error while writing to the stream."); + LoggerE("Error while writing to the stream."); ThrowMsg(Commons::PlatformException, "Error while writing to the stream."); } @@ -305,12 +306,12 @@ void Stream::checkForReading() const void Stream::checkForWriting() const { if (!isOpen()) { - LogError("Stream is closed."); + LoggerE("Stream is closed."); ThrowMsg(Commons::PlatformException, "Stream is closed."); } if (!isWriteable()) { - LogError("Stream is not writeable."); + LoggerE("Stream is not writeable."); ThrowMsg(Commons::PlatformException, "Stream is not writeable."); } } diff --git a/src/Filesystem/plugin_initializer.cpp b/src/Filesystem/plugin_initializer.cpp old mode 100755 new mode 100644 index 6febfa2..16b2b46 --- a/src/Filesystem/plugin_initializer.cpp +++ b/src/Filesystem/plugin_initializer.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -25,6 +23,7 @@ #include "JSFilestream.h" #include "FilesystemAsyncCallbackManager.h" #include "FilesystemListenerManager.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -38,7 +37,7 @@ void on_widget_start_callback(int widgetId) Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch (Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } @@ -49,20 +48,20 @@ void on_widget_stop_callback(int widgetId) Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch (Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\filesystem] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\filesystem] on_frame_unload_callback (" << context << ")"); DeviceAPI::Filesystem::FilesystemAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); DeviceAPI::Filesystem::FilesystemListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\filesystem] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\filesystem] on_frame_load_callback (" << context << ")"); } PLUGIN_ON_WIDGET_START(on_widget_start_callback) diff --git a/src/Log/CMakeLists.txt b/src/Log/CMakeLists.txt index 58653b3..9113ab1 100644 --- a/src/Log/CMakeLists.txt +++ b/src/Log/CMakeLists.txt @@ -12,6 +12,7 @@ set(SRCS ) include_directories( + ${INCLUDE_COMMON} ${INCLUDES_PLATFORM_IMPLEMENTATION_HAPTICS} ${INCLUDES_PLATFORM_IMPLEMENTATION_POWER} ) diff --git a/src/Log/plugin_initializer.cpp b/src/Log/plugin_initializer.cpp index 78bc807..3bdebcb 100644 --- a/src/Log/plugin_initializer.cpp +++ b/src/Log/plugin_initializer.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include #include #include "JSTizenLog.h" +#include #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen" @@ -25,12 +25,12 @@ namespace Log { void on_widget_start_callback(int widgetId) { - LogDebug("[TizenLog] on_widget_start_callback ("< namespace DeviceAPI { namespace MessagePort { diff --git a/src/MessagePort/ILocalMessagePort.h b/src/MessagePort/ILocalMessagePort.h index b93798b..cb60af2 100644 --- a/src/MessagePort/ILocalMessagePort.h +++ b/src/MessagePort/ILocalMessagePort.h @@ -25,7 +25,6 @@ #ifndef _API_MESSAGE_PORT_ILOCAL_MESSAGE_PORT_H_ #define _API_MESSAGE_PORT_ILOCAL_MESSAGE_PORT_H_ -#include #include #include #include "EventLocalMessagePortAddMessagePortListener.h" diff --git a/src/MessagePort/IRemoteMessagePort.cpp b/src/MessagePort/IRemoteMessagePort.cpp index 60f898d..43014f1 100644 --- a/src/MessagePort/IRemoteMessagePort.cpp +++ b/src/MessagePort/IRemoteMessagePort.cpp @@ -23,6 +23,7 @@ */ #include "IRemoteMessagePort.h" +#include namespace DeviceAPI { namespace MessagePort { diff --git a/src/MessagePort/IRemoteMessagePort.h b/src/MessagePort/IRemoteMessagePort.h index b1b393f..a5a5dca 100644 --- a/src/MessagePort/IRemoteMessagePort.h +++ b/src/MessagePort/IRemoteMessagePort.h @@ -25,7 +25,6 @@ #ifndef _API_MESSAGE_PORT_IREMOTE_MESSAGE_PORT_H_ #define _API_MESSAGE_PORT_IREMOTE_MESSAGE_PORT_H_ -#include #include #include #include "EventRemoteMessagePortSendMessage.h" diff --git a/src/MessagePort/JSLocalMessagePort.cpp b/src/MessagePort/JSLocalMessagePort.cpp index 6bb3c50..4d438af 100644 --- a/src/MessagePort/JSLocalMessagePort.cpp +++ b/src/MessagePort/JSLocalMessagePort.cpp @@ -23,8 +23,6 @@ */ #include "JSLocalMessagePort.h" - -#include #include #include #include @@ -36,6 +34,7 @@ #include "EventLocalMessagePortRemoveMessagePortListener.h" #include "MessagePortListenerManager.h" #include "MessagePortJSUtil.h" +#include #define TIZEN_LOCAL_MESSAGE_PORT "LocalMessagePort" @@ -94,7 +93,7 @@ const JSClassDefinition* JSLocalMessagePort::getClassInfo() const JSClassRef JSLocalMessagePort::getClassRef() { - LogInfo("entered"); + LoggerI("entered"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); } @@ -158,7 +157,7 @@ JSValueRef JSLocalMessagePort::getMessagePortName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -176,7 +175,7 @@ JSValueRef JSLocalMessagePort::getIsTrusted(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -189,7 +188,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); LocalMessagePortPtr localMessagePort; JSContextRef gContext; @@ -206,7 +205,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context, } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -243,7 +242,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context, } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Plugin's internal error")); } @@ -280,7 +279,7 @@ JSValueRef JSLocalMessagePort::addMessagePortListener(JSContextRef context, } catch(BasePlatformException &e) { - LogError("Error on conversion : " << e.getMessage()); + LoggerE("Error on conversion : " << e.getMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } @@ -296,7 +295,7 @@ JSValueRef JSLocalMessagePort::removeMessagePortListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); LocalMessagePortPtr localMessagePort; JSContextRef gContext; @@ -313,7 +312,7 @@ JSValueRef JSLocalMessagePort::removeMessagePortListener(JSContextRef context, } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -341,7 +340,7 @@ JSValueRef JSLocalMessagePort::removeMessagePortListener(JSContextRef context, } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } diff --git a/src/MessagePort/JSMessagePortManager.cpp b/src/MessagePort/JSMessagePortManager.cpp index e07ed42..229a6e7 100644 --- a/src/MessagePort/JSMessagePortManager.cpp +++ b/src/MessagePort/JSMessagePortManager.cpp @@ -23,8 +23,6 @@ */ #include "JSMessagePortManager.h" - -#include #include #include #include @@ -35,6 +33,7 @@ #include "JSLocalMessagePort.h" #include "JSRemoteMessagePort.h" #include "MessagePortJSUtil.h" +#include #define CLASS_NAME "MessagePortManager" @@ -126,7 +125,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MessagePortManagerPtr messagePortManager; JSContextRef gContext; @@ -143,7 +142,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context, } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -178,7 +177,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context, } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Plugin's internal error")); } @@ -213,7 +212,7 @@ JSValueRef JSMessagePortManager::requestLocalMessagePort(JSContextRef context, } catch(BasePlatformException &e) { - LogError("Error on conversion : " << e.getMessage()); + LoggerE("Error on conversion : " << e.getMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } @@ -229,7 +228,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MessagePortManagerPtr messagePortManager; JSContextRef gContext; @@ -246,7 +245,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -281,7 +280,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Plugin's internal error")); } @@ -316,7 +315,7 @@ JSValueRef JSMessagePortManager::requestTrustedLocalMessagePort(JSContextRef con } catch(BasePlatformException &e) { - LogError("Error on conversion : " << e.getMessage()); + LoggerE("Error on conversion : " << e.getMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } @@ -332,7 +331,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MessagePortManagerPtr messagePortManager; JSContextRef gContext; @@ -349,7 +348,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context, } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -394,7 +393,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context, } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Plugin's internal error")); } @@ -434,7 +433,7 @@ JSValueRef JSMessagePortManager::requestRemoteMessagePort(JSContextRef context, } catch(BasePlatformException &e) { - LogError("Error on conversion : " << e.getMessage()); + LoggerE("Error on conversion : " << e.getMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } @@ -450,7 +449,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); MessagePortManagerPtr messagePortManager; JSContextRef gContext; @@ -467,7 +466,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co } catch(BasePlatformException &e) { - LogError("No private object"); + LoggerE("No private object"); return JSWebAPIException::throwException(context, exception, e); } @@ -512,7 +511,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co } Catch(Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Plugin's internal error")); } @@ -552,7 +551,7 @@ JSValueRef JSMessagePortManager::requestTrustedRemoteMessagePort(JSContextRef co } catch(BasePlatformException &e) { - LogError("Error on conversion : " << e.getMessage()); + LoggerE("Error on conversion : " << e.getMessage()); return JSWebAPIException::throwException(context, exception, UnknownException("Internal error")); } diff --git a/src/MessagePort/JSRemoteMessagePort.cpp b/src/MessagePort/JSRemoteMessagePort.cpp index 7ecff99..a3f2b5f 100644 --- a/src/MessagePort/JSRemoteMessagePort.cpp +++ b/src/MessagePort/JSRemoteMessagePort.cpp @@ -23,8 +23,6 @@ */ #include "JSRemoteMessagePort.h" - -#include #include #include #include @@ -35,6 +33,7 @@ #include "EventRemoteMessagePortSendMessage.h" #include "JSLocalMessagePort.h" #include "MessagePortJSUtil.h" +#include #define TIZEN_REMOTE_MESSAGE_PORT "RemoteMessagePort" @@ -93,7 +92,7 @@ const JSClassDefinition* JSRemoteMessagePort::getClassInfo() const JSClassRef JSRemoteMessagePort::getClassRef() { - LogInfo("entered"); + LoggerI("entered"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); } @@ -157,7 +156,7 @@ JSValueRef JSRemoteMessagePort::getMessagePortName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -175,7 +174,7 @@ JSValueRef JSRemoteMessagePort::getAppId(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -193,7 +192,7 @@ JSValueRef JSRemoteMessagePort::getIsTrusted(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value"); + LoggerW("trying to get incorrect value"); } return JSValueMakeUndefined(context); @@ -206,7 +205,7 @@ JSValueRef JSRemoteMessagePort::sendMessage(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); RemoteMessagePortPtr remoteMessagePort(NULL); diff --git a/src/MessagePort/LocalMessagePort.cpp b/src/MessagePort/LocalMessagePort.cpp index 0b93b98..e6c8327 100644 --- a/src/MessagePort/LocalMessagePort.cpp +++ b/src/MessagePort/LocalMessagePort.cpp @@ -31,6 +31,7 @@ #include "MessagePortManagerProxy.h" #include "MessagePortUtility.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -72,7 +73,7 @@ void LocalMessagePort::setIsTrusted(const bool &value) void LocalMessagePort::OnRequestReceived(const EventLocalMessagePortAddMessagePortListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -92,19 +93,19 @@ void LocalMessagePort::OnRequestReceived(const EventLocalMessagePortAddMessagePo } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -112,7 +113,7 @@ void LocalMessagePort::OnRequestReceived(const EventLocalMessagePortAddMessagePo void LocalMessagePort::OnRequestReceived(const EventLocalMessagePortRemoveMessagePortListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -132,25 +133,25 @@ void LocalMessagePort::OnRequestReceived(const EventLocalMessagePortRemoveMessag } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(NotFoundException) { - LogError("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } diff --git a/src/MessagePort/LocalMessagePort.h b/src/MessagePort/LocalMessagePort.h index 9e7608f..10aa18f 100644 --- a/src/MessagePort/LocalMessagePort.h +++ b/src/MessagePort/LocalMessagePort.h @@ -27,7 +27,6 @@ #include #include -#include #include #include "ILocalMessagePort.h" diff --git a/src/MessagePort/LocalMessagePortController.cpp b/src/MessagePort/LocalMessagePortController.cpp index 40741b8..8918fa1 100644 --- a/src/MessagePort/LocalMessagePortController.cpp +++ b/src/MessagePort/LocalMessagePortController.cpp @@ -23,11 +23,10 @@ */ #include "LocalMessagePortController.h" - -#include #include #include "MessagePortDataItem.h" #include "MessagePortJSUtil.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -40,26 +39,26 @@ LocalMessagePortController::LocalMessagePortController(JSContextRef context, Loc EventLocalMessagePortListenerListener(ThreadEnum::NULL_THREAD), LocalMessagePortPrivObject(context, localMessagePort) { - LogDebug("LocalMessagePortController constructed : " << this); + LoggerD("LocalMessagePortController constructed : " << this); if (!localMessagePort) { - LogWarning("controller has no localMessagePort object"); + LoggerW("controller has no localMessagePort object"); } } LocalMessagePortController::~LocalMessagePortController() { - LogDebug("LocalMessagePortController destructed : " << this); + LoggerD("LocalMessagePortController destructed : " << this); } void LocalMessagePortAsyncAnswerHandler::localMessagePortListener(const EventLocalMessagePortListenerPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSValueRef result[2]; JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogError("no callback manager"); + LoggerE("no callback manager"); return; } @@ -67,7 +66,7 @@ void LocalMessagePortAsyncAnswerHandler::localMessagePortListener(const EventLoc if(!event->getDataIsSet()) { - LogError("No data items"); + LoggerE("No data items"); return; } @@ -77,7 +76,7 @@ void LocalMessagePortAsyncAnswerHandler::localMessagePortListener(const EventLoc } catch(BasePlatformException &e) { - LogError("Fail to convert MessagePortDataItemMap"); + LoggerE("Fail to convert MessagePortDataItemMap"); return; } @@ -90,7 +89,7 @@ void LocalMessagePortAsyncAnswerHandler::localMessagePortListener(const EventLoc } catch(BasePlatformException &e) { - LogError("Fail to convert RemoteMessagePort"); + LoggerE("Fail to convert RemoteMessagePort"); return; } @@ -101,7 +100,7 @@ void LocalMessagePortController::onAnswerReceived(const EventLocalMessagePortLis { if(event == NULL) { - LogError("wrong event"); + LoggerE("wrong event"); return; } diff --git a/src/MessagePort/LocalMessagePortController.h b/src/MessagePort/LocalMessagePortController.h index e6d3796..5d90f51 100644 --- a/src/MessagePort/LocalMessagePortController.h +++ b/src/MessagePort/LocalMessagePortController.h @@ -25,7 +25,6 @@ #ifndef _TIZEN_MESSAGE_PORT_LOCAL_MESSAGE_PORT_CONTROLLER_H_ #define _TIZEN_MESSAGE_PORT_LOCAL_MESSAGE_PORT_CONTROLLER_H_ -#include #include #include #include diff --git a/src/MessagePort/MessagePortJSUtil.cpp b/src/MessagePort/MessagePortJSUtil.cpp index 7f1aee8..6307e70 100644 --- a/src/MessagePort/MessagePortJSUtil.cpp +++ b/src/MessagePort/MessagePortJSUtil.cpp @@ -21,6 +21,7 @@ #include "JSLocalMessagePort.h" #include "JSRemoteMessagePort.h" +#include #define MESSAGE_PORT_ATTRIBUTE_KEY "key" #define MESSAGE_PORT_ATTRIBUTE_VALUE "value" @@ -102,7 +103,7 @@ MessagePortDataItemMapPtr MessagePortJSUtil::JSValueToMessagePortDataItemMap(JSC if(!JSValueIsObject(context, element)) { - LogWarning("element is not object (" << i << ")"); + LoggerW("element is not object (" << i << ")"); continue; } @@ -118,7 +119,7 @@ MessagePortDataItemMapPtr MessagePortJSUtil::JSValueToMessagePortDataItemMap(JSC } catch(BasePlatformException &e) { - LogWarning("key is not string"); + LoggerW("key is not string"); continue; } @@ -129,7 +130,7 @@ MessagePortDataItemMapPtr MessagePortJSUtil::JSValueToMessagePortDataItemMap(JSC } catch(BasePlatformException &e) { - LogWarning("value is not string"); + LoggerW("value is not string"); continue; } @@ -144,7 +145,7 @@ LocalMessagePortPtr MessagePortJSUtil::JSValueToLocalMessagePort(JSContextRef co { if(!JSLocalMessagePort::isObjectOfClass(context, jsValue)) { - LogError("Not a LocalMessagePort object"); + LoggerE("Not a LocalMessagePort object"); throw TypeMismatchException("value is not a LocalMessagePort object"); } @@ -155,7 +156,7 @@ RemoteMessagePortPtr MessagePortJSUtil::JSValueToRemoteMessagePort(JSContextRef { if(!JSRemoteMessagePort::isObjectOfClass(context, jsValue)) { - LogError("Not a RemoteMessagePort object"); + LoggerE("Not a RemoteMessagePort object"); throw TypeMismatchException("value is not a RemoteMessagePort object"); } diff --git a/src/MessagePort/MessagePortListenerManager.h b/src/MessagePort/MessagePortListenerManager.h index 41be36c..76a0520 100644 --- a/src/MessagePort/MessagePortListenerManager.h +++ b/src/MessagePort/MessagePortListenerManager.h @@ -27,11 +27,11 @@ #include #include -#include #include #include #include #include "LocalMessagePortController.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -69,7 +69,7 @@ public: controller = static_cast(JSObjectGetPrivate(m_object)); if (!controller) { - LogWarning("Object has no controller"); + LoggerW("Object has no controller"); return; } localMessagePort = controller->getObject(); @@ -81,12 +81,12 @@ public: Try { - LogDebug("Remove change listener"); + LoggerD("Remove change listener"); localMessagePort->removeMessagePortListener(dplEvent); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/MessagePort/MessagePortManager.cpp b/src/MessagePort/MessagePortManager.cpp index 16f55fe..250090f 100644 --- a/src/MessagePort/MessagePortManager.cpp +++ b/src/MessagePort/MessagePortManager.cpp @@ -24,8 +24,8 @@ */ #include "MessagePortManager.h" - #include "MessagePortManagerProxy.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -46,7 +46,7 @@ MessagePortManager::~MessagePortManager() void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestLocalMessagePortPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -63,19 +63,19 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestL } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -83,7 +83,7 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestL void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestTrustedLocalMessagePortPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -100,19 +100,19 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestT } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -120,7 +120,7 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestT void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestRemoteMessagePortPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -141,25 +141,25 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestR } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(NotFoundException) { - LogError("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } @@ -167,7 +167,7 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestR void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestTrustedRemoteMessagePortPtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { @@ -188,31 +188,31 @@ void MessagePortManager::OnRequestReceived(const EventMessagePortManagerRequestT } Catch(InvalidArgumentException) { - LogError("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [InvalidArgumentException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::InvalidArgumentException); event->setResult(false); } Catch(NotFoundException) { - LogError("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [NotFoundException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::NotFoundException); event->setResult(false); } Catch(PlatformWrongStateException) { - LogError("Error [PlatformWrongStateException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformWrongStateException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformWrongStateException); event->setResult(false); } Catch(PlatformException) { - LogError("Error [PlatformException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [PlatformException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::PlatformException); event->setResult(false); } Catch(Exception) { - LogError("Error [UnknownException] : " << _rethrown_exception.GetMessage()); + LoggerE("Error [UnknownException] : " << _rethrown_exception.GetMessage()); event->setExceptionCode(ExceptionCodes::UnknownException); event->setResult(false); } diff --git a/src/MessagePort/MessagePortManagerProxy.cpp b/src/MessagePort/MessagePortManagerProxy.cpp old mode 100755 new mode 100644 index c917391..47909fe --- a/src/MessagePort/MessagePortManagerProxy.cpp +++ b/src/MessagePort/MessagePortManagerProxy.cpp @@ -32,6 +32,7 @@ #include "LocalMessagePort.h" #include "RemoteMessagePort.h" #include "MessagePortUtility.h" +#include IMPLEMENT_SINGLETON(DeviceAPI::MessagePort::MessagePortManagerProxy) @@ -52,28 +53,28 @@ MessagePortManagerProxy::~MessagePortManagerProxy() LocalMessagePortPtr MessagePortManagerProxy::requestLocalMessagePort(string &messagePortName) { - LogDebug("request local (name : " << messagePortName << ")"); + LoggerD("request local (name : " << messagePortName << ")"); return getLocalMessagePort(messagePortName, false); } LocalMessagePortPtr MessagePortManagerProxy::requestTrustedLocalMessagePort(string &messagePortName) { - LogDebug("request trusted local (name : " << messagePortName << ")"); + LoggerD("request trusted local (name : " << messagePortName << ")"); return getLocalMessagePort(messagePortName, true); } RemoteMessagePortPtr MessagePortManagerProxy::requestRemoteMessagePort(string &appId, string &messagePortName) { - LogDebug("request remote (appId : " << appId << " / name : " << messagePortName << ")"); + LoggerD("request remote (appId : " << appId << " / name : " << messagePortName << ")"); return getRemoteMessagePort(appId, messagePortName, false); } RemoteMessagePortPtr MessagePortManagerProxy::requestTrustedRemoteMessagePort(string &appId, string &messagePortName) { - LogDebug("request trusted remote (appId : " << appId << " / name : " << messagePortName << ")"); + LoggerD("request trusted remote (appId : " << appId << " / name : " << messagePortName << ")"); return getRemoteMessagePort(appId, messagePortName, true); } @@ -131,7 +132,7 @@ void MessagePortManagerProxy::sendMessage(string appId, string name, bool isTrus LocalMessagePortPtr MessagePortManagerProxy::getLocalMessagePort(string &name, bool isTrusted) { - LogDebug("getLocalMessagePort (name:" << name << ", isTrusted:" << isTrusted << ")"); + LoggerD("getLocalMessagePort (name:" << name << ", isTrusted:" << isTrusted << ")"); LocalMessagePortPtr localMessagePort = getCachedLocalMessagePort(name, isTrusted); if(localMessagePort == NULL) @@ -172,7 +173,7 @@ LocalMessagePortPtr MessagePortManagerProxy::getLocalMessagePort(string &name, b RemoteMessagePortPtr MessagePortManagerProxy::getRemoteMessagePort(string &appId, string &name, bool isTrusted) { - LogDebug("getRemoteMessagePort (appId:" << appId << ", name:" << name << ", isTrusted:" << isTrusted << ")"); + LoggerD("getRemoteMessagePort (appId:" << appId << ", name:" << name << ", isTrusted:" << isTrusted << ")"); RemoteMessagePortPtr remoteMessagePort = getCachedRemoteMessagePort(appId, name, isTrusted); @@ -237,7 +238,7 @@ LocalMessagePortPtr MessagePortManagerProxy::getCachedLocalMessagePort(string &n if(iter != m_localMessagePortMap.end()) { localMessagePort = iter->second; - LogDebug("Found cached LocalMessagePort"); + LoggerD("Found cached LocalMessagePort"); } return localMessagePort; @@ -251,7 +252,7 @@ LocalMessagePortPtr MessagePortManagerProxy::getCachedLocalMessagePort(int id) if(iter != m_localMessagePortIdMap.end()) { localMessagePort = iter->second; - LogDebug("Found cached LocalMessagePort"); + LoggerD("Found cached LocalMessagePort"); } return localMessagePort; @@ -274,7 +275,7 @@ RemoteMessagePortPtr MessagePortManagerProxy::getCachedRemoteMessagePort(string if(iter != m_remoteMessagePortMap.end()) { remoteMessagePort = iter->second; - LogDebug("Found cached RemoteMessagePort"); + LoggerD("Found cached RemoteMessagePort"); } return remoteMessagePort; @@ -283,13 +284,13 @@ RemoteMessagePortPtr MessagePortManagerProxy::getCachedRemoteMessagePort(string void MessagePortManagerProxy::messagePortMessageCb(int id, const char* remote_app_id, const char* remote_port, bool trusted_message, bundle* data) { - LogDebug("received message : (id:" << id << ", remote_appId : " << remote_app_id << + LoggerD("received message : (id:" << id << ", remote_appId : " << remote_app_id << ", remote_port:" << remote_port << ", trusted:" << trusted_message << ")"); LocalMessagePortPtr localMessagePort = getCachedLocalMessagePort(id); if(localMessagePort == NULL) { - LogWarning("There is no local message port id : " << id); + LoggerW("There is no local message port id : " << id); return; } @@ -305,7 +306,7 @@ void MessagePortManagerProxy::messagePortMessageCb(int id, const char* remote_ap } Catch(Exception) { - LogError("Error on getRemoteMessagePort : " << _rethrown_exception.GetMessage()); + LoggerE("Error on getRemoteMessagePort : " << _rethrown_exception.GetMessage()); } } diff --git a/src/MessagePort/MessagePortManagerProxy.h b/src/MessagePort/MessagePortManagerProxy.h old mode 100755 new mode 100644 diff --git a/src/MessagePort/MessagePortUtility.cpp b/src/MessagePort/MessagePortUtility.cpp index 37bce17..2e6fc20 100644 --- a/src/MessagePort/MessagePortUtility.cpp +++ b/src/MessagePort/MessagePortUtility.cpp @@ -28,8 +28,8 @@ #include #include #include -#include #include +#include IMPLEMENT_SINGLETON(DeviceAPI::MessagePort::MessagePortUtility) @@ -109,7 +109,7 @@ void MessagePortUtility::getDataItemMapHelper(const char *key, const int type, c { if(type != BUNDLE_TYPE_STR) { - LogWarning("bundle has wrong data type. (type : " << type << ")"); + LoggerW("bundle has wrong data type. (type : " << type << ")"); return; } diff --git a/src/MessagePort/RemoteMessagePort.cpp b/src/MessagePort/RemoteMessagePort.cpp index 7def345..a252591 100644 --- a/src/MessagePort/RemoteMessagePort.cpp +++ b/src/MessagePort/RemoteMessagePort.cpp @@ -25,6 +25,7 @@ #include "RemoteMessagePort.h" #include "LocalMessagePort.h" #include "MessagePortManagerProxy.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -73,7 +74,7 @@ void RemoteMessagePort::setIsTrusted(const bool &value) void RemoteMessagePort::OnRequestReceived(const EventRemoteMessagePortSendMessagePtr &event) { - LogDebug("entered"); + LoggerD("entered"); Try { diff --git a/src/MessagePort/RemoteMessagePort.h b/src/MessagePort/RemoteMessagePort.h index f15efd2..5d4fd6d 100644 --- a/src/MessagePort/RemoteMessagePort.h +++ b/src/MessagePort/RemoteMessagePort.h @@ -25,7 +25,6 @@ #ifndef _PLATFORM_MESSAGE_PORT_REMOTE_MESSAGE_PORT_H_ #define _PLATFORM_MESSAGE_PORT_REMOTE_MESSAGE_PORT_H_ -#include #include #include "IRemoteMessagePort.h" diff --git a/src/MessagePort/plugin_initializer.cpp b/src/MessagePort/plugin_initializer.cpp index badf170..6eb0bea 100644 --- a/src/MessagePort/plugin_initializer.cpp +++ b/src/MessagePort/plugin_initializer.cpp @@ -22,12 +22,11 @@ * @brief */ -#include - #include #include #include #include "JSMessagePortManager.h" +#include namespace DeviceAPI { namespace MessagePort { @@ -37,7 +36,7 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\MessagePort] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\MessagePort] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { @@ -45,13 +44,13 @@ void on_widget_start_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\MessagePort] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\MessagePort] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"MessagePort"); TIME_TRACER_RELEASE(); Try @@ -60,18 +59,18 @@ void on_widget_stop_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\MessagePort] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\MessagePort] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\MessagePort] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\MessagePort] on_frame_unload_callback (" << context << ")"); } PLUGIN_ON_WIDGET_START(on_widget_start_callback) diff --git a/src/Messaging/Attachment.cpp b/src/Messaging/Attachment.cpp index 62ce4db..e66fcee 100644 --- a/src/Messaging/Attachment.cpp +++ b/src/Messaging/Attachment.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include "Attachment.h" @@ -30,6 +29,8 @@ extern "C" { #include } +#include + using namespace WrtDeviceApis::Commons; using namespace std; @@ -39,27 +40,27 @@ namespace Messaging { Attachment::Attachment() { - LogDebug("entered"); + LoggerD("entered"); } Attachment::Attachment(const string& fullPath, bool isVirtualPath) { - LogDebug("entered"); + LoggerD("entered"); init(fullPath, isVirtualPath); } /* Attachment::Attachment(email_attachment_info_t* att) { - LogDebug("entered"); + LoggerD("entered"); m_attachShortName = std::string(att->name); //set shot Name m_isDownloaded = att->downloaded; m_attachmentID = att->attachment_id; - LogDebug(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID); - LogDebug("save name is = " << att->savename); + LoggerD(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID); + LoggerD("save name is = " << att->savename); if ( att->savename ) { init( att->savename, false); @@ -68,15 +69,15 @@ Attachment::Attachment(email_attachment_info_t* att) */ Attachment::Attachment(email_attachment_data_t* att) { - LogDebug("entered"); + LoggerD("entered"); m_attachShortName = std::string(att->attachment_name); m_isDownloaded = att->save_status; m_attachmentID = att->attachment_id; m_isInlineAttachment = att->inline_content_status; //m_mimeType = std::string(att->attachment_mime_type); - LogDebug(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID << "Mime= " << m_mimeType); - LogDebug("save name is = " << att->attachment_path << "isInlineAttachment = " << m_isInlineAttachment); + LoggerD(" showname = " << m_attachShortName << " isDownloaded = " << m_isDownloaded << " attachmentID = " << m_attachmentID << "Mime= " << m_mimeType); + LoggerD("save name is = " << att->attachment_path << "isInlineAttachment = " << m_isInlineAttachment); if ( att->attachment_path) { @@ -89,7 +90,7 @@ Attachment::Attachment(const std::string& fullPath, bool isVirtualPath, const DeviceAPI::Filesystem::INode& inode): DeviceAPI::Filesystem::INode(inode) { - LogDebug("entered , inode"); + LoggerD("entered , inode"); init(fullPath, isVirtualPath); } */ @@ -98,7 +99,7 @@ Attachment::Attachment(const std::string& fullPath, bool isVirtualPath, Attachment::Attachment(const std::string& fullPath, bool isVirtualPath, const DeviceAPI::Filesystem::INode& inode): IAttachment(inode) { - LogDebug("entered , inode"); + LoggerD("entered , inode"); init(fullPath, isVirtualPath); } #endif @@ -115,12 +116,12 @@ std::string Attachment::getRealPath(const std::string &path) const } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid path"); + LoggerE("invalid path"); ReThrow(WrtDeviceApis::Commons::InvalidArgumentException); } #endif - LogDebug(" path = " << path); + LoggerD(" path = " << path); return path; diff --git a/src/Messaging/AttachmentFactory.cpp b/src/Messaging/AttachmentFactory.cpp old mode 100755 new mode 100644 index ca73e0d..a258062 --- a/src/Messaging/AttachmentFactory.cpp +++ b/src/Messaging/AttachmentFactory.cpp @@ -15,13 +15,13 @@ // limitations under the License. // -#include #include #include "AttachmentFactory.h" #include "Attachments.h" #include "Attachment.h" #include #include +#include using namespace std; using namespace WrtDeviceApis; @@ -59,7 +59,7 @@ const char AttachmentFactory::m_pathSeparator = '/'; IAttachmentPtr AttachmentFactory::createAttachment(const std::string& fullPath, bool isVirtualPath) { - LogDebug("enter"); + LoggerD("enter"); IAttachmentPtr attachment(new Attachment(fullPath, isVirtualPath)); if (!attachment->getIsCreatedProperly()) { ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, @@ -71,7 +71,7 @@ IAttachmentPtr AttachmentFactory::createAttachment(const std::string& fullPath, IAttachmentPtr AttachmentFactory::createAttachment(const std::string& path, const std::string& mimeType) { - LogDebug("enter"); + LoggerD("enter"); //check virtualPath bool isVirtualPath = true; @@ -90,7 +90,7 @@ IAttachmentPtr AttachmentFactory::createAttachment(const std::string& path, std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, const std::string& real_path) { - LogDebug("path = " << real_path); + LoggerD("path = " << real_path); //find virtual root std::string root; @@ -103,7 +103,7 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(PATH_DOWNLOADS); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_DOWNLOADS; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; @@ -116,7 +116,7 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(PATH_DOCUMENTS); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_DOCUMENTS; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; @@ -129,7 +129,7 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(PATH_SOUNDS); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_SOUNDS; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; @@ -142,10 +142,10 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(PATH_IMAGES); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_IMAGES; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; - LogDebug("virtualpath = " << virtualpath); + LoggerD("virtualpath = " << virtualpath); return virtualpath; } @@ -155,10 +155,10 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(PATH_VIDEOS); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_VIDEOS; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; - LogDebug("virtualpath = " << virtualpath); + LoggerD("virtualpath = " << virtualpath); return virtualpath; } @@ -172,10 +172,10 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(widgetDB->getWidgetInstallationPath()); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_WGT_PACKAGE; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; - LogDebug("virtualpath = " << virtualpath); + LoggerD("virtualpath = " << virtualpath); return virtualpath; } @@ -185,10 +185,10 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(widgetDB->getWidgetPersistentStoragePath()); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_WGT_PRIVATE; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; - LogDebug("virtualpath = " << virtualpath); + LoggerD("virtualpath = " << virtualpath); return virtualpath; } @@ -198,10 +198,10 @@ std::string AttachmentFactory::getVirtualPathFromRealPath(JSContextRef context, { std::string vroot(widgetDB->getWidgetTemporaryStoragePath()); tail = real_path.substr(virtualrootpathposition + vroot.size() + 1, real_path.size() - 1); - LogDebug("tail = " << tail); + LoggerD("tail = " << tail); vroot=VPATH_WGT_PRIVATE_TEMP; std::string virtualpath = vroot + AttachmentFactory::m_pathSeparator + tail ; - LogDebug("virtualpath = " << virtualpath); + LoggerD("virtualpath = " << virtualpath); return virtualpath; } @@ -215,7 +215,7 @@ std::string AttachmentFactory::getVirtualPathFromEmailServiceFolder(JSContextRef //another folder //copy - LogDebug("path = " << real_path); + LoggerD("path = " << real_path); int widgetId = WrtAccessSingleton::Instance().getWidgetId(); int error = 0; @@ -233,14 +233,14 @@ std::string AttachmentFactory::getVirtualPathFromEmailServiceFolder(JSContextRef size_t pos = real_path.find_last_of("/"); if ((pos + 1) >= real_path.size()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); Throw(InvalidArgumentException); } std::string attachShortName = real_path.substr(pos + 1); std::string privat_dir = widgetDB->getWidgetPersistentStoragePath(); if ( privat_dir.empty()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); Throw(InvalidArgumentException); } @@ -248,16 +248,16 @@ std::string AttachmentFactory::getVirtualPathFromEmailServiceFolder(JSContextRef mode_t mask = umask(S_IWGRP | S_IWOTH); error = mkstemp(buf); umask(mask); - LogDebug("mkstemp =" << error); + LoggerD("mkstemp =" << error); - LogDebug("temp file=" << buf << AttachmentFactory::m_pathSeparator << attachShortName); + LoggerD("temp file=" << buf << AttachmentFactory::m_pathSeparator << attachShortName); std::stringstream mkdir_cmd; mkdir_cmd << MKDIR_COMMAND_NAME; mkdir_cmd << " " << MKDIR_COMMAND_SWITCH_RECURSIVE; mkdir_cmd << " \"" << privat_dir << buf << AttachmentFactory::m_pathSeparator << "\""; - LogDebug("mkdir path=" << mkdir_cmd.str()); + LoggerD("mkdir path=" << mkdir_cmd.str()); int result = system(mkdir_cmd.str().c_str()); if (-1 != result) { @@ -267,7 +267,7 @@ std::string AttachmentFactory::getVirtualPathFromEmailServiceFolder(JSContextRef cp_cmd << " \"" << real_path << "\""; cp_cmd << " \"" << privat_dir << buf << AttachmentFactory::m_pathSeparator << attachShortName << "\""; - LogDebug("cp path=" << cp_cmd.str()); + LoggerD("cp path=" << cp_cmd.str()); result = system(cp_cmd.str().c_str()); if (-1 != result) { @@ -298,7 +298,7 @@ std::string AttachmentFactory::getDummyFileFromRealPath(JSContextRef context, const std::string& real_path) { //This file is not in list of root locations - LogDebug("path = " << real_path); + LoggerD("path = " << real_path); int widgetId = WrtAccessSingleton::Instance().getWidgetId(); int error = 0; @@ -308,14 +308,14 @@ std::string AttachmentFactory::getDummyFileFromRealPath(JSContextRef context, size_t pos = real_path.find_last_of("/"); if ((pos + 1) >= real_path.size()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); Throw(InvalidArgumentException); } std::string attachShortName = real_path.substr(pos + 1); std::string privat_dir = widgetDB->getWidgetPersistentStoragePath(); if ( privat_dir.empty()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); Throw(InvalidArgumentException); } @@ -323,16 +323,16 @@ std::string AttachmentFactory::getDummyFileFromRealPath(JSContextRef context, mode_t mask = umask(S_IWGRP | S_IWOTH); error = mkstemp(buf); umask(mask); - LogDebug("mkstemp =" << error); + LoggerD("mkstemp =" << error); - LogDebug("temp file=" << buf << AttachmentFactory::m_pathSeparator << attachShortName); + LoggerD("temp file=" << buf << AttachmentFactory::m_pathSeparator << attachShortName); std::stringstream mkdir_cmd; mkdir_cmd << MKDIR_COMMAND_NAME; mkdir_cmd << " " << MKDIR_COMMAND_SWITCH_RECURSIVE; mkdir_cmd << " \"" << privat_dir << buf << AttachmentFactory::m_pathSeparator << "\""; - LogDebug("mkdir path=" << mkdir_cmd.str()); + LoggerD("mkdir path=" << mkdir_cmd.str()); int result = system(mkdir_cmd.str().c_str()); //make folder in the wgt-private. if (-1 != result) { @@ -342,7 +342,7 @@ std::string AttachmentFactory::getDummyFileFromRealPath(JSContextRef context, cp_cmd << " \"" << real_path << "\""; cp_cmd << " \"" << privat_dir << buf << AttachmentFactory::m_pathSeparator << attachShortName << "\""; - LogDebug("cp path=" << cp_cmd.str()); + LoggerD("cp path=" << cp_cmd.str()); result = system(cp_cmd.str().c_str()); //copy if (-1 != result) { @@ -372,7 +372,7 @@ std::string AttachmentFactory::getDummyFileFromRealPath(JSContextRef context, std::string AttachmentFactory::getRealPathFromVirtualPath(JSContextRef context, const std::string& path) { - LogDebug("path = " << path); + LoggerD("path = " << path); std::string root; std::string tail; @@ -383,8 +383,8 @@ std::string AttachmentFactory::getRealPathFromVirtualPath(JSContextRef context, } else { root = path; } - LogDebug("root = " << root); - LogDebug("tail = " << tail); + LoggerD("root = " << root); + LoggerD("tail = " << tail); int widgetId = WrtAccessSingleton::Instance().getWidgetId(); WidgetDB::Api::IWidgetDBPtr widgetDB = @@ -426,7 +426,7 @@ std::string AttachmentFactory::getRealPathFromVirtualPath(JSContextRef context, } else { //exception - LogDebug("Can't find root path"); + LoggerD("Can't find root path"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "Attachment couldn't be created"); } @@ -448,18 +448,18 @@ bool AttachmentFactory::removeDummyFile(const std::string& dummyFilePath) //remove folder size_t pos = dummyFilePath.find_last_of("/"); if ((pos + 1) >= dummyFilePath.size()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); } std::string folder = dummyFilePath.substr(0, pos); - LogDebug("remove folder : " << folder); + LoggerD("remove folder : " << folder); if ( 0 != remove(folder.c_str())) { - LogError("Remove Error"); + LoggerE("Remove Error"); } } else { - LogDebug("remove file error : " << dummyFilePath); + LoggerD("remove file error : " << dummyFilePath); } } diff --git a/src/Messaging/Attachments.cpp b/src/Messaging/Attachments.cpp old mode 100755 new mode 100644 index fb5ea22..e140d2b --- a/src/Messaging/Attachments.cpp +++ b/src/Messaging/Attachments.cpp @@ -16,10 +16,10 @@ // #include -#include #include #include "Attachments.h" #include "AttachmentFactory.h" +#include extern "C" { #include @@ -36,18 +36,18 @@ namespace Messaging { Attachments::Attachments() : m_validAttachments(false) { - LogDebug("enter"); + LoggerD("enter"); } Attachments::~Attachments() { - LogDebug("enter"); + LoggerD("enter"); } IAttachmentPtr Attachments::appendAttachment(const std::string& fullPath, bool isVirtualPath) { - LogDebug("enter, fullPath=" << fullPath); + LoggerD("enter, fullPath=" << fullPath); IAttachmentPtr tmpAttach = AttachmentFactory::createAttachment( fullPath, isVirtualPath); @@ -58,14 +58,14 @@ IAttachmentPtr Attachments::appendAttachment(const std::string& fullPath, void Attachments::appendAttachment(const IAttachmentPtr& attachment) { - LogDebug("enter"); + LoggerD("enter"); m_validAttachments = false; m_attachments.push_back(attachment); } void Attachments::appendInlineAttachment(const IAttachmentPtr& attachment) { - LogDebug("enter"); + LoggerD("enter"); m_validInineAttachments = false; m_inlineAttachments.push_back(attachment); } @@ -73,7 +73,7 @@ void Attachments::appendInlineAttachment(const IAttachmentPtr& attachment) IAttachmentPtr Attachments::appendAttachment(const IMessagePtr& message, const std::string& fullPath, bool isVirtualPath) { - LogDebug("enter"); + LoggerD("enter"); IAttachmentPtr iAttachment = appendAttachment(fullPath, isVirtualPath); if (message && iAttachment) @@ -86,7 +86,7 @@ IAttachmentPtr Attachments::appendAttachment(const IMessagePtr& message, const s void Attachments::appendAttachment(const IMessagePtr& message, const IAttachmentPtr& attachment) { - LogDebug("enter"); + LoggerD("enter"); m_validAttachments = false; @@ -98,26 +98,26 @@ void Attachments::appendAttachment(const IMessagePtr& message, const IAttachment void Attachments::appendAttachments(const vector& attachments) { - LogDebug("enter"); + LoggerD("enter"); back_insert_iterator< vector >biit(m_attachments); copy(attachments.begin(), attachments.end(), biit); } size_t Attachments::getAttachmentsCount() const { - LogDebug("enter"); + LoggerD("enter"); return m_attachments.size(); } size_t Attachments::getInlineAttachmentsCount() const { - LogDebug("enter"); + LoggerD("enter"); return m_inlineAttachments.size(); } IAttachmentPtr Attachments::getAttachment(const size_t index) const { - LogDebug("enter"); + LoggerD("enter"); if (index >= m_attachments.size()) { ThrowMsg(OutOfRangeException, "Trying to get attachment out of range"); } @@ -126,7 +126,7 @@ IAttachmentPtr Attachments::getAttachment(const size_t index) const IAttachmentPtr Attachments::getInlineAttachment(const size_t index) const { - LogDebug("enter"); + LoggerD("enter"); if (index >= m_inlineAttachments.size()) { ThrowMsg(OutOfRangeException, "Trying to get attachment out of range"); } @@ -135,7 +135,7 @@ IAttachmentPtr Attachments::getInlineAttachment(const size_t index) const void Attachments::removeAttachment(const size_t index) { - LogDebug("enter"); + LoggerD("enter"); if (index >= m_attachments.size()) { ThrowMsg(OutOfRangeException, "Trying to get attachment out of range"); } @@ -152,13 +152,13 @@ void Attachments::removeAttachment(const IAttachmentPtr& attachment) vector Attachments::getAttachments() const { - LogDebug("enter"); + LoggerD("enter"); return m_attachments; } vector Attachments::getInlineAttachments() const { - LogDebug("enter"); + LoggerD("enter"); return m_inlineAttachments; } @@ -208,7 +208,7 @@ void Attachments::setInlineAttachments(const vector& attachments bool Attachments::isAttachmentsValid() const { - LogDebug("m_validAttachments : " << m_validAttachments); + LoggerD("m_validAttachments : " << m_validAttachments); return m_validAttachments; } @@ -236,7 +236,7 @@ void Attachments::saveAttachment(const string& destFileName, const IAttachmentPtr& attachment) { // possible move it as a virtual function - to be clarified - LogError("N/A"); + LoggerE("N/A"); //TODO } diff --git a/src/Messaging/BinarySms.cpp b/src/Messaging/BinarySms.cpp old mode 100755 new mode 100644 index 8733e8a..26de2e1 --- a/src/Messaging/BinarySms.cpp +++ b/src/Messaging/BinarySms.cpp @@ -16,7 +16,7 @@ // #include "BinarySms.h" -#include +#include using namespace std; @@ -26,20 +26,20 @@ namespace Messaging { BinarySms::BinarySms(const string& id) : IMessage(BINARYSMS, id) { - LogDebug("enter"); + LoggerD("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); } BinarySms::~BinarySms() { - LogDebug("enter"); + LoggerD("enter"); } void BinarySms::update(bool /*draftsOnly*/) { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); } void BinarySms::readAllData() diff --git a/src/Messaging/CallbackMgr.cpp b/src/Messaging/CallbackMgr.cpp index 57de944..fab5a3f 100644 --- a/src/Messaging/CallbackMgr.cpp +++ b/src/Messaging/CallbackMgr.cpp @@ -16,9 +16,9 @@ // #include "CallbackMgr.h" -#include #include "MsgServiceHandleMgr.h" #include +#include IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::CallbackMgr) @@ -34,24 +34,24 @@ namespace Messaging { CallbackMgr::CallbackMgr() { - LogInfo("enter"); + LoggerI("enter"); // register callback once per process if (NULL == MsgGetCommonHandle()) { - LogError("Unable to open handle"); + LoggerE("Unable to open handle"); } else { if (msg_reg_sent_status_callback(MsgGetCommonHandle(), sendCallback, static_cast(this)) != MSG_SUCCESS) { - LogError("callback registration error"); + LoggerE("callback registration error"); } else { - LogDebug("callback registred succesfully"); + LoggerD("callback registred succesfully"); } } } CallbackMgr::~CallbackMgr() { - LogInfo("enter"); + LoggerI("enter"); } msg_error_t CallbackMgr::registerAndSend(SendingFunction sendingFn, @@ -76,10 +76,14 @@ msg_error_t CallbackMgr::registerAndSend(SendingFunction sendingFn, { if (observer) { - msg_struct_list_s *addr_list = NULL; - err = msg_get_list_handle(message, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; + + err = msg_get_list_handle(message, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, 0); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); msg_get_int_value(req, MSG_REQUEST_REQUESTID_INT, &tempInt); m_sendRequests[tempInt] = observer; @@ -102,15 +106,15 @@ msg_error_t CallbackMgr::registerAndSend(SendingFunction sendingFn, void CallbackMgr::unregister(int reqId) { - LogDebug(" reqId is : " << reqId); + LoggerD(" reqId is : " << reqId); DPL::Mutex::ScopedLock lock(&m_mutex); SendReqMap::iterator it = m_sendRequests.find(reqId); if (it == m_sendRequests.end()) { - LogWarning("No matching request found"); + LoggerW("No matching request found"); return; } - LogInfo("Matching send request found!"); + LoggerI("Matching send request found!"); m_sendRequests.erase(it); } @@ -120,12 +124,12 @@ void CallbackMgr::sendCallback(msg_handle_t handle, msg_struct_t sent_status, void *user_param) { -// LogInfo( +// LoggerI( // "callback received. Req id = " << sent_status->reqId << // " Status = " << (int)sent_status->status); CallbackMgr* instance = static_cast(user_param); if (!instance) { - LogError("Empty user data!"); + LoggerE("Empty user data!"); return; } @@ -153,10 +157,10 @@ void CallbackMgr::call(msg_struct_t sent_status) SendReqMap::iterator it = m_sendRequests.find(reqId); if (it == m_sendRequests.end()) { - LogWarning("No matching request found"); + LoggerW("No matching request found"); return; } - LogInfo("Matching send request found!"); + LoggerI("Matching send request found!"); // call it it->second->sendingCallback(sent_status); m_sendRequests.erase(it); diff --git a/src/Messaging/CallbackNumber.cpp b/src/Messaging/CallbackNumber.cpp old mode 100755 new mode 100644 index 38bb8f2..de230bf --- a/src/Messaging/CallbackNumber.cpp +++ b/src/Messaging/CallbackNumber.cpp @@ -15,9 +15,9 @@ // limitations under the License. // -#include #include "CallbackNumber.h" #include "CallbackNumber.h" +#include namespace DeviceAPI { namespace Messaging { @@ -34,7 +34,7 @@ CallbackNumber::~CallbackNumber() void CallbackNumber::setCallbackNumber(const std::string& value) { - LogDebug("set callbackNumber=" << value); + LoggerD("set callbackNumber=" << value); m_callbackNumber = value; m_validCallbackNumber = false; } diff --git a/src/Messaging/Conversation.cpp b/src/Messaging/Conversation.cpp index 26bc1a9..6e8f753 100644 --- a/src/Messaging/Conversation.cpp +++ b/src/Messaging/Conversation.cpp @@ -39,7 +39,7 @@ Conversation::Conversation() Conversation::Conversation(unsigned int threadId, MessageType msgType) { - LogDebug("Enter"); + LoggerD("Enter"); if (msgType == EMAIL) { @@ -57,11 +57,11 @@ Conversation::Conversation(unsigned int threadId, MessageType msgType) Conversation::Conversation(std::string threadId, MessageType msgType) { - LogDebug("Enter"); + LoggerD("Enter"); bool result = FALSE; std::istringstream stream(threadId); - LogDebug("threadId : " << threadId); + LoggerD("threadId : " << threadId); unsigned int number = 0; stream >> number; @@ -86,11 +86,12 @@ Conversation::Conversation(msg_struct_t msg_thread) //void Conversation::makeConversationFromThread(msg_thread_view_t msg_thread) void Conversation::makeConversationFromThread(msg_struct_t msg_thread) { - LogDebug("Enter"); + LoggerD("Enter"); msg_handle_t handle = MsgGetCommonHandle(); msg_struct_list_s convViewList; - msg_struct_list_s *addr_list = NULL; + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; msg_struct_t msgInfo = NULL; msg_struct_t sendOpt = NULL; @@ -127,13 +128,13 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) case MSG_TYPE_SMS_SYNCML: case MSG_TYPE_SMS_REJECT: m_type = SMS; - LogDebug("Type:SMS"); + LoggerD("Type:SMS"); break; case MSG_TYPE_MMS: case MSG_TYPE_MMS_JAVA: case MSG_TYPE_MMS_NOTI: m_type = MMS;; - LogDebug("Type:MMS"); + LoggerD("Type:MMS"); break; } @@ -152,7 +153,7 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) if (tempString != NULL) { m_preview = tempString; - LogDebug("preview" << m_preview); + LoggerD("preview" << m_preview); } err = msg_get_conversation_view_list(handle, m_Id, &convViewList); @@ -183,9 +184,9 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt); int type = tempInt; - msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); - nToCnt = addr_list->nCount; + nToCnt = msg_list_length(addr_list); if (type == MSG_DIRECTION_TYPE_MT) { @@ -193,7 +194,8 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) { char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[m_lastMessageId], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, m_lastMessageId); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); if (strNumber[0] != '\0') { @@ -201,18 +203,18 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) } else { - LogDebug("address is null "); + LoggerD("address is null "); } } else { - LogDebug("address count index fail"); + LoggerD("address count index fail"); } } else { - LogDebug("Msg direction: MO, from will be omitted"); + LoggerD("Msg direction: MO, from will be omitted"); } // get thread subject @@ -230,7 +232,8 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) for (index = 0; index < nToCnt; index++) { char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[index], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, index); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); tempString = strNumber; if (tempString != NULL) { @@ -240,13 +243,13 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) } else { - LogDebug("address fetch fail" << addressCount); + LoggerD("address fetch fail" << addressCount); } } catch (const WrtDeviceApis::Commons::Exception& ex) { m_result = false; - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } msg_release_list_struct(&convViewList); @@ -261,7 +264,7 @@ void Conversation::makeConversationFromThread(msg_struct_t msg_thread) void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) { /* - LogDebug("Enter"); + LoggerD("Enter"); MSG_HANDLE_T handle = MsgGetCommonHandle(); MSG_LIST_S convViewList = {0, NULL}; MSG_THREAD_VIEW_LIST_S threadViewList = {0, NULL}; @@ -282,7 +285,7 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) if (threadViewList.nCount < 0 || threadIndex >= (unsigned int)threadViewList.nCount) { - LogDebug(threadIndex << ":" << threadViewList.nCount); + LoggerD(threadIndex << ":" << threadViewList.nCount); ThrowMsg(WrtDeviceApis::Commons::UnknownException, "invalid index reference" ); } @@ -302,13 +305,13 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) case MSG_TYPE_SMS_SYNCML: case MSG_TYPE_SMS_REJECT: m_type = SMS; - LogDebug("Type:SMS"); + LoggerD("Type:SMS"); break; case MSG_TYPE_MMS: case MSG_TYPE_MMS_JAVA: case MSG_TYPE_MMS_NOTI: m_type = MMS;; - LogDebug("Type:MMS"); + LoggerD("Type:MMS"); break; // default: // Todo email / chat @@ -321,7 +324,7 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) if (tempString != NULL) { m_preview = tempString; - LogDebug("preview" << m_preview); + LoggerD("preview" << m_preview); } @@ -336,7 +339,7 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) m_messageCount = convViewList.nCount; m_read = msg_is_read(convViewList.msgInfo[lastMsgIndex]); - LogDebug("lastMsgIndex:" << lastMsgIndex << ",message count:" << m_messageCount << ",read" << m_read); + LoggerD("lastMsgIndex:" << lastMsgIndex << ",message count:" << m_messageCount << ",read" << m_read); if (msg_get_direction_info(convViewList.msgInfo[lastMsgIndex]) == MSG_DIRECTION_TYPE_MT) { @@ -352,18 +355,18 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) } else { - LogDebug("address is null "); + LoggerD("address is null "); } } else { - LogDebug("address count index fail"); + LoggerD("address count index fail"); } - LogDebug("from" << m_from); + LoggerD("from" << m_from); } else { - LogDebug("Msg direction: MO, from will be omitted"); + LoggerD("Msg direction: MO, from will be omitted"); } @@ -374,7 +377,7 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) m_subject = tempString; } - LogDebug("subject" << m_subject); + LoggerD("subject" << m_subject); addressCount = msg_get_address_count(convViewList.msgInfo[lastMsgIndex]); @@ -391,11 +394,11 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) m_to.push_back(tempString); } } - LogDebug("address count" << addressCount); + LoggerD("address count" << addressCount); } else { - LogDebug("address fetch fail" << addressCount); + LoggerD("address fetch fail" << addressCount); } if (msg_get_message_id(convViewList.msgInfo[lastMsgIndex]) >= 0 ) @@ -403,13 +406,13 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) m_lastMessageId = msg_get_message_id(convViewList.msgInfo[lastMsgIndex]); } - LogDebug("message id" << m_lastMessageId); + LoggerD("message id" << m_lastMessageId); } catch (const WrtDeviceApis::Commons::Exception& ex) { m_result = false; - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } if (convViewList.msgInfo != NULL) { @@ -426,7 +429,7 @@ void Conversation::makeConversationFromThreadIndex(unsigned int threadIndex) bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msgType) { - LogDebug("Enter"); + LoggerD("Enter"); msg_handle_t handle = MsgGetCommonHandle(); @@ -436,7 +439,8 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg msg_struct_t msg_thread = NULL; msg_struct_list_s convViewList; - msg_struct_list_s *addr_list = NULL; + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; msg_error_t err = MSG_SUCCESS; @@ -465,7 +469,7 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg // get threadId from message msg_get_int_value(msgInfo, MSG_MESSAGE_THREAD_ID_INT, &tempInt); m_Id = (unsigned int)tempInt; - LogDebug("m_Id : " << m_Id); + LoggerD("m_Id : " << m_Id); // get Thread msg_thread = msg_create_struct(MSG_STRUCT_THREAD_INFO); @@ -483,25 +487,25 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg case MSG_TYPE_SMS_SYNCML: case MSG_TYPE_SMS_REJECT: m_type = SMS; - LogDebug("Type:SMS"); + LoggerD("Type:SMS"); break; case MSG_TYPE_MMS: case MSG_TYPE_MMS_JAVA: case MSG_TYPE_MMS_NOTI: m_type = MMS;; - LogDebug("Type:MMS"); + LoggerD("Type:MMS"); break; } // get thread time msg_get_int_value(msg_thread, MSG_THREAD_MSG_TIME_INT, &tempInt); m_time = tempInt; - LogDebug("m_time : " << m_time); + LoggerD("m_time : " << m_time); // get thread unread count msg_get_int_value(msg_thread, MSG_THREAD_UNREAD_COUNT_INT, &tempInt); m_unreadMessages = tempInt; - LogDebug("m_unreadMessages : " << m_unreadMessages); + LoggerD("m_unreadMessages : " << m_unreadMessages); // get thread preview msg_get_str_value(msg_thread, MSG_THREAD_MSG_DATA_STR, msgData, MAX_THREAD_DATA_LEN); @@ -511,7 +515,7 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg { m_preview = tempString; } - LogDebug("m_preview : " << m_preview); + LoggerD("m_preview : " << m_preview); err = msg_get_conversation_view_list(handle, m_Id, &convViewList); @@ -523,17 +527,17 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg // get thread message count lastMsgIndex = convViewList.nCount - 1; m_messageCount = convViewList.nCount; - LogDebug("m_messageCount : " << m_messageCount); + LoggerD("m_messageCount : " << m_messageCount); // get thread read status msg_get_bool_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_READ_BOOL, &tempBool); m_read = tempBool; - LogDebug("m_read : " << m_read); + LoggerD("m_read : " << m_read); // get thread last message Id msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_ID_INT, &tempInt); m_lastMessageId = tempInt; - LogDebug("m_lastMessageId : " << m_lastMessageId); + LoggerD("m_lastMessageId : " << m_lastMessageId); // get thread from if (msg_get_message(handle, m_lastMessageId, msgInfo, sendOpt) != MSG_SUCCESS) @@ -543,10 +547,10 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg msg_get_int_value(convViewList.msg_struct_info[lastMsgIndex], MSG_CONV_MSG_DIRECTION_INT, &tempInt); int type = tempInt; - LogDebug("direction : " << type); + LoggerD("direction : " << type); - msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); - nToCnt = addr_list->nCount; + msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); + nToCnt = msg_list_length(addr_list); if (type == MSG_DIRECTION_TYPE_MT) { @@ -554,7 +558,8 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) { char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[nToCnt-1], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, nToCnt-1); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); if (strNumber[0] != '\0') { @@ -562,36 +567,37 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg } else { - LogDebug("address is null "); + LoggerD("address is null "); } } else { - LogDebug("address count index fail"); + LoggerD("address count index fail"); } } else { - LogDebug("Msg direction: MO, from will be omitted"); + LoggerD("Msg direction: MO, from will be omitted"); // get thread to if (nToCnt > 0 && nToCnt < MAX_TO_ADDRESS_CNT ) { for (int index = 0; index < nToCnt; index++) { + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, index); char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; - msg_get_str_value(addr_list->msg_struct_info[index], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); tempString = strNumber; if (tempString != NULL) { - LogDebug("m_to : " << tempString); + LoggerD("m_to : " << tempString); m_to.push_back(tempString); } } } else { - LogDebug("address fetch fail"); + LoggerD("address fetch fail"); } } @@ -603,18 +609,18 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg { m_subject = tempString; // convert char to string } - LogDebug("m_subject : " << m_subject); + LoggerD("m_subject : " << m_subject); } catch (const WrtDeviceApis::Commons::UnknownException& ex) { m_result = false; - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } catch (const WrtDeviceApis::Commons::Exception& ex) { m_result = false; - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } msg_release_list_struct(&convViewList); @@ -627,7 +633,7 @@ bool Conversation::makeConversationFromMsgId(unsigned int msgId, MessageType msg bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId) { - LogDebug("Enter"); + LoggerD("Enter"); email_mail_list_item_t *resultMail = NULL; email_mail_list_item_t *mailList = NULL; @@ -659,13 +665,13 @@ bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId) // account Id m_unreadMessages = 0; - LogDebug("start email_get_mail_list"); + LoggerD("start email_get_mail_list"); if (email_get_mail_list(mailData->account_id, 0, emailTreadId, 0, resultMail->thread_item_count, EMAIL_SORT_DATETIME_HIGH, &mailList, &count) != EMAIL_ERROR_NONE) { ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get email data fail" ); } - LogDebug("end email_get_mail_list"); + LoggerD("end email_get_mail_list"); // unread msg count for (index = 0; index < count; index++) @@ -674,7 +680,7 @@ bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId) { m_unreadMessages++; } - LogDebug(mailList[index].flags_seen_field); + LoggerD(mailList[index].flags_seen_field); } // message count @@ -696,42 +702,42 @@ bool Conversation::makeConversationFromEmailThreadId(unsigned int emailTreadId) if (resultMail->full_address_from[0] != '\0') { m_from = resultMail->full_address_from; - LogDebug(m_from); + LoggerD(m_from); } // subject if (resultMail->subject[0] != '\0') { m_subject = resultMail->subject; - LogDebug(m_subject); + LoggerD(m_subject); } if (mailData->full_address_to != NULL) { - LogDebug("Header To " << mailData->full_address_to); + LoggerD("Header To " << mailData->full_address_to); m_to.push_back(mailData->full_address_to); } if (mailData->full_address_bcc != NULL) { - LogDebug("Header Bcc " << mailData->full_address_bcc); + LoggerD("Header Bcc " << mailData->full_address_bcc); m_bcc.push_back(mailData->full_address_bcc); } if (mailData->full_address_cc != NULL) { - LogDebug("Header CC " << mailData->full_address_cc); + LoggerD("Header CC " << mailData->full_address_cc); m_cc.push_back(mailData->full_address_cc); } m_lastMessageId = resultMail->mail_id; - LogDebug(m_lastMessageId); + LoggerD(m_lastMessageId); m_result = true; } catch (const WrtDeviceApis::Commons::Exception& ex) { m_result = false; - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); } if (mailData != NULL) @@ -872,3 +878,4 @@ bool Conversation::getResult() } } + diff --git a/src/Messaging/ConversationFilterValidator.cpp b/src/Messaging/ConversationFilterValidator.cpp old mode 100755 new mode 100644 index e6d6fbd..e3c138a --- a/src/Messaging/ConversationFilterValidator.cpp +++ b/src/Messaging/ConversationFilterValidator.cpp @@ -19,8 +19,7 @@ #include "ConversationFilterValidatorFactory.h" #include "log.h" - -#include +#include using namespace DeviceAPI::Tizen; @@ -43,7 +42,7 @@ namespace DeviceAPI { bool retVal = false; if(attrName.compare(ConversationFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)!=0){ - LogError(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); + LoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); return false; } @@ -65,16 +64,16 @@ namespace DeviceAPI { } retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue,depth); - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } bool ConversationFilterValidator::validateAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); if(attrName.compare(ConversationFilterValidatorFactory::ATTRIBUTE_TYPE)==0){ if(m_isTypeSetted == true){ - MsgLogError(">>> [ERROR] duplicated type :[" << attrName << "], value:[" << value->toString()<< "]"); + MsgLoggerE(">>> [ERROR] duplicated type :[" << attrName << "], value:[" << value->toString()<< "]"); return false; }else{ m_isTypeSetted = true; diff --git a/src/Messaging/ConversationQueryGenerator.cpp b/src/Messaging/ConversationQueryGenerator.cpp old mode 100755 new mode 100644 index af6232c..0d11793 --- a/src/Messaging/ConversationQueryGenerator.cpp +++ b/src/Messaging/ConversationQueryGenerator.cpp @@ -19,8 +19,8 @@ #include "ConversationFilterValidatorFactory.h" #include -#include #include "log.h" +#include namespace DeviceAPI { namespace Messaging { @@ -51,7 +51,7 @@ namespace DeviceAPI { } void ConversationQueryGenerator::setSmsMmsAttributeMap(){ - LogDebug("<<<"); + LoggerD("<<<"); attributeMap.clear(); attributeMap.insert( @@ -79,7 +79,7 @@ namespace DeviceAPI { std::pair( ConversationFilterValidatorFactory::ATTRIBUTE_UNREAD_MESSAGES, "B.UNREAD_CNT")); - LogDebug(">>>"); + LoggerD(">>>"); } std::string ConversationQueryGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value){ @@ -108,7 +108,7 @@ namespace DeviceAPI { }else if(getMode() == MODE_MMS){ return ConversationQueryGenerator::QUERY_PREFIX_MMS; }else{ - MsgLogError("invalid mode:" << getMode()); + MsgLoggerE("invalid mode:" << getMode()); Throw(WrtDeviceApis::Commons::UnknownException); } } @@ -119,7 +119,7 @@ namespace DeviceAPI { }else if(getMode() == MODE_SMS || getMode() == MODE_MMS){ return ConversationQueryGenerator::QUERY_SUFFIX_SMS_MMS; }else{ - MsgLogError("invalid mode:" << getMode()); + MsgLoggerE("invalid mode:" << getMode()); Throw(WrtDeviceApis::Commons::UnknownException); } } diff --git a/src/Messaging/ConverterMessage.cpp b/src/Messaging/ConverterMessage.cpp index 3c54588..1818080 100644 --- a/src/Messaging/ConverterMessage.cpp +++ b/src/Messaging/ConverterMessage.cpp @@ -32,6 +32,7 @@ #include "JSMessageFolder.h" #include +#include #if 0 // MESSAGING ATTACHMENT IS BLOCKED #include @@ -73,7 +74,7 @@ JSContextRef ConverterMessage::toJSGlobalContext(JSObjectRef arg) static_cast::Type*>(JSObjectGetPrivate( arg)); if (!priv) { - LogError("Private object not initialized"); + LoggerE("Private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -120,7 +121,7 @@ JSValueRef ConverterMessage::toJSValueRef(const IMessagePtr& arg) return JSMessage::createJSObject(m_context, arg); default: - LogError("unknown type"); + LoggerE("unknown type"); Throw(WrtDeviceApis::Commons::ConversionException); } } @@ -136,7 +137,7 @@ JSValueRef ConverterMessage::toJSValueRef(const IMessagePtr& arg, return JSMessage::createJSObject(m_context, arg, listener); default: - LogError("unknown type"); + LoggerE("unknown type"); Throw(WrtDeviceApis::Commons::ConversionException); } } @@ -207,19 +208,19 @@ JSValueRef ConverterMessage::keyToJSValue(JSValueRef value, JSValueRef retVal = NULL; if (NULL == value) { - LogError("jsValue null"); + LoggerE("jsValue null"); Throw(WrtDeviceApis::Commons::ConversionException); } JSObjectRef argObj = JSValueToObject(m_context, value, NULL); if (NULL == argObj) { - LogError("conversion to jsobject fail"); + LoggerE("conversion to jsobject fail"); Throw(WrtDeviceApis::Commons::ConversionException); } const JSStringRef keyJSStr = JSStringCreateWithUTF8CString(key.c_str()); retVal = JSObjectGetProperty(m_context, argObj, keyJSStr, NULL); JSStringRelease(keyJSStr); if (NULL == retVal) { - LogWarning("key \"" << key << "\" not found in JSValue map"); + LoggerW("key \"" << key << "\" not found in JSValue map"); } // return NULL if no key in map return retVal; @@ -232,9 +233,9 @@ IMessagePtr ConverterMessage::toIMessage(JSValueRef arg) IMessagePtr ConverterMessage::toIMessage(JSObjectRef arg) { - LogDebug("message object=" << arg); + LoggerD("message object=" << arg); if (!arg) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -243,13 +244,13 @@ IMessagePtr ConverterMessage::toIMessage(JSObjectRef arg) JSMessagePrivateObject* priv = static_cast(JSObjectGetPrivate(arg)); if (!priv) { - LogError("Private object not initialized"); + LoggerE("Private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } retVal = priv->getObject(); if (!retVal) { - LogError("Message private object not initialized"); + LoggerE("Message private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -265,7 +266,7 @@ IAttachmentPtr ConverterMessage::toIAttachment(JSObjectRef arg) { if (!arg) { - LogError("Object is Null"); + LoggerE("Object is Null"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -274,14 +275,14 @@ IAttachmentPtr ConverterMessage::toIAttachment(JSObjectRef arg) static_cast(JSObjectGetPrivate(arg)); if (!priv) { - LogError("Private object not initialized"); + LoggerE("Private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } retVal = priv->getObject(); if (!retVal) { - LogError("Message private object not initialized"); + LoggerE("Message private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -297,7 +298,7 @@ IMessageFolderPtr ConverterMessage::toIMessageFolder(JSObjectRef arg) { if (!arg) { - LogError("Object is Null"); + LoggerE("Object is Null"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -306,14 +307,14 @@ IMessageFolderPtr ConverterMessage::toIMessageFolder(JSObjectRef arg) static_cast(JSObjectGetPrivate(arg)); if (!priv) { - LogError("Private object not initialized"); + LoggerE("Private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } retVal = priv->getObject(); if (!retVal) { - LogError("Message private object not initialized"); + LoggerE("Message private object not initialized"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object not initialized"); } @@ -338,48 +339,58 @@ Recipients ConverterMessage::toRecipients(JSValueRef arg) return retVal; } -OnMessagesChanged ConverterMessage::toMessageMultifunctions(JSValueRef argument) -{ - OnMessagesChanged result; - Validator validator(m_context); - JSObjectRef objectCallbacks = toJSObjectRef(argument); - std::string callbackName = toString(argument); - int index = 0; - - LogDebug("Enter\n"); - - for (index = 0; index < MESSAGING_MULTI_FUNTION_MAX; index++) - { - ScopedJSStringRef propName(toJSStringRef(m_callbackNames[index].addedFunction)); - - if (JSObjectHasProperty(m_context, objectCallbacks, propName.get())) - { - LogDebug("Callback name :" << m_callbackNames[index].addedFunction << " " - << m_callbackNames[index].updatedFunction << " " << m_callbackNames[index].removedFunction); - - result.messagesAdded = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[index].addedFunction); - result.messagesUpdated = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[index].updatedFunction); - result.messagesRemoved = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[index].removedFunction); - break; - } - - } - - if(result.messagesAdded == NULL || result.messagesUpdated == NULL || result.messagesRemoved == NULL) - { - LogError("OnMessagesChanged is not set"); - Throw(WrtDeviceApis::Commons::ConversionException); - } - - result.functionIndex = index; - - if ((!validator.isNullOrUndefined(result.messagesAdded) && !validator.isCallback(result.messagesAdded)) || - (!validator.isNullOrUndefined(result.messagesUpdated) && !validator.isCallback(result.messagesUpdated)) || - (!validator.isNullOrUndefined(result.messagesRemoved) && !validator.isCallback(result.messagesRemoved))) - { - LogError("java script call back set error"); - Throw(WrtDeviceApis::Commons::ConversionException); - } +OnMessagesChanged ConverterMessage::toMessageMultifunctions(JSValueRef argument, int multiFuntionType) +{ + LoggerD("Enter"); + + LoggerD("multiFuntionType : " << multiFuntionType); + + OnMessagesChanged result; + Validator validator(m_context); + JSObjectRef objectCallbacks = toJSObjectRef(argument); + + ScopedJSStringRef propNameAdded(toJSStringRef(m_callbackNames[multiFuntionType].addedFunction)); + ScopedJSStringRef propNameUpdated(toJSStringRef(m_callbackNames[multiFuntionType].updatedFunction)); + ScopedJSStringRef propNameRemoved(toJSStringRef(m_callbackNames[multiFuntionType].removedFunction)); + + if(JSObjectHasProperty(m_context, objectCallbacks, propNameAdded.get())) + { + LoggerD("added exist"); + result.messagesAdded = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[multiFuntionType].addedFunction); + if (validator.isNullOrUndefined(result.messagesAdded)) + result.messagesAdded = NULL; + else if (!validator.isCallback(result.messagesAdded)) { + LoggerD("is not Callback"); + ThrowMsg(ConversionException, "1nd argument's onsuccess attribute is not a 'function'"); + } + } + if(JSObjectHasProperty(m_context, objectCallbacks, propNameUpdated.get())) + { + LoggerD("updated exist"); + result.messagesUpdated = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[multiFuntionType].updatedFunction); + if (validator.isNullOrUndefined(result.messagesUpdated)) + result.messagesUpdated = NULL; + else if (!validator.isCallback(result.messagesUpdated)) { + LoggerD("is not Callback"); + ThrowMsg(ConversionException, "2nd argument's onsuccess attribute is not a 'function'"); + } + } + if(JSObjectHasProperty(m_context, objectCallbacks, propNameRemoved.get())) + { + LoggerD("removed exist"); + result.messagesRemoved = JSUtils::getJSPropertyOrUndefined(m_context, objectCallbacks, m_callbackNames[multiFuntionType].removedFunction); + if (validator.isNullOrUndefined(result.messagesRemoved)) + result.messagesRemoved = NULL; + else if (!validator.isCallback(result.messagesRemoved)) { + LoggerD("is not Callback"); + ThrowMsg(ConversionException, "3nd argument's onsuccess attribute is not a 'function'"); + } + } + + if(result.messagesAdded != NULL || result.messagesUpdated != NULL || result.messagesRemoved != NULL) + { + result.functionIndex = multiFuntionType; + } return result; } @@ -418,7 +429,7 @@ MessageType ConverterMessage::toMessageType(JSObjectRef arg) { // convert JSvalue to message type enum std::string strMsgType = toString(arg); - LogDebug("Messasge Type : " << strMsgType); + LoggerD("Messasge Type : " << strMsgType); if ( strMsgType.compare("messaging.sms") == 0 ) { @@ -441,7 +452,7 @@ MessageType ConverterMessage::toMessageType(JSObjectRef arg) std::string ConverterMessage::toMessageType( long msgtype ) { - LogDebug("Messasge Type : " << msgtype); + LoggerD("Messasge Type : " << msgtype); switch (msgtype) { @@ -458,7 +469,7 @@ std::string ConverterMessage::toMessageType( long msgtype ) MessageType ConverterMessage::toMessageType(std::string arg) { - LogDebug("Messasge Type : " << arg); + LoggerD("Messasge Type : " << arg); if ( arg.compare("messaging.sms") == 0 ) { @@ -482,7 +493,7 @@ MessageType ConverterMessage::toMessageType(std::string arg) std::string ConverterMessage::toMessageStatusType( long msgstatus ) { - LogDebug("Messasge Status : " << msgstatus); + LoggerD("Messasge Status : " << msgstatus); switch (msgstatus) { @@ -504,7 +515,7 @@ std::string ConverterMessage::toMessageStatusType( long msgstatus ) std::string ConverterMessage::convertIntToString( int msgInt ) { - LogDebug("input int : " << msgInt); + LoggerD("input int : " << msgInt); std::stringstream stream; stream << msgInt; return stream.str(); @@ -523,7 +534,7 @@ std::vector ConverterMessage::toVectorOfConversation(const JSV if( JSGetArrayLength(m_context, jsObject) == 0) { - LogError("this is empty conversation"); + LoggerE("this is empty conversation"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -547,7 +558,7 @@ AddressType ConverterMessage::toAddressType(JSValueRef arg) } else if ("bcc" == addressType) { return BCC_ADDRESS; } else { - LogError("unknown address type"); + LoggerE("unknown address type"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } diff --git a/src/Messaging/ConverterMessage.h b/src/Messaging/ConverterMessage.h index 824c944..879c99a 100644 --- a/src/Messaging/ConverterMessage.h +++ b/src/Messaging/ConverterMessage.h @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include "IMessagingTypes.h" #include "MessageFactory.h" @@ -64,7 +63,7 @@ class ConverterMessage : public WrtDeviceApis::CommonsJavaScript::Converter virtual ~ConverterMessage(); - OnMessagesChanged toMessageMultifunctions(JSValueRef argument); + OnMessagesChanged toMessageMultifunctions(JSValueRef argument, int MessageFunctionNum); JSContextRef toJSGlobalContext(JSObjectRef arg); diff --git a/src/Messaging/DBus/Connection.cpp b/src/Messaging/DBus/Connection.cpp old mode 100755 new mode 100644 index 6178de2..e2745de --- a/src/Messaging/DBus/Connection.cpp +++ b/src/Messaging/DBus/Connection.cpp @@ -19,8 +19,8 @@ #include #include #include -#include #include "Message.h" +#include namespace DeviceAPI { namespace Messaging { @@ -65,12 +65,12 @@ 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."); + LoggerD("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)) { - LogDebug("Couldn't set signal handler callback."); + LoggerD("Couldn't set signal handler callback."); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't set signal handler callback."); } @@ -79,7 +79,7 @@ void Connection::open(DBusBusType bus) void Connection::close() { - LogDebug("ENTER"); + LoggerD("ENTER"); if (!m_connected) { return; } dbus_connection_remove_filter(m_connection, filterMessage, this); @@ -152,7 +152,7 @@ void Connection::removeFilterInternal(const std::string& rule) if (dbus_error_is_set(&m_error)) { std::string message = m_error.message; dbus_error_free(&m_error); - LogDebug("removeFilterInternal error : " << message); + LoggerD("removeFilterInternal error : " << message); // ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "Invalid rule: " << message); } } @@ -160,7 +160,7 @@ void Connection::removeFilterInternal(const std::string& rule) dbus_bool_t Connection::addWatch(DBusWatch* watch, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); assert(data && "Connection should be passed as user data."); Connection* this_ = static_cast(data); WatchPtr wrapper(new Watch(watch)); @@ -176,7 +176,7 @@ dbus_bool_t Connection::addWatch(DBusWatch* watch, void Connection::removeWatch(DBusWatch* watch, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); assert(data && "Connection should be passed as user data."); Connection* this_ = static_cast(data); Watch wrapper(watch); @@ -191,7 +191,7 @@ void Connection::removeWatch(DBusWatch* watch, void Connection::toggleWatch(DBusWatch* watch, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); assert(data && "Connection should be passed as user data."); Connection* this_ = static_cast(data); Watch wrapper(watch); @@ -208,17 +208,17 @@ DBusHandlerResult Connection::filterMessage(DBusConnection* connection, DBusMessage* message, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); if (data) { Connection* this_ = static_cast(data); MessagePtr msg; if (message) { - LogInfo( + LoggerI( "DBUS message received from interface: " << dbus_message_get_interface(message)); msg.Reset(new Message(message)); } else { - LogError("DBus message not set, this should not happen!"); + LoggerE("DBus message not set, this should not happen!"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } FilterSetIterator it = this_->m_filters.begin(); @@ -232,7 +232,7 @@ DBusHandlerResult Connection::filterMessage(DBusConnection* connection, } } } else { - LogError("User-data not set, this should not happen!"); + LoggerE("User-data not set, this should not happen!"); } return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -253,7 +253,7 @@ Connection::MessageDispatcher::~MessageDispatcher() void Connection::MessageDispatcher::addDescriptor(DPL::WaitableHandle handle, DPL::WaitMode::Type mode) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::WaitableEvent wait; AddDescriptorSyncEvent event(handle, mode, &wait); DPL::Event::ControllerEventHandler::PostEvent(event); @@ -263,7 +263,7 @@ void Connection::MessageDispatcher::addDescriptor(DPL::WaitableHandle handle, void Connection::MessageDispatcher::removeDescriptor(DPL::WaitableHandle handle, DPL::WaitMode::Type mode) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::WaitableEvent wait; RemoveDescriptorSyncEvent event(handle, mode, &wait); DPL::Event::ControllerEventHandler::PostEvent(event); @@ -273,7 +273,7 @@ void Connection::MessageDispatcher::removeDescriptor(DPL::WaitableHandle handle, void Connection::MessageDispatcher::OnEventReceived( const AddDescriptorSyncEvent& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::WaitableHandleWatchSupport::InheritedContext()->AddWaitableHandleWatch( this, event.GetArg0(), @@ -284,7 +284,7 @@ void Connection::MessageDispatcher::OnEventReceived( void Connection::MessageDispatcher::OnEventReceived( const RemoveDescriptorSyncEvent& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); DPL::WaitableHandleWatchSupport::InheritedContext()-> RemoveWaitableHandleWatch(this, event.GetArg0(), event.GetArg1()); event.GetArg2()->Signal(); @@ -294,7 +294,7 @@ void Connection::MessageDispatcher::OnWaitableHandleEvent( DPL::WaitableHandle waitableHandle, DPL::WaitMode::Type mode) { - LogDebug("ENTER"); + LoggerD("ENTER"); { DPL::Mutex::ScopedLock lock(&m_connection->m_watchesMutex); WatchSetIterator it = m_connection->m_watches.find(waitableHandle); @@ -303,7 +303,7 @@ void Connection::MessageDispatcher::OnWaitableHandleEvent( (mode == DPL::WaitMode::Write ? DBUS_WATCH_WRITABLE : DBUS_WATCH_READABLE); while (!dbus_watch_handle(it->second->get(), flags)) { - LogError("Too few memory!"); + LoggerE("Too few memory!"); // TODO: add some check-point to not loop infinitely } } diff --git a/src/Messaging/Email.cpp b/src/Messaging/Email.cpp index a09ea0c..da3ad43 100644 --- a/src/Messaging/Email.cpp +++ b/src/Messaging/Email.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -39,9 +38,10 @@ #include "MessagingService.h" #include "MessagingServiceManager.h" #include "Attachment.h" +#include -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); +#define LOG_ENTER LoggerD("---> ENTER"); +#define LOG_EXIT LoggerD("---> EXIT"); using namespace std; using namespace WrtDeviceApis::Commons; @@ -67,7 +67,7 @@ Email::Email(const string& id) : reload(); } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogError("Exception: " << ex.DumpToString()); + LoggerE("Exception: " << ex.DumpToString()); } LOG_EXIT @@ -84,13 +84,13 @@ Email::Email(const std::string& id, int accountId) : ThrowMsg(WrtDeviceApis::Commons::PlatformException, " message id is invalid"); } - LogDebug("Account ID = " << accountId); + LoggerD("Account ID = " << accountId); m_accountId = accountId; reload(); setMessageStatus(MESSAGE_STATUS_LOADED); } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogError("Exception: " << ex.DumpToString()); + LoggerE("Exception: " << ex.DumpToString()); } @@ -109,7 +109,7 @@ Email::Email(EmailAccountInfo& account) : IMessage(EMAIL) reload(); } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogError("Exception: " << ex.DumpToString()); + LoggerE("Exception: " << ex.DumpToString()); } LOG_EXIT @@ -128,7 +128,7 @@ Email::Email(const FolderType folder) : IMessage(EMAIL) } } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogError("Exception: " << ex.DumpToString()); + LoggerE("Exception: " << ex.DumpToString()); } LOG_EXIT @@ -136,7 +136,7 @@ Email::Email(const FolderType folder) : IMessage(EMAIL) Email::~Email() { - LogDebug("ENTER"); + LoggerD("ENTER"); } int Email::send() @@ -208,19 +208,19 @@ void Email::update(bool draftsOnly) int attachmentCount = 0; int error = email_get_attachment_data_list( m_mail->mail_id, &attachment, &attachmentCount); if (EMAIL_ERROR_NONE != error) { - LogWarning("Nothing to update or error. [" << error << "]"); + LoggerW("Nothing to update or error. [" << error << "]"); } error = email_update_mail( m_mail.Get(), attachment, attachmentCount, NULL, 0); if (EMAIL_ERROR_NONE != error) { - LogWarning("Nothing to update or error. [" << error << "]"); + LoggerW("Nothing to update or error. [" << error << "]"); } if (attachment) { error = email_free_attachment_data(&attachment, attachmentCount); if (EMAIL_ERROR_NONE != error) { - LogWarning("Nothing to update or error. [" << error << "]"); + LoggerW("Nothing to update or error. [" << error << "]"); } } @@ -312,7 +312,7 @@ void Email::moveToFolder(const string& newFolder) error = email_free_mailbox(&mailbox, 1); //free if (EMF_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); + LoggerE("Failed to destroy mailbox: " << error); } */ } @@ -396,7 +396,7 @@ void Email::create( EmailAccountInfo& account ) m_accountId = account.getIntId(); //MailSender::getInstance(); - LogDebug("account ID : " << m_accountId); + LoggerD("account ID : " << m_accountId); ScopedMail mail(EmailService::createMailData(account)); setEmailAccount(account); //save account @@ -414,7 +414,7 @@ void Email::reload() { LOG_ENTER - LogDebug("mail ID :" << getIntId()); + LoggerD("mail ID :" << getIntId()); m_mail.Reset(EmailService::readMail(getIntId())); //reset Mail Data readHeader(); @@ -531,7 +531,7 @@ void Email::readBody() { Assert(m_mail && "Body is NULL."); if (m_mail->file_path_plain) { - LogDebug("m_mail->file_path_plain : " << m_mail->file_path_plain); + LoggerD("m_mail->file_path_plain : " << m_mail->file_path_plain); DPL::ScopedFClose file(::fopen(m_mail->file_path_plain, "r")); if (!file) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -555,7 +555,7 @@ void Email::readBody() { //html body. if (m_mail->file_path_html) { - LogDebug("m_mail->file_path_html : " << m_mail->file_path_html); + LoggerD("m_mail->file_path_html : " << m_mail->file_path_html); DPL::ScopedFClose file(::fopen(m_mail->file_path_html, "r")); //auto close, scopedFClose if (!file) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -590,27 +590,27 @@ void Email::readBody() { if ( attachment && attachmentCount > 0) { - LogDebug("reading attachments , attahcment count = " << attachmentCount); + LoggerD("reading attachments , attahcment count = " << attachmentCount); int i = 0; for ( i = 0; i < attachmentCount; i++) { Try { - LogDebug("attachment ID :" << attachment[i].attachment_id << " name :" << attachment[i].attachment_name << " download :" << attachment[i].save_status << "savefile :" << attachment[i].attachment_path); - LogDebug("attachment inline status :" << attachment[i].inline_content_status); + LoggerD("attachment ID :" << attachment[i].attachment_id << " name :" << attachment[i].attachment_name << " download :" << attachment[i].save_status << "savefile :" << attachment[i].attachment_path); + LoggerD("attachment inline status :" << attachment[i].inline_content_status); IAttachmentPtr tmpAtt(new Attachment()); if (attachment[i].attachment_path) tmpAtt->init(attachment[i].attachment_path, false); if (tmpAtt) { - LogDebug("attachment[i].inline_content_status : " << attachment[i].inline_content_status); + LoggerD("attachment[i].inline_content_status : " << attachment[i].inline_content_status); tmpAtt->rename(std::string(attachment[i].attachment_name)); tmpAtt->setAttachmentID(attachment[i].attachment_id); tmpAtt->setDownloaded(attachment[i].save_status); tmpAtt->setIsInlineAttachment((bool)attachment[i].inline_content_status); tmpAtt->setNth(i+1); - LogDebug(" setNth(i+1) : " << i+1); + LoggerD(" setNth(i+1) : " << i+1); if(attachment[i].inline_content_status == 0) { appendAttachment(tmpAtt); @@ -620,13 +620,13 @@ void Email::readBody() { appendInlineAttachment(tmpAtt); } } - LogDebug(" append Attachment complete"); + LoggerD(" append Attachment complete"); } catch ( const WrtDeviceApis::Commons::Exception& ex ) { - LogError("Error while trying to append attachment " << attachment[i].attachment_path << ": " << ex.DumpToString()); + LoggerE("Error while trying to append attachment " << attachment[i].attachment_path << ": " << ex.DumpToString()); } } @@ -650,7 +650,7 @@ void Email::readInfo() if (!m_mail) { - LogDebug("m_mail is NULL"); + LoggerD("m_mail is NULL"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Info is NULL."); } @@ -674,11 +674,11 @@ void Email::updateBody() if (isBodyValid()) { return; } if (!m_mail) { - LogDebug("m_mail is NULL"); + LoggerD("m_mail is NULL"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Mail is NULL."); } if (!m_mail->file_path_plain) { - LogDebug("file_path_plain is NULL"); + LoggerD("file_path_plain is NULL"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Plain Body is NULL."); } @@ -686,14 +686,14 @@ void Email::updateBody() locationChecker = EmailUtils::isFrameworkEmailData(m_mail->file_path_plain); if(locationChecker == true) // already exist palin body file on email frame work, we can not update that file so make new temp file { - LogDebug("create new plain body"); + LoggerD("create new plain body"); char buf[] = "XXXXXX"; mode_t mask = umask(S_IWGRP | S_IWOTH); error = mkstemp(buf); umask(mask); std::string bodyFile = buf; bodyFile = EmailUtils::TMP_DIR_PREFIX+bodyFile; - LogDebug("bodyFile : " << bodyFile); + LoggerD("bodyFile : " << bodyFile); FILE* f = fopen(bodyFile.c_str(), "w"); if (NULL != f) { @@ -710,7 +710,7 @@ void Email::updateBody() } else { - LogDebug("Plain Body file open fail : " << m_mail->file_path_plain); + LoggerD("Plain Body file open fail : " << m_mail->file_path_plain); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Plain Body File Open Error"); } @@ -719,14 +719,14 @@ void Email::updateBody() locationChecker = EmailUtils::isFrameworkEmailData(m_mail->file_path_html); if((locationChecker == true) || (!m_mail->file_path_html)) // html file is not exist or exist on email frame work then create tmp html file { - LogDebug("create new html body"); + LoggerD("create new html body"); char buf[] = "XXXXXX"; mode_t mask = umask(S_IWGRP | S_IWOTH); error = mkstemp(buf); umask(mask); std::string htmlFile = buf; htmlFile = EmailUtils::TMP_DIR_PREFIX+htmlFile; - LogDebug("htmlFile : " << htmlFile); + LoggerD("htmlFile : " << htmlFile); FILE* f = fopen(htmlFile.c_str(), "w"); if (NULL != f) { @@ -754,7 +754,7 @@ void Email::updateBody() } else { - LogDebug("html Body file open fail : " << m_mail->file_path_html); + LoggerD("html Body file open fail : " << m_mail->file_path_html); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "html Body File Open Error"); } @@ -772,7 +772,7 @@ void Email::updateSubject() if (isSubjectValid()) { return; } - LogDebug("update subject, msgId=" << getIdRef()); + LoggerD("update subject, msgId=" << getIdRef()); if (!m_mail) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Mail not allocated."); @@ -790,7 +790,7 @@ void Email::updateReadStatus() if (isReadStatusValid()) { return; } - LogDebug("update read, msgId=" << getIdRef()); + LoggerD("update read, msgId=" << getIdRef()); if (!m_mail) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Mail not allocated."); @@ -826,10 +826,10 @@ void Email::updateMessage() ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Mail is NULL."); } - LogDebug("getCurrentFolder() = " << getCurrentFolder() ); - LogDebug("m_mail->mail_id = " << m_mail->mail_id ); - LogDebug("m_mail->file_path_plain = " << m_mail->file_path_plain ); - LogDebug("m_mail->file_path_html = " << m_mail->file_path_html ); + LoggerD("getCurrentFolder() = " << getCurrentFolder() ); + LoggerD("m_mail->mail_id = " << m_mail->mail_id ); + LoggerD("m_mail->file_path_plain = " << m_mail->file_path_plain ); + LoggerD("m_mail->file_path_html = " << m_mail->file_path_html ); if(getCurrentFolder() == DRAFTBOX) { @@ -847,17 +847,17 @@ void Email::updateMessage() int attachmentCount = 0; int error = email_get_attachment_data_list( m_mail->mail_id, &attachment, &attachmentCount); if (EMAIL_ERROR_NONE != error) { - LogWarning("email_get_attachment_data_list [" << error << "]"); + LoggerW("email_get_attachment_data_list [" << error << "]"); } error = email_get_meeting_request(m_mail->mail_id, &meeting_req); if (EMAIL_ERROR_NONE != error) { - LogWarning("email_get_meeting_request() failed [%d]\n" << error); + LoggerW("email_get_meeting_request() failed [%d]\n" << error); } error = email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0); if (EMAIL_ERROR_NONE != error) { - LogWarning("Nothing to update or error. [" << error << "]"); + LoggerW("Nothing to update or error. [" << error << "]"); } if(meeting_req) { @@ -868,7 +868,7 @@ void Email::updateMessage() { error = email_free_attachment_data(&attachment, attachmentCount); if (EMAIL_ERROR_NONE != error) { - LogWarning("email_free_attachment_data [" << error << "]"); + LoggerW("email_free_attachment_data [" << error << "]"); } } @@ -880,7 +880,7 @@ void Email::createSendMessage() LOG_ENTER MailSender::getInstance(); //start email service - LogDebug("getUID: " << getUID()); + LoggerD("getUID: " << getUID()); if ( getUID() > 0 && m_accountId > 0) { update(); @@ -891,7 +891,7 @@ void Email::createSendMessage() EmailAccountInfo account = getEmailAccount(); m_accountId = account.getIntId(); //set account ID - LogDebug("account ID : " << m_accountId); + LoggerD("account ID : " << m_accountId); m_mail.Reset(EmailService::createMailData(account)); updateSubject(); @@ -908,7 +908,7 @@ void Email::createSendMessage() } if ( mailbox->mailbox_id ) m_mail->mailbox_id = mailbox->mailbox_id; - LogDebug("mail MailBox id :" << m_mail->mailbox_id); + LoggerD("mail MailBox id :" << m_mail->mailbox_id); error = email_add_mail(m_mail.Get(), NULL, 0, NULL, 0); if (EMAIL_ERROR_NONE != error) { @@ -916,7 +916,7 @@ void Email::createSendMessage() "Couldn't add message to mailbox. [" << error << "]"); } - LogDebug("m_mail->mail_id =" << m_mail->mail_id); + LoggerD("m_mail->mail_id =" << m_mail->mail_id); setId(convertId(m_mail->mail_id)); setFolderType(OUTBOX); @@ -926,10 +926,10 @@ void Email::createSendMessage() error = email_free_mailbox(&mailbox, 1); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); + LoggerE("Failed to destroy mailbox: " << error); } - LogDebug("m_mail->from" << m_mail->full_address_from); + LoggerD("m_mail->from" << m_mail->full_address_from); email_mail_data_t* result = NULL; @@ -971,7 +971,7 @@ void Email::addMessageToDraft() MailSender::getInstance(); //start email service - LogDebug("getUID: " << getUID()); + LoggerD("getUID: " << getUID()); if ( getUID() > 0 && m_accountId > 0) { update(); @@ -982,7 +982,7 @@ void Email::addMessageToDraft() EmailAccountInfo account = getEmailAccount(); m_accountId = account.getIntId(); //set account ID - LogDebug("account ID : " << m_accountId); + LoggerD("account ID : " << m_accountId); m_mail.Reset(EmailService::createMailData(account)); updateSubject(); @@ -999,7 +999,7 @@ void Email::addMessageToDraft() } if ( mailbox->mailbox_id ) m_mail->mailbox_id = mailbox->mailbox_id; - LogDebug("mail MailBox id :" << m_mail->mailbox_id); + LoggerD("mail MailBox id :" << m_mail->mailbox_id); error = email_add_mail(m_mail.Get(), NULL, 0, NULL, 0); if (EMAIL_ERROR_NONE != error) { @@ -1007,7 +1007,7 @@ void Email::addMessageToDraft() "Couldn't add message to mailbox. [" << error << "]"); } - LogDebug("message id =" << m_mail->mail_id); + LoggerD("message id =" << m_mail->mail_id); setId(convertId(m_mail->mail_id)); setFolderType(DRAFTBOX); @@ -1017,10 +1017,10 @@ void Email::addMessageToDraft() error = email_free_mailbox(&mailbox, 1); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); + LoggerE("Failed to destroy mailbox: " << error); } - LogDebug("m_mail->from" << m_mail->full_address_from); + LoggerD("m_mail->from" << m_mail->full_address_from); email_mail_data_t* result = NULL; @@ -1134,8 +1134,8 @@ void Email::updateAttachments() Try { //clean attachment - LogDebug("update attachments, msgId=" << getIdRef()); - LogDebug("m_mail->mail_id=" << m_mail->mail_id); + LoggerD("update attachments, msgId=" << getIdRef()); + LoggerD("m_mail->mail_id=" << m_mail->mail_id); error = email_get_attachment_data_list( m_mail->mail_id, &attachment, &attachmentCount); //get Attachment list if (EMAIL_ERROR_NONE != error) { ThrowMsg( WrtDeviceApis::Commons::PlatformException, "Couldn't get attachment list: "); @@ -1149,17 +1149,17 @@ void Email::updateAttachments() if ( attachmentCount > 0 ) { - LogDebug("attachmentCount=" << attachmentCount); + LoggerD("attachmentCount=" << attachmentCount); int i = 0; std::stringstream stream; for ( i = 0; i < attachmentCount; i++) { - LogDebug("file name:" << attachment[i].attachment_name << " file path :" << attachment[i].attachment_path); + LoggerD("file name:" << attachment[i].attachment_name << " file path :" << attachment[i].attachment_path); int attachmentId = attachment[i].attachment_id; int error = email_delete_attachment(attachmentId); if (EMAIL_ERROR_NONE != error) { - LogDebug("Error Num = " << error); + LoggerD("Error Num = " << error); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Error while adding attachment. [" << error << "]"); } @@ -1180,7 +1180,7 @@ void Email::updateAttachments() std::size_t attachmentSize = getAttachmentsCount(); std::size_t inlineAttachmentSize = getInlineAttachmentsCount(); - LogDebug("update attachments, attachmentSize=" << attachmentSize); + LoggerD("update attachments, attachmentSize=" << attachmentSize); if (attachmentSize > 0) { email_attachment_data_t* attachment_info = NULL; @@ -1188,7 +1188,7 @@ void Email::updateAttachments() { IAttachmentPtr att = getAttachment(i); if (!att) { - LogDebug("skip att" << i); + LoggerD("skip att" << i); continue; } @@ -1210,16 +1210,16 @@ void Email::updateAttachments() attachment_info->save_status = true; attachment_info->inline_content_status = 0; - LogDebug("attachment_info->attachment_name=" << attachment_info->attachment_name); - LogDebug("attachment_info->attachment_path=" << attachment_info->attachment_path); - LogDebug("attachment_info->save_status=" << attachment_info->save_status); - LogDebug("attachment_info->inline_content_status=" << attachment_info->inline_content_status); + LoggerD("attachment_info->attachment_name=" << attachment_info->attachment_name); + LoggerD("attachment_info->attachment_path=" << attachment_info->attachment_path); + LoggerD("attachment_info->save_status=" << attachment_info->save_status); + LoggerD("attachment_info->inline_content_status=" << attachment_info->inline_content_status); - LogDebug("Copy Command=" << cp_cmd.str()); + LoggerD("Copy Command=" << cp_cmd.str()); if (EINA_TRUE != ecore_file_is_dir(att->getFullPath().c_str())) { - LogDebug("att->getFullPath().c_str()=" << att->getFullPath().c_str()); + LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str()); if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), buf)) { - LogDebug("buf=" << buf); + LoggerD("buf=" << buf); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to copy file"); } } @@ -1240,17 +1240,17 @@ void Email::updateAttachments() } */ - LogDebug("add Attachment"); + LoggerD("add Attachment"); int error = email_add_attachment(m_mail->mail_id, attachment_info); if (EMAIL_ERROR_NONE != error) { - LogDebug("error :" << error); + LoggerD("error :" << error); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Error while adding attachment. [" << error << "]"); } else { - LogDebug(" attachment id : " << attachment_info->attachment_id); - LogDebug(" attachment inline : " << attachment_info->inline_content_status); - LogDebug(" setNth(i+1) : " << i+1); + LoggerD(" attachment id : " << attachment_info->attachment_id); + LoggerD(" attachment inline : " << attachment_info->inline_content_status); + LoggerD(" setNth(i+1) : " << i+1); att->setDownloaded(true); att->setIsInlineAttachment(FALSE); att->setAttachmentID(attachment_info->attachment_id); @@ -1263,7 +1263,7 @@ void Email::updateAttachments() } } - LogDebug("update attachments, inlineAttachmentSize=" << inlineAttachmentSize); + LoggerD("update attachments, inlineAttachmentSize=" << inlineAttachmentSize); if (inlineAttachmentSize > 0) { email_attachment_data_t* attachment_info = NULL; @@ -1291,13 +1291,13 @@ void Email::updateAttachments() attachment_info->attachment_path = String::strdup( buf ); attachment_info->save_status = true; attachment_info->inline_content_status = 1; - LogDebug("attachment_info->inline_content_status=" << attachment_info->inline_content_status); + LoggerD("attachment_info->inline_content_status=" << attachment_info->inline_content_status); - LogDebug("Copy Command=" << cp_cmd.str()); + LoggerD("Copy Command=" << cp_cmd.str()); if (EINA_TRUE != ecore_file_is_dir(att->getFullPath().c_str())) { - LogDebug("att->getFullPath().c_str()=" << att->getFullPath().c_str()); + LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str()); if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), buf)) { - LogDebug("buf=" << buf); + LoggerD("buf=" << buf); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to copy file"); } } @@ -1319,7 +1319,7 @@ void Email::updateAttachments() */ - LogDebug("add Attachment"); + LoggerD("add Attachment"); int error = email_add_attachment(m_mail->mail_id, attachment_info); if (EMAIL_ERROR_NONE != error) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -1327,9 +1327,9 @@ void Email::updateAttachments() } else { - LogDebug(" attachment id : " << attachment_info->attachment_id); - LogDebug(" attachment inline : " << attachment_info->inline_content_status); - LogDebug(" setNth(i+(int)attachmentSize+1) : " << i+(int)attachmentSize+1); + LoggerD(" attachment id : " << attachment_info->attachment_id); + LoggerD(" attachment inline : " << attachment_info->inline_content_status); + LoggerD(" setNth(i+(int)attachmentSize+1) : " << i+(int)attachmentSize+1); att->setDownloaded(true); att->setIsInlineAttachment(TRUE); att->setAttachmentID(attachment_info->attachment_id); diff --git a/src/Messaging/EmailConverter.cpp b/src/Messaging/EmailConverter.cpp index 4177de3..0125370 100644 --- a/src/Messaging/EmailConverter.cpp +++ b/src/Messaging/EmailConverter.cpp @@ -15,14 +15,12 @@ // limitations under the License. // -#include - #include - #include "EmailConverter.h" +#include -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); +#define LOG_ENTER LoggerD("---> ENTER"); +#define LOG_EXIT LoggerD("---> EXIT"); namespace DeviceAPI { namespace Messaging { @@ -51,7 +49,7 @@ MessagePriority::Priority toMessagePriority(email_mail_priority_t priority) // TODO Think it through, log is enough or exception should be thrown. // ThrowMsg(WrtDeviceApis::Commons::PlatformException, // "Unsupported platform priority: " << priority); - LogWarning("Unsupported platform priority"); + LoggerW("Unsupported platform priority"); } } diff --git a/src/Messaging/EmailService.cpp b/src/Messaging/EmailService.cpp index 1ddba6a..adbf93c 100644 --- a/src/Messaging/EmailService.cpp +++ b/src/Messaging/EmailService.cpp @@ -29,8 +29,8 @@ #include "ScopedMail.h" #include "ScopedMailbox.h" -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); +#define LOG_ENTER LoggerD("---> ENTER"); +#define LOG_EXIT LoggerD("---> EXIT"); namespace DeviceAPI { namespace Messaging { @@ -55,7 +55,7 @@ email_mail_data_t* createMailData(const EmailAccountInfo& account) umask(mask); std::string bodyFile = buf; bodyFile = EmailUtils::TMP_DIR_PREFIX+bodyFile; - LogDebug("bodyFile : " << bodyFile); + LoggerD("bodyFile : " << bodyFile); FILE* f = fopen(bodyFile.c_str(), "w"); if (NULL != f) { @@ -152,11 +152,11 @@ int addMail(email_mail_data_t* mail, email_attachment_data_t* attachment) // if ( mailbox->mailbox_name ) // mail->mailbox_name = strdup(mailbox->mailbox_name); -// LogDebug("mail MailBox Name :" << mail->mailbox_name); +// LoggerD("mail MailBox Name :" << mail->mailbox_name); error = email_free_mailbox(&mailbox, 1); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); + LoggerE("Failed to destroy mailbox: " << error); } } } @@ -168,7 +168,7 @@ int addMail(email_mail_data_t* mail, email_attachment_data_t* attachment) } LOG_EXIT - LogDebug("Mail to MailBox, mail id = " << mail->mail_id ); + LoggerD("Mail to MailBox, mail id = " << mail->mail_id ); return mail->mail_id; } @@ -186,7 +186,7 @@ int addMailToMailbox(email_mail_data_t* mail, } LOG_EXIT - LogDebug("Mail to MailBox, mail id = " << mail->mail_id ); + LoggerD("Mail to MailBox, mail id = " << mail->mail_id ); return mail->mail_id; } #endif @@ -198,7 +198,7 @@ void freeAttachment(email_attachment_data_t* attachment) int error = email_free_attachment_data(&attachment, 1); if (EMAIL_ERROR_NONE != error) { - LogWarning("Couldn't free attachment. [" << error << "]"); + LoggerW("Couldn't free attachment. [" << error << "]"); } LOG_EXIT } @@ -290,16 +290,16 @@ void updateSeenFlag(int accountId, int mailId, bool isReadChangeStatus) if (EMAIL_ERROR_NONE != email_set_flags_field(accountId, &mailId, 0, EMAIL_FLAGS_SEEN_FIELD, isReadChangeStatus, 1) ) { - LogWarning("email_modify_seen_flag failed\n"); + LoggerW("email_modify_seen_flag failed\n"); } else { - LogWarning("email_modify_seen_flag SUCCESS\n"); + LoggerW("email_modify_seen_flag SUCCESS\n"); } } else { - LogWarning("Invaild Account ID\n"); + LoggerW("Invaild Account ID\n"); } LOG_EXIT diff --git a/src/Messaging/EmailUtils.cpp b/src/Messaging/EmailUtils.cpp old mode 100755 new mode 100644 index 8e8c9b6..f13f911 --- a/src/Messaging/EmailUtils.cpp +++ b/src/Messaging/EmailUtils.cpp @@ -17,13 +17,12 @@ #include #include - #include #include #include #include "EmailUtils.h" -#include #include +#include using namespace WrtDeviceApis::Commons; @@ -97,11 +96,11 @@ bool isFrameworkEmailData(char* filePath) if(filePath == NULL) { - LogDebug("filePath is NULL"); + LoggerD("filePath is NULL"); return false; } - LogDebug("filePath : " << filePath); + LoggerD("filePath : " << filePath); tempString1.assign(filePath); tempString2.assign(EMAIL_DATA_FILE_PATH); @@ -111,11 +110,11 @@ bool isFrameworkEmailData(char* filePath) if(tempString1.compare(0,tempString2.size(), tempString2) == 0) { - LogDebug("email frame work files"); + LoggerD("email frame work files"); return true; } else{ - LogDebug("tmp files"); + LoggerD("tmp files"); return false; } diff --git a/src/Messaging/EmptyMessage.cpp b/src/Messaging/EmptyMessage.cpp index 81e4b6f..61f2524 100644 --- a/src/Messaging/EmptyMessage.cpp +++ b/src/Messaging/EmptyMessage.cpp @@ -16,7 +16,6 @@ // #include "EmptyMessage.h" -#include //#include //#include "ReqReceiverMessage.h> #include "Messaging.h" @@ -28,6 +27,8 @@ extern "C" { //#include } +#include + using namespace std; namespace DeviceAPI { @@ -37,14 +38,14 @@ EmptyMessage::EmptyMessage(const string& id) : IMessage(EMPTY_MESSAGE, id), m_messageData(NULL) { - LogDebug("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("enter"); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); } EmptyMessage::~EmptyMessage() { - LogDebug("enter"); + LoggerD("enter"); if (m_messageData) { // release platform message structure @@ -55,7 +56,7 @@ EmptyMessage::~EmptyMessage() void EmptyMessage::update(bool /*draftsOnly*/) { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); } void EmptyMessage::readAllData() diff --git a/src/Messaging/FolderFilterValidator.cpp b/src/Messaging/FolderFilterValidator.cpp index 9462000..8fda9dd 100644 --- a/src/Messaging/FolderFilterValidator.cpp +++ b/src/Messaging/FolderFilterValidator.cpp @@ -17,9 +17,8 @@ #include "FolderFilterValidator.h" #include "FolderFilterValidatorFactory.h" - -#include #include "log.h" +#include using namespace DeviceAPI::Tizen; @@ -99,20 +98,20 @@ namespace DeviceAPI { MsgLogWanning(">>>[Warning] attrName:[" << attrName << "] is invalid value:[" << matchValue->toString() << "]"); return false; } - LogDebug("## 001 ##"); + LoggerD("## 001 ##"); retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue, depth); - LogDebug("## 002 ##"); - LogDebug(">>> retBool:" << retBool); + LoggerD("## 002 ##"); + LoggerD(">>> retBool:" << retBool); return retBool; } bool FolderFilterValidator::validateAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); if(attrName.compare(FolderFilterValidatorFactory::ATTRIBUTE_ACCOUNTID)==0){ - LogDebug("<<< m_isAccountIdSetted :[" << m_isAccountIdSetted << "]"); + LoggerD("<<< m_isAccountIdSetted :[" << m_isAccountIdSetted << "]"); if(m_isAccountIdSetted == true){ - LogError(">>> [ERROR] duplicated account :[" << attrName << "], value:[" << + LoggerE(">>> [ERROR] duplicated account :[" << attrName << "], value:[" << value->toString()<< "]"); return false; }else{ diff --git a/src/Messaging/FolderQueryGenerator.cpp b/src/Messaging/FolderQueryGenerator.cpp old mode 100755 new mode 100644 index 9eb17e6..bea8e4f --- a/src/Messaging/FolderQueryGenerator.cpp +++ b/src/Messaging/FolderQueryGenerator.cpp @@ -18,14 +18,11 @@ #include "FolderQueryGenerator.h" #include "FolderFilterValidatorFactory.h" #include "ConversationFilterValidatorFactory.h" - #include "IMessagingTypes.h" #include "log.h" #include - #include - -#include +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -49,21 +46,21 @@ namespace DeviceAPI { void FolderQueryGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); } void FolderQueryGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(type != INTERSECTION_FILTER){ - LogError("[ERROR] >>> invalid Filter type:" << type); + LoggerE("[ERROR] >>> invalid Filter type:" << type); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid Fiilter Type"); return; } } void FolderQueryGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); } bool FolderQueryGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value) @@ -87,60 +84,60 @@ namespace DeviceAPI { std::string FolderQueryGenerator::getMatchStartsWithClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value){ std::string retClause; - LogDebug("<<< NOT IMPLEMENTED YET"); + LoggerD("<<< NOT IMPLEMENTED YET"); return retClause; } std::string FolderQueryGenerator::getMatchEndsWithClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value){ std::string retClause; - LogDebug("<<< NOT IMPLEMENTED YET"); + LoggerD("<<< NOT IMPLEMENTED YET"); return retClause; } std::string FolderQueryGenerator::getMatchContainsClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value){ std::string retClause; - LogDebug("<<< NOT IMPLEMENTED YET"); + LoggerD("<<< NOT IMPLEMENTED YET"); return retClause; } void FolderQueryGenerator::visitAttribute(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth){ - LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); + LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); if(matchValue == NULL) return; - LogDebug("matchValue:" << matchValue->toString()); + LoggerD("matchValue:" << matchValue->toString()); visitAttributeEach(attrName, matchFlag, matchValue, depth); - LogDebug(">>>"); + LoggerD(">>>"); } void FolderQueryGenerator::visitAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){ - LogDebug("STRING_MATCH_EXACTLY"); + LoggerD("STRING_MATCH_EXACTLY"); getMatchExactlyClause(attrName, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){ - LogDebug("STRING_MATCH_CONTAINS"); + LoggerD("STRING_MATCH_CONTAINS"); getMatchContainsClause(attrName, value); }else if(matchFlag== DeviceAPI::Tizen::MATCH_STARTSWITH){ - LogDebug("STRING_MATCH_STARTSWITH"); + LoggerD("STRING_MATCH_STARTSWITH"); getMatchStartsWithClause(attrName, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){ - LogDebug("STRING_MATCH_ENDSWITH"); + LoggerD("STRING_MATCH_ENDSWITH"); getMatchEndsWithClause(attrName, value); }else{ - LogDebug("[ERROR]invalid match flag[" << matchFlag << "]"); + LoggerD("[ERROR]invalid match flag[" << matchFlag << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "invalid match flag:[" << matchFlag << "]"); } - LogDebug(">>>"); + LoggerD(">>>"); } void FolderQueryGenerator::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth) { - LogDebug("<<< NOT IMPLEMENTED YET"); + LoggerD("<<< NOT IMPLEMENTED YET"); } int FolderQueryGenerator::getAccountId() @@ -155,7 +152,7 @@ namespace DeviceAPI { bool FolderQueryGenerator::isFolderPathExist() { - LogError("m_folderPathProcessing : " << m_folderPathProcessing); + LoggerE("m_folderPathProcessing : " << m_folderPathProcessing); return m_folderPathProcessing; } diff --git a/src/Messaging/IAttachment.cpp b/src/Messaging/IAttachment.cpp old mode 100755 new mode 100644 index dd80d23..20028b6 --- a/src/Messaging/IAttachment.cpp +++ b/src/Messaging/IAttachment.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include "IAttachment.h" @@ -26,6 +25,8 @@ extern "C" { #include } +#include + using namespace WrtDeviceApis::Commons; using namespace std; @@ -47,20 +48,20 @@ void IAttachment::init(const string& fullPath, { struct stat buffer; std::string l_fullPath; - LogDebug("FULL Path : " << fullPath); + LoggerD("FULL Path : " << fullPath); if (isVirtualPath) { - LogDebug("translating path"); + LoggerD("translating path"); l_fullPath = getRealPath(fullPath); } else { l_fullPath = fullPath; } - LogDebug("real path " << l_fullPath); + LoggerD("real path " << l_fullPath); char buff[PATH_MAX + 1]; if ((NULL == realpath(l_fullPath.c_str(), buff)) || (l_fullPath.size() > PATH_MAX + 1)) { std::string errnoString = DPL::GetErrnoString(); - LogError("get full path problem " << errnoString); + LoggerE("get full path problem " << errnoString); m_fileSize = 0; m_attachFullPath = ""; m_attachShortName = ""; @@ -70,12 +71,12 @@ void IAttachment::init(const string& fullPath, else { if (-1 == lstat(buff, &buffer)) { - LogError("Attachment file not exist"); + LoggerE("Attachment file not exist"); m_validAttachment = false; } if (!S_ISREG(buffer.st_mode)) { - LogError("Attachment file not exist"); + LoggerE("Attachment file not exist"); m_validAttachment = false; } m_fileSize = buffer.st_size; @@ -86,14 +87,14 @@ void IAttachment::init(const string& fullPath, } } Catch(WrtDeviceApis::Commons::Exception) { - LogError("attachment not created properly"); + LoggerE("attachment not created properly"); m_isCreatedProperly = false; } } IAttachment::~IAttachment() { - LogDebug("enter"); + LoggerD("enter"); } string IAttachment::getShortName() const @@ -128,13 +129,13 @@ void IAttachment::setDummyFilePath(const std::string& dummyFilePath) char buff[PATH_MAX + 1]; if ( NULL != realpath(m_dummyFilePath.c_str(), buff)) { - LogDebug("dummy File is valided " << m_dummyFilePath); + LoggerD("dummy File is valided " << m_dummyFilePath); m_hasDummyFile = true; } else { std::string errnoString = DPL::GetErrnoString(); - LogError("get full path problem " << errnoString); + LoggerE("get full path problem " << errnoString); m_hasDummyFile = false; } @@ -212,7 +213,7 @@ bool IAttachment::getIsCreatedProperly() const bool IAttachment::getIsValidAttachment() const { - LogError("m_validAttachment : " << m_validAttachment); + LoggerE("m_validAttachment : " << m_validAttachment); return m_validAttachment; } @@ -229,7 +230,7 @@ void IAttachment::makeShortName() // find position of last occurence of / sign (get only file name from all path pos = m_attachFullPath.find_last_of("/"); if ((pos + 1) >= m_attachFullPath.size()) { - LogError("Problem with short name creation"); + LoggerE("Problem with short name creation"); Throw(InvalidArgumentException); } m_attachShortName = m_attachFullPath.substr(pos + 1); diff --git a/src/Messaging/IBinarySms.cpp b/src/Messaging/IBinarySms.cpp old mode 100755 new mode 100644 index d4fa6ae..8010fad --- a/src/Messaging/IBinarySms.cpp +++ b/src/Messaging/IBinarySms.cpp @@ -16,7 +16,7 @@ // #include "IBinarySms.h" -#include +#include namespace DeviceAPI { namespace Messaging { @@ -24,12 +24,12 @@ namespace Messaging { IBinarySms::IBinarySms(const std::string& id) : IMessage(BINARYSMS, id) { - LogDebug("enter"); + LoggerD("enter"); } IBinarySms::~IBinarySms() { - LogDebug("enter"); + LoggerD("enter"); } } } diff --git a/src/Messaging/IEmail.cpp b/src/Messaging/IEmail.cpp old mode 100755 new mode 100644 index c3dccd9..e7b38cb --- a/src/Messaging/IEmail.cpp +++ b/src/Messaging/IEmail.cpp @@ -16,7 +16,7 @@ // #include "IEmail.h" -#include +#include using namespace std; @@ -25,12 +25,12 @@ namespace Messaging { IEmail::IEmail(const string& id) : IMessage(EMAIL, id) { - LogInfo("enter"); + LoggerI("enter"); } IEmail::~IEmail() { - LogInfo("enter"); + LoggerI("enter"); } IEmail & IEmail::operator <<(const VirtualMessage& msg) diff --git a/src/Messaging/IEmptyMessage.cpp b/src/Messaging/IEmptyMessage.cpp index 4822c7a..3279058 100644 --- a/src/Messaging/IEmptyMessage.cpp +++ b/src/Messaging/IEmptyMessage.cpp @@ -16,7 +16,7 @@ // #include "IEmptyMessage.h" -#include +#include using namespace std; @@ -26,12 +26,12 @@ namespace Messaging { IEmptyMessage::IEmptyMessage(const string& id) : IMessage(SMS, id) { - LogInfo("enter"); + LoggerI("enter"); } IEmptyMessage::~IEmptyMessage() { - LogInfo("enter"); + LoggerI("enter"); } } diff --git a/src/Messaging/IMessage.cpp b/src/Messaging/IMessage.cpp old mode 100755 new mode 100644 index 9f51f8d..3d7a495 --- a/src/Messaging/IMessage.cpp +++ b/src/Messaging/IMessage.cpp @@ -16,11 +16,11 @@ // #include -#include #include #include "IMessage.h" #include "EventSendMessage.h" #include "EventMessagingService.h" +#include using namespace std; @@ -40,7 +40,7 @@ IMessage::IMessage(const MessageType msgType, m_requestReceiver(NULL), m_sendMessageEvent(NULL) { - LogDebug("message creation, msgId=" << m_id << ", msgType=" << m_msgType); + LoggerD("message creation, msgId=" << m_id << ", msgType=" << m_msgType); //initialize dateTime of message time_t rawtime; @@ -49,13 +49,13 @@ IMessage::IMessage(const MessageType msgType, if (local) { m_dateTime = *local; } else { - LogError("Failed to initialize message dateTime"); + LoggerE("Failed to initialize message dateTime"); } } IMessage::~IMessage() { - LogDebug("destroying message, msgId=" << m_id << ", msgType=" << m_msgType); + LoggerD("destroying message, msgId=" << m_id << ", msgType=" << m_msgType); } string IMessage::getId() const @@ -177,7 +177,7 @@ void IMessage::setFolderType(FolderType folder) string IMessage::getCurrentUserFolder() const { if (m_folder != USERDEFINED_FOLDER) { - LogError("folder is not user folder type"); + LoggerE("folder is not user folder type"); Throw(WrtDeviceApis::Commons::UnknownException); } return m_userFolderName; @@ -190,26 +190,26 @@ void IMessage::setCurrentUserFolder(const std::string& arg) bool IMessage::validatePhoneNumber(std::string& number) { - LogDebug("testing number=" << number); + LoggerD("testing number=" << number); return true; /* pcrecpp::RE re("[^0-9#\\+\\*]?"); re.GlobalReplace("", &number); //remove invailde phone number. phone Number were composed only number. if (number.empty()) { - LogError("wrong phoneNumber=" << number); + LoggerE("wrong phoneNumber=" << number); return false; } - LogDebug("phoneNumber=" << number); + LoggerD("phoneNumber=" << number); pcrecpp::RE re2("^[+#]?[0-9]{1,22}$"); if (re2.FullMatch(number)) { - LogDebug("vaildate Number=" << number); + LoggerD("vaildate Number=" << number); return true; } else { - LogDebug("invaildate Number=" << number); + LoggerD("invaildate Number=" << number); return false; } */ @@ -219,7 +219,7 @@ bool IMessage::validateEmailAddr(const Recipients& addr) { for (size_t i = 0; i < addr.getRecipientSize(); i++) { if (false == validateEmailAddr(addr.getRecipient(i))) { - LogError("wrong email address"); + LoggerE("wrong email address"); return false; } } @@ -237,10 +237,10 @@ bool IMessage::validateEmailAddr(const std::string& email) ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$" ); if (re.FullMatch(email)) { - LogDebug("emailAddress=" << email); + LoggerD("emailAddress=" << email); return true; } - LogError("wrong emailAddress=" << email); + LoggerE("wrong emailAddress=" << email); return false; } @@ -286,7 +286,7 @@ ReqReceiverMessage* IMessage::getRequestReceiver() const void IMessage::setMessageStatus( MessageStatus status) { - LogDebug("setMessageStatus : " << status); + LoggerD("setMessageStatus : " << status); m_msgStatus = status; } diff --git a/src/Messaging/IMessagingService.cpp b/src/Messaging/IMessagingService.cpp old mode 100755 new mode 100644 index daeaa04..e7c6902 --- a/src/Messaging/IMessagingService.cpp +++ b/src/Messaging/IMessagingService.cpp @@ -18,6 +18,7 @@ #include "IMessagingService.h" #include "EventGetMessagingService.h" #include "EventMessagingService.h" +#include using namespace WrtDeviceApis::Commons; @@ -27,12 +28,12 @@ namespace Messaging{ IMessagingService::IMessagingService() : m_messagingServiceType(-1) { - LogDebug("create IMessagingService"); + LoggerD("create IMessagingService"); } IMessagingService::~IMessagingService() { - LogDebug("destory IMessagingService"); + LoggerD("destory IMessagingService"); } void IMessagingService::setMessagingServiceEvent(const EventMessagingServicePtr &event) @@ -47,10 +48,10 @@ EventMessagingServicePtr IMessagingService::getMessagingServiceEvent() const void IMessagingService::OnCancelEvent(const EventMessagingServicePtr &event) { - LogDebug("<<<<<<<<<<<<<<<<< OnCancelEvent >>>>>>>>>>>>>>>>>>>>>> " ); - LogDebug(" OpID " << event->opId); - LogDebug(" Handle " << event->getHandle()); - LogDebug(" event Type " << event->getEventType()); + LoggerD("<<<<<<<<<<<<<<<<< OnCancelEvent >>>>>>>>>>>>>>>>>>>>>> " ); + LoggerD(" OpID " << event->opId); + LoggerD(" Handle " << event->getHandle()); + LoggerD(" event Type " << event->getEventType()); cancelOperation(event->opId, event->getHandle(), event->getEventType(), event->m_message); return; } diff --git a/src/Messaging/IMessagingService.h b/src/Messaging/IMessagingService.h index 98e77b5..044c27d 100755 --- a/src/Messaging/IMessagingService.h +++ b/src/Messaging/IMessagingService.h @@ -19,7 +19,6 @@ #ifndef WRTPLUGINS_API_IMESSAGING_SERVICE_H_ #define WRTPLUGINS_API_IMESSAGING_SERVICE_H_ -#include #include "IMessagingTypes.h" #include #include diff --git a/src/Messaging/IMessagingServiceManager.h b/src/Messaging/IMessagingServiceManager.h index 5958013..bb9bb5b 100755 --- a/src/Messaging/IMessagingServiceManager.h +++ b/src/Messaging/IMessagingServiceManager.h @@ -19,7 +19,6 @@ #define WRTPLUGINS_API_IMESSAGING_SERVICE_MANAGER_H_ #include -#include #include "IMessagingTypes.h" #include diff --git a/src/Messaging/IMms.cpp b/src/Messaging/IMms.cpp old mode 100755 new mode 100644 index 4a99d69..726ab0e --- a/src/Messaging/IMms.cpp +++ b/src/Messaging/IMms.cpp @@ -17,7 +17,7 @@ #include "IMms.h" #include "ValidityPeriodHours.h" -#include +#include using namespace std; @@ -28,12 +28,12 @@ IMms::IMms(const string& id) : IMessage(MMS, id), m_mmsType(MULTIPART_MIXED) { - LogInfo("enter"); + LoggerI("enter"); } IMms::~IMms() { - LogInfo("enter"); + LoggerI("enter"); } IMms::MMSType IMms::getMmsType() const diff --git a/src/Messaging/ISms.cpp b/src/Messaging/ISms.cpp old mode 100755 new mode 100644 index b993f6d..13ee5b7 --- a/src/Messaging/ISms.cpp +++ b/src/Messaging/ISms.cpp @@ -16,7 +16,7 @@ // #include "ISms.h" -#include +#include using namespace std; @@ -26,12 +26,12 @@ namespace Messaging { ISms::ISms(const string& id) : IMessage(SMS, id) { - LogInfo("enter"); + LoggerI("enter"); } ISms::~ISms() { - LogInfo("enter"); + LoggerI("enter"); } ISms & ISms::operator <<(const VirtualMessage& msg) diff --git a/src/Messaging/JSConversation.cpp b/src/Messaging/JSConversation.cpp old mode 100755 new mode 100644 index 04aa758..47eacd2 --- a/src/Messaging/JSConversation.cpp +++ b/src/Messaging/JSConversation.cpp @@ -28,6 +28,7 @@ #include "ConverterMessage.h" #include +#include using namespace std; @@ -113,16 +114,16 @@ JSClassRef JSConversation::m_jsClassRef = JSClassCreate(JSConversation::getClass void JSConversation::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("JSConversation::initialize "); + LoggerD("JSConversation::initialize "); JSConversationPriv* priv = static_cast(JSObjectGetPrivate(object)); ; if (priv == NULL) { - LogDebug("Private data is null "); + LoggerD("Private data is null "); } else { - LogDebug("JSConversation::already exist "); + LoggerD("JSConversation::already exist "); } } @@ -137,7 +138,7 @@ JSObjectRef JSConversation::createJSObject(JSContextRef context, IConversationPt void JSConversation::finalize(JSObjectRef object) { JSConversationPriv* priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("JSConversation::Finalize"); + LoggerD("JSConversation::Finalize"); if (priv != NULL) { @@ -156,7 +157,7 @@ JSValueRef JSConversation::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("OK"); + LoggerD("OK"); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); // WrtDeviceApis::CommonsJavaScript::Converter converter(context); @@ -230,7 +231,7 @@ JSValueRef JSConversation::getProperty(JSContextRef context, } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); return JSValueMakeUndefined(context); } return NULL; @@ -242,7 +243,7 @@ bool JSConversation::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); if (JSStringIsEqualToUTF8CString(propertyName, CONVID)) { return true; @@ -278,7 +279,7 @@ void JSConversation::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogDebug("Entered"); + LoggerD("Entered"); JSStringRef propertyName = NULL; propertyName = JSStringCreateWithUTF8CString(CONVID); diff --git a/src/Messaging/JSMessage.cpp b/src/Messaging/JSMessage.cpp index 91fe7ae..e12ae06 100644 --- a/src/Messaging/JSMessage.cpp +++ b/src/Messaging/JSMessage.cpp @@ -128,14 +128,14 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, const std::string& msgId) { IMessagePtr msg; - LogDebug("createJSObject with account "); + LoggerD("createJSObject with account "); Try { if (msgType == EMAIL) { - LogDebug("Account Address:" << &account); - LogDebug("Account Data ,ID" << account.getId() << "name:" << account.getName() << " Account:" << account.getAddress()); + LoggerD("Account Address:" << &account); + LoggerD("Account Data ,ID" << account.getId() << "name:" << account.getName() << " Account:" << account.getAddress()); msg = MessageFactory::createMessage(msgType, account, msgId); if (!msg) @@ -147,7 +147,7 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, } } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("wrong message type, object not created"); + LoggerE("wrong message type, object not created"); return JSValueMakeUndefined(context); } @@ -175,7 +175,7 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, } } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("wrong message type, object not created"); + LoggerE("wrong message type, object not created"); return JSValueMakeUndefined(context); } return createJSObject(context, msg, listener); @@ -191,7 +191,7 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, JSObjectRef jsValueRef = JSObjectMake(context, jsClassRef, static_cast(priv)); JSClassRelease(jsClassRef); if (NULL == jsValueRef) { - LogError("object creation error"); + LoggerE("object creation error"); return JSValueMakeUndefined(context); } return jsValueRef; @@ -200,17 +200,17 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, JSValueRef JSMessage::createJSObject(JSContextRef context, const IMessagePtr& msg) { - LogDebug("createJSObject"); + LoggerD("createJSObject"); JSClassRef jsClassRef = JSClassCreate(getClassInfo()); - LogDebug("jsClassRef success"); + LoggerD("jsClassRef success"); JSMessagePrivateObject* priv = new JSMessagePrivateObject(context, msg); - LogDebug("priv success"); + LoggerD("priv success"); JSObjectRef jsValueRef = JSObjectMake(context, jsClassRef, static_cast(priv)); - LogDebug("JSObjectMake success"); + LoggerD("JSObjectMake success"); JSClassRelease(jsClassRef); if (NULL == jsValueRef) { - LogError("object creation error"); + LoggerE("object creation error"); return JSValueMakeUndefined(context); } return jsValueRef; @@ -234,7 +234,7 @@ JSValueRef JSMessage::createJSObject(JSContextRef context, } } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("wrong message type, object not created"); + LoggerE("wrong message type, object not created"); return JSValueMakeUndefined(context); } return createJSObject(context, msg, NULL); @@ -250,7 +250,7 @@ JSValueRef JSMessage::createDummyMessageJSObject(JSContextRef context, } else { - LogError("message type is invalid"); + LoggerE("message type is invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } return createJSObject(context, msg); @@ -259,7 +259,7 @@ JSValueRef JSMessage::createDummyMessageJSObject(JSContextRef context, void JSMessage::initialize(JSContextRef context, JSObjectRef object) { - LogInfo("enter"); + LoggerI("enter"); if (!JSObjectGetPrivate(object)) { @@ -267,7 +267,7 @@ void JSMessage::initialize(JSContextRef context, JSMessagePrivateObject *priv = new JSMessagePrivateObject(context, msg); if (!JSObjectSetPrivate(object, priv)) { - LogInfo("set Private Failed..."); + LoggerI("set Private Failed..."); delete priv; } } @@ -277,7 +277,7 @@ void JSMessage::finalize(JSObjectRef object) { JSMessagePrivateObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("deleting private object"); + LoggerD("deleting private object"); delete priv; JSObjectSetPrivate(object, NULL); } @@ -295,7 +295,7 @@ JSValueRef JSMessage::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("Main getProperty()"); + LoggerI("Main getProperty()"); int index = 0; // for non-NULL property names while(m_property[index].name != NULL) { @@ -320,7 +320,7 @@ bool JSMessage::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogInfo("Main setProperty()"); + LoggerI("Main setProperty()"); int index = 0; // for non-NULL property names while(m_property[index].name != NULL) { @@ -344,7 +344,7 @@ bool JSMessage::deleteProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); return true; } @@ -352,13 +352,13 @@ void JSMessage::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogInfo("enter"); + LoggerI("enter"); JSStringRef propertyName = NULL; int index = 0; // repeat for each declared property - until null on property name while(m_property[index].name != NULL) { - LogDebug("Property: " << m_property[index].name); + LoggerD("Property: " << m_property[index].name); propertyName = JSStringCreateWithUTF8CString(m_property[index].name); JSPropertyNameAccumulatorAddName(propertyNames, propertyName); JSStringRelease(propertyName); @@ -373,7 +373,7 @@ JSValueRef JSMessage::callAsFunction(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); return JSValueMakeUndefined(context); } @@ -382,7 +382,7 @@ bool JSMessage::hasInstance(JSContextRef context, JSValueRef possibleInstance, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); return true; } @@ -392,7 +392,7 @@ JSObjectRef JSMessage::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { ArgumentValidator validator(context, argumentCount, arguments); @@ -414,18 +414,18 @@ JSObjectRef JSMessage::constructor(JSContextRef context, else { // this should never happen - message type checking done in stringToMessageType() - LogError("message type is invalid"); + LoggerE("message type is invalid"); throw TypeMismatchException("Invalid message type"); } if (msg == NULL) { - LogDebug("Message Creation failed"); + LoggerD("Message Creation failed"); throw DeviceAPI::Common::UnknownException("Message has been not created"); } if (dictionary != NULL) { - LogDebug ("##### msg type is " << msgType); + LoggerD ("##### msg type is " << msgType); JSValueRef subjectData = JSUtil::getProperty(context, dictionary, MESSAGE_ATTRIBUTE_SUBJECT); JSValueRef toData = JSUtil::getProperty(context, dictionary, MESSAGE_ATTRIBUTE_TO); @@ -439,7 +439,7 @@ JSObjectRef JSMessage::constructor(JSContextRef context, if (!JSValueIsUndefined(context, subjectData) ) { std::string subject = JSUtil::JSValueToString(context, subjectData); - LogDebug (" Subject : " << subject); + LoggerD (" Subject : " << subject); switch (msgType) { case MMS: @@ -456,7 +456,7 @@ JSObjectRef JSMessage::constructor(JSContextRef context, } default: { - LogError("message not supported"); + LoggerE("message not supported"); //Throw(WrtDeviceApis::Commons::UnsupportedException); //break; } @@ -466,7 +466,7 @@ JSObjectRef JSMessage::constructor(JSContextRef context, if (!JSValueIsUndefined(context, toData) ) { Recipients to = converter->toRecipients(toData); - LogDebug("setting to field, size=" << to.getRecipientSize()); + LoggerD("setting to field, size=" << to.getRecipientSize()); msg->setToRecipients(to); } //cc @@ -488,7 +488,7 @@ JSObjectRef JSMessage::constructor(JSContextRef context, if (!JSValueIsUndefined(context, htmlBodyData)) { std::string body = JSUtil::JSValueToString(context, htmlBodyData); - LogDebug("html body : " << body); + LoggerD("html body : " << body); email->setHtmlBody(body); } @@ -500,28 +500,28 @@ JSObjectRef JSMessage::constructor(JSContextRef context, if (!JSValueIsUndefined(context, plainBodyData) ) { std::string body = JSUtil::JSValueToString(context, plainBodyData); - LogDebug("plain body : " << body); + LoggerD("plain body : " << body); msg->setBody(body); } } //return JSClassRef jsClassRef = JSClassCreate(JSMessage::getClassInfo()); - LogDebug("jsClassRef success"); + LoggerD("jsClassRef success"); JSMessagePrivateObject* priv = new JSMessagePrivateObject(context, msg); - LogDebug("priv success"); + LoggerD("priv success"); JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast(priv)); - LogDebug("JSObjectMake success"); + LoggerD("JSObjectMake success"); JSClassRelease(jsClassRef); if (NULL == jsObjRef) { - LogError("JSObject creation error"); + LoggerE("JSObject creation error"); throw DeviceAPI::Common::UnknownException("JSObject make error"); } return jsObjRef; } catch(BasePlatformException &bex) { - LogError("Message creation failed: " << bex.getMessage()); + LoggerE("Message creation failed: " << bex.getMessage()); JSObjectRef error = JSWebAPIError::makeJSWebAPIError(context, bex); *exception = error; return NULL; @@ -540,7 +540,7 @@ JSValueRef JSMessage::convertToType(JSContextRef context, JSType type, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); return JSValueMakeUndefined(context); } @@ -549,11 +549,11 @@ JSValueRef JSMessage::getAttachments(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); try { GlobalContextManager *gcm = GlobalContextManager::getInstance(); if(gcm == NULL) { - LogError("Failed to get GlobalContextManager"); + LoggerE("Failed to get GlobalContextManager"); throw DeviceAPI::Common::UnknownException("Unable to receive global context"); } JSContextRef globalContext = gcm->getGlobalContext(context); @@ -561,7 +561,7 @@ JSValueRef JSMessage::getAttachments(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); MessageType msgType = msg->getMessageType(); - LogInfo("msgType=" << msgType); + LoggerI("msgType=" << msgType); // prepare common values JSCallbackManagerPtr emptyCallbackMgr = JSCallbackManager::createObject(globalContext, NULL, NULL); @@ -587,13 +587,13 @@ JSValueRef JSMessage::getAttachments(JSContextRef context, } int count = attachments.size(); - LogDebug( "count : " << count); + LoggerD( "count : " << count); JSObjectRef jsMessageAttachmentObject[count]; //make for (unsigned int index = 0 ; index < attachments.size(); index++ ) { - LogDebug( "Attachment ID : " << attachments[index]->getAttachmentID()); + LoggerD( "Attachment ID : " << attachments[index]->getAttachmentID()); jsMessageAttachmentObject[index] = JSMessageAttachment::createJS(globalContext, attachments[index] ); } JSObjectRef result = JSObjectMakeArray(globalContext, count, jsMessageAttachmentObject, NULL); @@ -604,13 +604,13 @@ JSValueRef JSMessage::getAttachments(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(globalContext, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } return arrayValue; } default: - LogError("Not supported message type"); + LoggerE("Not supported message type"); /* unsupported type -> type is integral message attribute * so error at this place means internal api error*/ throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); @@ -618,11 +618,11 @@ JSValueRef JSMessage::getAttachments(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("Attachments getting failure: " << bex.getMessage()); + LoggerE("Attachments getting failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting attachments."); + LoggerE("UnknownError when getting attachments."); return JSValueMakeUndefined(context); } } @@ -633,7 +633,7 @@ JSValueRef JSMessage::getBccAddress(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); @@ -648,7 +648,7 @@ JSValueRef JSMessage::getBccAddress(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } JSValueRef referr; @@ -672,13 +672,13 @@ JSValueRef JSMessage::getBccAddress(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } return arrayValue; } default: - LogError("not supported message type"); + LoggerE("not supported message type"); /* unsupported type -> type is integral message attribute * so error at this place means internal api error*/ throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); @@ -686,11 +686,11 @@ JSValueRef JSMessage::getBccAddress(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("BCC addressess getting failure: " << bex.getMessage()); + LoggerE("BCC addressess getting failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting BCC addressess."); + LoggerE("UnknownError when getting BCC addressess."); return JSValueMakeUndefined(context); } } @@ -710,11 +710,11 @@ JSValueRef JSMessage::getBody(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Message body getting failure: " << bex.getMessage()); + LoggerE("Message body getting failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting Message body."); + LoggerE("UnknownError when getting Message body."); return JSValueMakeUndefined(context);; } } @@ -724,7 +724,7 @@ JSValueRef JSMessage::getCcAddress(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); @@ -739,7 +739,7 @@ JSValueRef JSMessage::getCcAddress(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } JSValueRef referr; @@ -763,13 +763,13 @@ JSValueRef JSMessage::getCcAddress(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } return arrayValue; } default: - LogError("not supported message type"); + LoggerE("not supported message type"); /* unsupported type -> type is integral message attribute * so error at this place means internal api error*/ throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); @@ -777,11 +777,11 @@ JSValueRef JSMessage::getCcAddress(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("CC addressess getting failure: " << bex.getMessage()); + LoggerE("CC addressess getting failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting CC addressess."); + LoggerE("UnknownError when getting CC addressess."); return JSValueMakeUndefined(context); } } @@ -791,7 +791,7 @@ JSValueRef JSMessage::getDestinationAddress(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); @@ -799,10 +799,10 @@ JSValueRef JSMessage::getDestinationAddress(JSContextRef context, JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if (NULL == arrayValue) { - LogError("Could not create js array object"); + LoggerE("Could not create js array object"); return JSValueMakeUndefined(context); } - LogError("getRecipientSize() : " << recipient->getRecipientSize()); + LoggerE("getRecipientSize() : " << recipient->getRecipientSize()); JSValueRef referr; for(size_t i = 0; i < recipient->getRecipientSize(); i++) { @@ -818,11 +818,11 @@ JSValueRef JSMessage::getDestinationAddress(JSContextRef context, return arrayValue; } catch(BasePlatformException &bex) { - LogError("Destination addressess getting failure: " << bex.getMessage()); + LoggerE("Destination addressess getting failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting destination addressess."); + LoggerE("UnknownError when getting destination addressess."); return JSValueMakeUndefined(context); } } @@ -842,11 +842,11 @@ JSValueRef JSMessage::getIsRead(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Checking if message is read failure: " << bex.getMessage()); + LoggerE("Checking if message is read failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when checking if message is read."); + LoggerE("UnknownError when checking if message is read."); return JSValueMakeUndefined(context); } } @@ -860,8 +860,8 @@ JSValueRef JSMessage::getMessageId(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); const string& id = msg->getIdRef(); - LogDebug("msgId=" << id); - LogDebug("msg->getMessageStatus()=" << msg->getMessageStatus()); + LoggerD("msgId=" << id); + LoggerD("msg->getMessageStatus()=" << msg->getMessageStatus()); if((id.size() == 0) && msg->getMessageStatus() == MESSAGE_STATUS_CREATED) { return JSValueMakeNull(context); @@ -872,11 +872,11 @@ JSValueRef JSMessage::getMessageId(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message id failure: " << bex.getMessage()); + LoggerE("Getting message id failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message id."); + LoggerE("UnknownError when getting message id."); return JSValueMakeUndefined(context); } } @@ -894,13 +894,13 @@ JSValueRef JSMessage::getMessagePriority(JSContextRef context, switch (msgType) { case SMS: case MMS: - LogError("priority : false"); + LoggerE("priority : false"); return converter->toJSValueRef(false); case EMAIL: { IEmailPtr email = MessageFactory::convertToEmail(msg); int tmpint = email->getPriority(); - LogError("priority : " << tmpint); + LoggerE("priority : " << tmpint); if(tmpint == MessagePriority::HIGH) { return converter->toJSValueRef(true); @@ -908,7 +908,7 @@ JSValueRef JSMessage::getMessagePriority(JSContextRef context, return converter->toJSValueRef(false); } default: - LogError("unsupported message type"); + LoggerE("unsupported message type"); /* unsupported type -> type is integral message attribute * so error at this place means internal api error*/ throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); @@ -916,11 +916,11 @@ JSValueRef JSMessage::getMessagePriority(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("Getting message priority failure: " << bex.getMessage()); + LoggerE("Getting message priority failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message priority."); + LoggerE("UnknownError when getting message priority."); return JSValueMakeUndefined(context); } } @@ -941,11 +941,11 @@ JSValueRef JSMessage::getMessageType(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message type failure: " << bex.getMessage()); + LoggerE("Getting message type failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message type."); + LoggerE("UnknownError when getting message type."); return JSValueMakeUndefined(context); } } @@ -959,10 +959,10 @@ JSValueRef JSMessage::getSourceAddress(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); string from = msg->getSourceAddress(); - LogDebug("from =" << from); + LoggerD("from =" << from); if(from.size() == 0) { - LogDebug("JSValueMakeNull"); + LoggerD("JSValueMakeNull"); return JSValueMakeNull(context); } return converter->toJSValueRef(from); @@ -971,11 +971,11 @@ JSValueRef JSMessage::getSourceAddress(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message source address failure: " << bex.getMessage()); + LoggerE("Getting message source address failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message source address."); + LoggerE("UnknownError when getting message source address."); return JSValueMakeUndefined(context); } } @@ -1005,7 +1005,7 @@ JSValueRef JSMessage::getSubject(JSContextRef context, case SMS: return converter->toJSValueRef(""); default: - LogError("message not support subject"); + LoggerE("message not support subject"); /* unsupported type -> type is integral message attribute * so error at this place means internal api error*/ throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); @@ -1013,11 +1013,11 @@ JSValueRef JSMessage::getSubject(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("Getting message subject failure: " << bex.getMessage()); + LoggerE("Getting message subject failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message subject."); + LoggerE("UnknownError when getting message subject."); return JSValueMakeUndefined(context); } } @@ -1032,11 +1032,11 @@ JSValueRef JSMessage::getTime(JSContextRef context, IMessagePtr msg = converter->toIMessage(object); struct tm dateTime = msg->getDateTime(); const string& id = msg->getIdRef(); - LogDebug("msg->getMessageStatus()=" << msg->getMessageStatus()); - LogInfo("id.size() : " << id.size()); + LoggerD("msg->getMessageStatus()=" << msg->getMessageStatus()); + LoggerI("id.size() : " << id.size()); if((id.size() == 0) && msg->getMessageStatus() == MESSAGE_STATUS_CREATED) { - LogInfo("JSValueMakeNull"); + LoggerI("JSValueMakeNull"); return JSValueMakeNull(context); } return converter->toJSValueRef(dateTime); @@ -1045,11 +1045,11 @@ JSValueRef JSMessage::getTime(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message time failure: " << bex.getMessage()); + LoggerE("Getting message time failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message time."); + LoggerE("UnknownError when getting message time."); return JSValueMakeUndefined(context); } } @@ -1066,8 +1066,8 @@ JSValueRef JSMessage::getFolder(JSContextRef context, int tmpInt = msg->getMessageStatus(); - LogError("folder : " << folder); - LogError("msg->getMessageStatus() : " << tmpInt); + LoggerE("folder : " << folder); + LoggerE("msg->getMessageStatus() : " << tmpInt); if(tmpInt == MESSAGE_STATUS_CREATED) { @@ -1081,11 +1081,11 @@ JSValueRef JSMessage::getFolder(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message folder failure: " << bex.getMessage()); + LoggerE("Getting message folder failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message folder."); + LoggerE("UnknownError when getting message folder."); return JSValueMakeUndefined(context); } } @@ -1095,12 +1095,12 @@ JSValueRef JSMessage::getMessageBody(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("getMessageBody"); + LoggerI("getMessageBody"); try { GlobalContextManager *gcm = GlobalContextManager::getInstance(); if(gcm == NULL) { - LogError("Failed to get GlobalContextManager"); + LoggerE("Failed to get GlobalContextManager"); throw DeviceAPI::Common::UnknownException("Unable to receive global context"); } JSContextRef globalContext = gcm->getGlobalContext(context); @@ -1111,11 +1111,11 @@ JSValueRef JSMessage::getMessageBody(JSContextRef context, return JSMessageBody::createJS(globalContext, msg); } catch(BasePlatformException &bex) { - LogError("Getting message body failure: " << bex.getMessage()); + LoggerE("Getting message body failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message body."); + LoggerE("UnknownError when getting message body."); return JSValueMakeUndefined(context); } } @@ -1125,12 +1125,12 @@ JSValueRef JSMessage::getAccountID(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("getAccountID"); + LoggerI("getAccountID"); try { GlobalContextManager *gcm = GlobalContextManager::getInstance(); if(gcm == NULL) { - LogError("Failed to get GlobalContextManager"); + LoggerE("Failed to get GlobalContextManager"); throw DeviceAPI::Common::UnknownException("Unable to receive global context"); } JSContextRef globalContext = gcm->getGlobalContext(context); @@ -1139,7 +1139,7 @@ JSValueRef JSMessage::getAccountID(JSContextRef context, IMessagePtr msg = converter->toIMessage(object); //get message point - LogInfo("create JS"); + LoggerI("create JS"); //getAccountID if (msg->getMessageType() == EMAIL) { @@ -1182,11 +1182,11 @@ JSValueRef JSMessage::getAccountID(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("Getting account id failure: " << bex.getMessage()); + LoggerE("Getting account id failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting account id."); + LoggerE("UnknownError when getting account id."); return JSValueMakeUndefined(context); } } @@ -1196,12 +1196,12 @@ JSValueRef JSMessage::getUID(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("getUID"); + LoggerI("getUID"); try { GlobalContextManager *gcm = GlobalContextManager::getInstance(); if(gcm == NULL) { - LogError("Failed to get GlobalContextManager"); + LoggerE("Failed to get GlobalContextManager"); throw DeviceAPI::Common::UnknownException("Unable to receive global context"); } JSContextRef globalContext = gcm->getGlobalContext(context); @@ -1210,7 +1210,7 @@ JSValueRef JSMessage::getUID(JSContextRef context, IMessagePtr msg = converter->toIMessage(object); //get message point - LogInfo("create JS"); + LoggerI("create JS"); //getAccountID if (msg->getMessageType() == EMAIL) { @@ -1223,11 +1223,11 @@ JSValueRef JSMessage::getUID(JSContextRef context, } } catch(BasePlatformException &bex) { - LogError("Getting account id failure: " << bex.getMessage()); + LoggerE("Getting account id failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting account id."); + LoggerE("UnknownError when getting account id."); return JSValueMakeUndefined(context); } } @@ -1238,7 +1238,7 @@ bool JSMessage::setAttachments(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); @@ -1247,39 +1247,39 @@ bool JSMessage::setAttachments(JSContextRef context, if (JSIsArrayValue(context, value)) { JSObjectRef valueObj = converter->toJSObjectRef(value); unsigned int len = JSGetArrayLength(context, valueObj); - LogDebug("Array Length = " << len); + LoggerD("Array Length = " << len); for (unsigned int i = 0; i < len; ++i) { JSValueRef att = JSObjectGetPropertyAtIndex(context, valueObj, i, NULL); if (JSValueIsUndefined(context, att) || JSValueIsNull(context, att)) { - LogWarning("Invalid array element. Skipping."); + LoggerW("Invalid array element. Skipping."); continue; } IAttachmentPtr attachment = converter->toIAttachment(att); if(attachment->getIsValidAttachment() == false) { - LogDebug("invalid attachment : " << i); + LoggerD("invalid attachment : " << i); throw DeviceAPI::Common::InvalidValuesException("Invalid attachment in array"); } - LogDebug("Adding attachment , shotname: " << attachment->getShortName()); + LoggerD("Adding attachment , shotname: " << attachment->getShortName()); attachments.push_back(attachment); } } else { IAttachmentPtr attachment = converter->toIAttachment(value); - LogDebug("Adding attachment , shotname: " << attachment->getShortName()); + LoggerD("Adding attachment , shotname: " << attachment->getShortName()); if(attachment->getIsValidAttachment() == false) { - LogDebug("invalid attachment"); + LoggerD("invalid attachment"); throw DeviceAPI::Common::InvalidValuesException("Invalid attachments array"); } attachments.push_back(attachment); } - LogDebug("Attachment Size =" << attachments.size()); + LoggerD("Attachment Size =" << attachments.size()); if ( attachments.size() > 0) { IMessagePtr msg = converter->toIMessage(object); @@ -1300,7 +1300,7 @@ bool JSMessage::setAttachments(JSContextRef context, break; } default: - LogError("not supported message type"); + LoggerE("not supported message type"); throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); break; } @@ -1308,17 +1308,17 @@ bool JSMessage::setAttachments(JSContextRef context, } else { - LogError("Message converter failed..."); + LoggerE("Message converter failed..."); throw DeviceAPI::Common::UnknownException("Message conversion failure"); } } } catch(BasePlatformException &bex) { - LogError("Setting attachments failed: " << bex.getMessage()); + LoggerE("Setting attachments failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting attachments."); + LoggerE("UnknownError when setting attachments."); return true; } return true; @@ -1332,7 +1332,7 @@ bool JSMessage::setAttachments(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogInfo("enter"); + LoggerI("enter"); Try { @@ -1345,7 +1345,7 @@ bool JSMessage::setAttachments(JSContextRef context, } } Catch(WrtDeviceApis::Commons::NullPointerException) { - LogError("Error on pointer, null value"); + LoggerE("Error on pointer, null value"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -1364,17 +1364,17 @@ bool JSMessage::setAttachments(JSContextRef context, JSValueRef att = JSGetArrayElement(context, valueObj, i); if (JSValueIsUndefined(context, att) || JSValueIsNull(context, att)) { - LogWarning("Invalid array element. Skipping."); + LoggerW("Invalid array element. Skipping."); continue; } DeviceAPI::Filesystem::INodePtr node = converter->toFilesystemNode( att); - LogDebug("Adding attachment: " << node->getPath()->getFullPath()); + LoggerD("Adding attachment: " << node->getPath()->getFullPath()); attachments.push_back(node->getPath()->getFullPath()); } } else { - LogWarning("Invalid or null element passed as attachment array." << + LoggerW("Invalid or null element passed as attachment array." << "Setting empty vector."); } @@ -1399,23 +1399,23 @@ bool JSMessage::setAttachments(JSContextRef context, return false; // ignore default: - LogError("not supported message type"); + LoggerE("not supported message type"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } return true; } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("Error on conversion"); + LoggerE("Error on conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::NullPointerException) { - LogError("Error on pointer, null value"); + LoggerE("Error on pointer, null value"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("Invalid argument"); + LoggerE("Invalid argument"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } @@ -1433,7 +1433,7 @@ bool JSMessage::setBccAddress(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); Recipients bcc = converter->toRecipients(value); - LogDebug("setting bcc field, size=" << bcc.getRecipientSize()); + LoggerD("setting bcc field, size=" << bcc.getRecipientSize()); MessageType msgType = msg->getMessageType(); switch (msgType) { @@ -1448,18 +1448,18 @@ bool JSMessage::setBccAddress(JSContextRef context, break; } default: - LogError("not supported message type"); + LoggerE("not supported message type"); throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); break; } return true; } catch(BasePlatformException &bex) { - LogError("Setting BCC addresses failed: " << bex.getMessage()); + LoggerE("Setting BCC addresses failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting BCC addresses."); + LoggerE("UnknownError when setting BCC addresses."); return true; } return true; @@ -1482,11 +1482,11 @@ bool JSMessage::setBody(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Setting BCC addresses failed: " << bex.getMessage()); + LoggerE("Setting BCC addresses failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting BCC addresses."); + LoggerE("UnknownError when setting BCC addresses."); return true; } return true; @@ -1502,7 +1502,7 @@ bool JSMessage::setCcAddress(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); Recipients cc = converter->toRecipients(value); - LogDebug("setting cc field, size=" << cc.getRecipientSize()); + LoggerD("setting cc field, size=" << cc.getRecipientSize()); MessageType msgType = msg->getMessageType(); switch (msgType) { @@ -1516,18 +1516,18 @@ bool JSMessage::setCcAddress(JSContextRef context, break; } default: - LogError("unsuported message type"); + LoggerE("unsuported message type"); throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); break; } return true; } catch(BasePlatformException &bex) { - LogError("Setting CC addresses failed: " << bex.getMessage()); + LoggerE("Setting CC addresses failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting CC addresses."); + LoggerE("UnknownError when setting CC addresses."); return true; } return true; @@ -1539,13 +1539,13 @@ bool JSMessage::setDestinationAddress(JSContextRef context, JSValueRef value, JSValueRef * exception) { - LogInfo("enter"); + LoggerI("enter"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagePtr msg = converter->toIMessage(object); Recipients to = converter->toRecipients(value); - LogDebug("setting to field, size=" << to.getRecipientSize()); + LoggerD("setting to field, size=" << to.getRecipientSize()); msg->setToRecipients(to); return true; } @@ -1553,11 +1553,11 @@ bool JSMessage::setDestinationAddress(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Setting destination addresses failed: " << bex.getMessage()); + LoggerE("Setting destination addresses failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting destination addresses."); + LoggerE("UnknownError when setting destination addresses."); return true; } return true; @@ -1580,11 +1580,11 @@ bool JSMessage::setIsRead(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Setting destination addresses failed: " << bex.getMessage()); + LoggerE("Setting destination addresses failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting destination addresses."); + LoggerE("UnknownError when setting destination addresses."); return true; } return true; @@ -1611,18 +1611,18 @@ bool JSMessage::setMessagePriority(JSContextRef context, break; default: - LogError("unsuported message type"); + LoggerE("unsuported message type"); throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); break; } return true; } catch(BasePlatformException &bex) { - LogError("Setting message priority failed: " << bex.getMessage()); + LoggerE("Setting message priority failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting message priority."); + LoggerE("UnknownError when setting message priority."); return true; } return true; @@ -1656,18 +1656,18 @@ bool JSMessage::setSubject(JSContextRef context, return true; // ignore default: - LogError("message not supported"); + LoggerE("message not supported"); throw DeviceAPI::Common::NotSupportedException("Unsupported message type"); break; } return true; } catch(BasePlatformException &bex) { - LogError("Setting message priority failed: " << bex.getMessage()); + LoggerE("Setting message priority failed: " << bex.getMessage()); return true; } catch(...) { - LogError("UnknownError when setting message priority."); + LoggerE("UnknownError when setting message priority."); return true; } return true; @@ -1687,15 +1687,15 @@ JSValueRef JSMessage::getConversationId(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getConversationId"); + LoggerD("getConversationId"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); int convId = 0; IMessagePtr msg = converter->toIMessage(object); - LogDebug("msg->getMessageStatus()=" << msg->getMessageStatus()); - LogDebug("msg.getConvId()=" << msg->getConvId()); + LoggerD("msg->getMessageStatus()=" << msg->getMessageStatus()); + LoggerD("msg.getConvId()=" << msg->getConvId()); convId = msg->getConvId(); if((msg->getConvId() == -1) && msg->getMessageStatus() == MESSAGE_STATUS_CREATED) { @@ -1707,11 +1707,11 @@ JSValueRef JSMessage::getConversationId(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting conversation id failure: " << bex.getMessage()); + LoggerE("Getting conversation id failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting conversation id."); + LoggerE("UnknownError when getting conversation id."); return JSValueMakeUndefined(context); } } @@ -1721,7 +1721,7 @@ JSValueRef JSMessage::getInResponseTo(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("getInResponseTo"); + LoggerD("getInResponseTo"); try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); @@ -1731,19 +1731,19 @@ JSValueRef JSMessage::getInResponseTo(JSContextRef context, if (msg->getMessageType() != EMAIL) { - LogDebug("not EMAIL type return empty string"); + LoggerD("not EMAIL type return empty string"); return converter->toJSValueRef(""); } IEmailPtr email = MessageFactory::convertToEmail(msg); msgId = email->getUID(); - LogDebug("msg.getConvId()=" << msg->getConvId()); + LoggerD("msg.getConvId()=" << msg->getConvId()); convId = msg->getConvId(); if (convId == msgId) { - LogDebug("Not forwared and replied, return empty string"); + LoggerD("Not forwared and replied, return empty string"); return converter->toJSValueRef(""); } @@ -1753,11 +1753,11 @@ JSValueRef JSMessage::getInResponseTo(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting in response to failure: " << bex.getMessage()); + LoggerE("Getting in response to failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting in response to."); + LoggerE("UnknownError when getting in response to."); return JSValueMakeUndefined(context); } } @@ -1767,7 +1767,7 @@ JSValueRef JSMessage::getMessageStatus(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("getMessageStatus"); + LoggerI("getMessageStatus"); try { @@ -1775,18 +1775,18 @@ JSValueRef JSMessage::getMessageStatus(JSContextRef context, IMessagePtr msg = converter->toIMessage(object); //get message point - LogInfo("create JS"); + LoggerI("create JS"); return converter->toJSValueRef(converter->toMessageStatusType(msg->getMessageStatus())); } catch(BasePlatformException &bex) { /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting message status failure: " << bex.getMessage()); + LoggerE("Getting message status failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting message status."); + LoggerE("UnknownError when getting message status."); return JSValueMakeUndefined(context); } } @@ -1797,7 +1797,7 @@ JSValueRef JSMessage::hasAttachment(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogInfo("hasAttachment"); + LoggerI("hasAttachment"); Try { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); @@ -1830,11 +1830,11 @@ JSValueRef JSMessage::hasAttachment(JSContextRef context, /* Currently this exception will not be caught here as converter * is using od-style, DPL exceptions. This catch sections * is prepared for future converter refactoring */ - LogError("Getting hasAttachment flag failure: " << bex.getMessage()); + LoggerE("Getting hasAttachment flag failure: " << bex.getMessage()); return JSValueMakeUndefined(context); } catch(...) { - LogError("UnknownError when getting hasAttachment flag."); + LoggerE("UnknownError when getting hasAttachment flag."); return JSValueMakeUndefined(context); } } diff --git a/src/Messaging/JSMessage.h b/src/Messaging/JSMessage.h old mode 100755 new mode 100644 index 0887bc0..be6a68a --- a/src/Messaging/JSMessage.h +++ b/src/Messaging/JSMessage.h @@ -18,13 +18,13 @@ #ifndef JSMESSAGE_H #define JSMESSAGE_H -#include #include #include #include "IMessagingTypes.h" #include "IMessage.h" #include "EventUpdateMessage.h" #include "JSMessageBody.h" +#include namespace DeviceAPI { namespace Messaging { @@ -39,19 +39,19 @@ class JSMessage */ static JSClassRef jsInit(JSContextRef context) { - LogInfo("enter"); + LoggerI("enter"); return JSClassCreate(&m_classInfo); } static const JSClassDefinition* getClassInfo() { - LogInfo("enter"); + LoggerI("enter"); return &(m_classInfo); } static JSClassRef getClassRef() { - LogInfo("enter"); + LoggerI("enter"); if (!m_jsClassRef) { m_jsClassRef = JSClassCreate(&m_classInfo); } diff --git a/src/Messaging/JSMessageAttachment.cpp b/src/Messaging/JSMessageAttachment.cpp index e1a9328..846f8dc 100644 --- a/src/Messaging/JSMessageAttachment.cpp +++ b/src/Messaging/JSMessageAttachment.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include "ConverterMessage.h" @@ -32,6 +31,7 @@ #include #include +#include #if 0 namespace { @@ -108,9 +108,9 @@ JSClassRef JSMessageAttachment::getClassRef() void JSMessageAttachment::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); if (!JSObjectGetPrivate(object)) { - LogDebug("Private object not set... setting it."); + LoggerD("Private object not set... setting it."); IAttachmentPtr attachment(new Attachment()); JSMessageAttachmentPrivate *priv = new JSMessageAttachmentPrivate(context, attachment); @@ -122,7 +122,7 @@ void JSMessageAttachment::initialize(JSContextRef context, void JSMessageAttachment::finalize(JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); JSMessageAttachmentPrivate* priv = static_cast(JSObjectGetPrivate(object)); JSContextRef gContext = priv->getContext(); @@ -153,23 +153,23 @@ JSValueRef JSMessageAttachment::getMIMEType(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); Try { IAttachmentPtr attachment = getAttachment(context, object); WrtDeviceApis::CommonsJavaScript::Converter converter(context); - LogDebug("mine type :" << attachment->getMimeType()); + LoggerD("mine type :" << attachment->getMimeType()); if (attachment->getMimeType().size() == 0) { - LogDebug("return NULL"); + LoggerD("return NULL"); return JSValueMakeNull(context); } return converter.toJSValueRef(attachment->getMimeType()); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -179,29 +179,29 @@ JSValueRef JSMessageAttachment::getMessageID(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); Try { IAttachmentPtr attachment = getAttachment(context, object); WrtDeviceApis::CommonsJavaScript::Converter converter(context); - LogDebug("Message ID :" << (attachment->getMessage())); + LoggerD("Message ID :" << (attachment->getMessage())); if ( (attachment->getAttachmentID() < 0) && (attachment->getMessage() == 0)) { - LogDebug("return NULL"); + LoggerD("return NULL"); return JSValueMakeNull(context); } return converter.toJSValueRef(attachment->getMessage()->getId()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("invalid value conversion"); + LoggerE("invalid value conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Unkown Exception"); + LoggerE("Unkown Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -221,7 +221,7 @@ JSValueRef JSMessageAttachment::getContentID(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); Try { IAttachmentPtr attachment = getAttachment(context, object); @@ -229,11 +229,11 @@ JSValueRef JSMessageAttachment::getContentID(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); - LogDebug("Attachment Loaded :" << (attachment->getDownloaded() )); + LoggerD("Attachment Loaded :" << (attachment->getDownloaded() )); if ( attachment->getAttachmentID() < 0) { - LogDebug("return NULL"); + LoggerD("return NULL"); return JSValueMakeNull(context); } @@ -242,13 +242,13 @@ JSValueRef JSMessageAttachment::getContentID(JSContextRef context, } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("invalid value conversion"); + LoggerE("invalid value conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Unkown Exception"); + LoggerE("Unkown Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -261,24 +261,24 @@ JSValueRef JSMessageAttachment::getLoaded(JSContextRef context, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); Try { IAttachmentPtr attachment = getAttachment(context, object); WrtDeviceApis::CommonsJavaScript::Converter converter(context); - LogDebug("Attachment Loaded :" << (attachment->getDownloaded() )); + LoggerD("Attachment Loaded :" << (attachment->getDownloaded() )); return converter.toJSValueRef(attachment->getDownloaded()); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("invalid value conversion"); + LoggerE("invalid value conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Unkown Exception"); + LoggerE("Unkown Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -290,11 +290,11 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); JSMessageAttachmentPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (priv) - LogDebug("priv is vaild"); + LoggerD("priv is vaild"); JSContextRef globalContext = priv ? priv->getContext() : context; @@ -307,7 +307,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, WrtDeviceApis::CommonsJavaScript::Converter converter(context); std::string fullPath = attachment->getFullPath(); - LogDebug("fullPath=" << fullPath); + LoggerD("fullPath=" << fullPath); if (fullPath.empty()) { return JSValueMakeNull(context); @@ -317,31 +317,31 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, std::string filePath; Try { filePath = DeviceAPI::Filesystem::Utils::toVirtualPath(globalContext, fullPath); - LogDebug("return virtual path : " << filePath); + LoggerD("return virtual path : " << filePath); return converter.toJSValueRef(filePath); } catch (WrtDeviceApis::Commons::ConversionException) { - LogDebug("return real path : " << fullPath); + LoggerD("return real path : " << fullPath); return converter.toJSValueRef(fullPath); /* - LogDebug("It is not in the the list of root locations "); + LoggerD("It is not in the the list of root locations "); if (attachment->hasDummyFile()) { - LogDebug("Get Dummy File Path " << attachment->getDummyFilePath()); + LoggerD("Get Dummy File Path " << attachment->getDummyFilePath()); filePath = attachment->getDummyFilePath(); } else { - LogDebug("Create DummyFile"); + LoggerD("Create DummyFile"); std::string tmpPath = AttachmentFactory::getDummyFileFromRealPath(globalContext, fullPath); - LogDebug("tmp Path : " << tmpPath); + LoggerD("tmp Path : " << tmpPath); if (tmpPath.length()) { attachment->setDummyFilePath(tmpPath); if ( !attachment->hasDummyFile()) { - LogDebug("dummy File Path is invalided But Can't access this file."); + LoggerD("dummy File Path is invalided But Can't access this file."); return JSValueMakeNull(context); } else @@ -364,13 +364,13 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("invalid value conversion"); + LoggerE("invalid value conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Unkown Exception"); + LoggerE("Unkown Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -384,7 +384,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, } /* // MESSAGING ATTACHMENT IS BLOCKED - LogDebug("enter"); + LoggerD("enter"); Try { IAttachmentPtr attachment = getAttachment(context, object); @@ -393,7 +393,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, } std::string fullPath = attachment->getFullPath(); - LogDebug("full Path = " << fullPath ); + LoggerD("full Path = " << fullPath ); if (fullPath.empty()) { return JSValueMakeUndefined(context); } @@ -413,7 +413,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, WrtDeviceApis::Commons::ExceptionCodes::Enumeration code = event->getExceptionCode(); if (code != WrtDeviceApis::Commons::ExceptionCodes::None) { - LogError("Attachment location not resolved. Exception code: " << code); + LoggerE("Attachment location not resolved. Exception code: " << code); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); @@ -421,7 +421,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, DeviceAPI::Filesystem::INodePtr node = event->getResult(); if (!node) { - LogError("Resolved attachment location is empty."); + LoggerE("Resolved attachment location is empty."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); @@ -429,7 +429,7 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, DeviceAPI::Filesystem::IPathPtr path = node->getPath(); - LogError(" Path = " << path->getPath() << " Full Path = " << path->getFullPath()); + LoggerE(" Path = " << path->getPath() << " Full Path = " << path->getFullPath()); JSObjectRef result = WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(context, JSFile::getClassRef(), @@ -439,14 +439,14 @@ JSValueRef JSMessageAttachment::getFilePath(JSContextRef context, } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("invalid value conversion"); + LoggerE("invalid value conversion"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Unkown Exception"); + LoggerE("Unkown Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -476,7 +476,7 @@ JSMessageAttachmentPrivate* JSMessageAttachment::getPrivate(JSObjectRef thisObje JSMessageAttachmentPrivate* thisPrivate = static_cast(JSObjectGetPrivate(thisObject)); if (!thisPrivate) { - LogError("no private"); + LoggerE("no private"); Throw(WrtDeviceApis::Commons::NullPointerException); } return thisPrivate; @@ -488,7 +488,7 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try @@ -498,55 +498,55 @@ JSObjectRef JSMessageAttachment::constructor(JSContextRef context, std::string path = validator.toString(0); std::string mimetype = validator.toString(1, true); - LogDebug("path size() : " << path.size()); + LoggerD("path size() : " << path.size()); if(path.size() != 0) { DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, path); if (src) { - LogDebug("path size() : " << path.size()); + LoggerD("path size() : " << path.size()); path = src->getFullPath(); } else { - LogDebug("path size() : " << path.size()); + LoggerD("path size() : " << path.size()); path = ""; //set empty string. } } else { - LogDebug("path size() : " << path.size()); + LoggerD("path size() : " << path.size()); path = ""; //set empty string. } - LogDebug("real path = " << path); + LoggerD("real path = " << path); IAttachmentPtr attachment = AttachmentFactory::createAttachment( path, mimetype); if (attachment) { JSClassRef jsClassRef = JSClassCreate(getClassInfo()); - LogDebug("jsClassRef success"); + LoggerD("jsClassRef success"); JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment); - LogDebug("priv success"); + LoggerD("priv success"); JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast(priv)); - LogDebug("JSObjectMake success"); + LoggerD("JSObjectMake success"); JSClassRelease(jsClassRef); if (NULL == jsObjRef) { - LogError("object creation error"); + LoggerE("object creation error"); throw DeviceAPI::Common::UnknownException("JSObject make error"); } return jsObjRef; } else { - LogDebug("attachment can't create"); + LoggerD("attachment can't create"); throw DeviceAPI::Common::UnknownException("attachment create failed"); } }catch(BasePlatformException & e) { - LogError("Message creation failed: " << e.getMessage()); + LoggerE("Message creation failed: " << e.getMessage()); JSObjectRef error = JSWebAPIError::makeJSWebAPIError(context, e); *exception = error; } @@ -563,7 +563,7 @@ JSValueRef JSMessageAttachment::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("OK"); + LoggerD("OK"); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); // WrtDeviceApis::CommonsJavaScript::Converter converter(context); @@ -607,7 +607,7 @@ JSValueRef JSMessageAttachment::getProperty(JSContextRef context, } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); return JSValueMakeUndefined(context); } return NULL; @@ -619,7 +619,7 @@ bool JSMessageAttachment::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); if (JSStringIsEqualToUTF8CString(propertyName, ATTACHMENTID)) { return true; @@ -637,7 +637,7 @@ void JSMessageAttachment::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogDebug("Entered"); + LoggerD("Entered"); JSStringRef propertyName = NULL; propertyName = JSStringCreateWithUTF8CString(ATTACHMENTID); diff --git a/src/Messaging/JSMessageBody.cpp b/src/Messaging/JSMessageBody.cpp index 2443047..617b3ac 100644 --- a/src/Messaging/JSMessageBody.cpp +++ b/src/Messaging/JSMessageBody.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include "ConverterMessage.h" @@ -24,12 +23,11 @@ #include #include #include "MessagingErrorMsg.h" - #include "JSMessageAttachment.h" - #include #include #include +#include namespace DeviceAPI { namespace Messaging { @@ -87,12 +85,12 @@ JSClassRef JSMessageBody::getClassRef() void JSMessageBody::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); } void JSMessageBody::finalize(JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); JSMessageBodyPrivate* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); delete priv; @@ -121,7 +119,7 @@ JSMessageBodyPrivate* JSMessageBody::getPrivate(JSObjectRef thisObject) { JSMessageBodyPrivate* thisPrivate = static_cast(JSObjectGetPrivate(thisObject)); if (!thisPrivate) { - LogError("no private"); + LoggerE("no private"); Throw(WrtDeviceApis::Commons::NullPointerException); } return thisPrivate; @@ -132,7 +130,7 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); try { IMessagePtr msg = getMessage(context, object); @@ -142,8 +140,8 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, if (JSStringIsEqualToUTF8CString(propertyName, MSGID)) { std::string id = msg->getId(); - LogDebug("msgId=" << id); - LogDebug("msg->getMessageStatus()=" << msg->getMessageStatus()); + LoggerD("msgId=" << id); + LoggerD("msg->getMessageStatus()=" << msg->getMessageStatus()); if((id.size() == 0) && (msg->getMessageStatus() == MESSAGE_STATUS_CREATED)) { id = ""; } @@ -155,8 +153,8 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, return JSUtil::toJSValueRef(context, email->isBodyDownloaded() > 0 ? true : false); } else { - LogDebug("msgId=" << msg->getId()); - LogDebug("msg->getMessageStatus()=" << msg->getMessageStatus()); + LoggerD("msgId=" << msg->getId()); + LoggerD("msg->getMessageStatus()=" << msg->getMessageStatus()); if ((msg->getId().size() == 0) && msg->getMessageStatus() == MESSAGE_STATUS_CREATED) { return JSUtil::toJSValueRef(context, false); } @@ -165,16 +163,16 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, } else if (JSStringIsEqualToUTF8CString(propertyName, PLAINBODY)) { std::string body = msg->getBody(); - LogDebug("getPlainBody plainBody" << body ); + LoggerD("getPlainBody plainBody" << body ); return JSUtil::toJSValueRef(context, body); } else if (JSStringIsEqualToUTF8CString(propertyName, HTMLBODY)) { - LogDebug("message Type : " << msg->getMessageType() ); + LoggerD("message Type : " << msg->getMessageType() ); std::string emailHtmlBody = ""; if (msg->getMessageType() == EMAIL) { IEmailPtr email = MessageFactory::convertToEmail(msg); emailHtmlBody = email->getHtmlBody(); - LogDebug("Html Body : " << emailHtmlBody ); + LoggerD("Html Body : " << emailHtmlBody ); } return JSUtil::toJSValueRef(context, emailHtmlBody); } @@ -191,11 +189,11 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, inlineAttachments = emailAttachments->getInlineAttachments(); count = inlineAttachments.size(); - LogDebug( "attachments.size(): " << count); + LoggerD( "attachments.size(): " << count); JSObjectRef jsMessageAttachmentObject[count]; //make for(int i = 0; i < count; i++) { - LogDebug("Attachment ID: " << inlineAttachments[i]->getAttachmentID()); + LoggerD("Attachment ID: " << inlineAttachments[i]->getAttachmentID()); jsMessageAttachmentObject[i] = JSMessageAttachment::createJS(context, inlineAttachments[i]); } JSObjectRef result = JSObjectMakeArray(context, count, jsMessageAttachmentObject, NULL); @@ -206,7 +204,7 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, { JSObjectRef arrayValue = JSObjectMakeArray(context, 0, NULL, NULL); if(NULL == arrayValue){ - LogError("Could not create JS array object"); + LoggerE("Could not create JS array object"); return JSValueMakeUndefined(context); } return arrayValue; @@ -217,15 +215,15 @@ JSValueRef JSMessageBody::getProperty(JSContextRef context, } } else { - LogDebug("Not supported property."); + LoggerD("Not supported property."); } } catch (const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSValueMakeUndefined(context); } catch (const WrtDeviceApis::Commons::Exception& err) { - LogError(err.GetMessage().c_str()); + LoggerE(err.GetMessage().c_str()); return JSValueMakeUndefined(context); } @@ -238,7 +236,7 @@ bool JSMessageBody::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); try { if (JSStringIsEqualToUTF8CString(propertyName, MSGID)) { @@ -251,7 +249,7 @@ bool JSMessageBody::setProperty(JSContextRef context, IMessagePtr msg = getMessage(context, object); std::string body = JSUtil::JSValueToString(context, value); msg->setBody(body); - LogDebug("setPlainBody plainBody" << body ); + LoggerD("setPlainBody plainBody" << body ); return true; } else if (JSStringIsEqualToUTF8CString(propertyName, HTMLBODY)) { @@ -261,7 +259,7 @@ bool JSMessageBody::setProperty(JSContextRef context, { IEmailPtr email = MessageFactory::convertToEmail(msg); std::string body = JSUtil::JSValueToString(context, value); - LogDebug("input String : " << body); + LoggerD("input String : " << body); email->setHtmlBody(body); return true; } @@ -277,12 +275,12 @@ bool JSMessageBody::setProperty(JSContextRef context, if (JSIsArrayValue(context, value)) { JSObjectRef valueObj = converter->toJSObjectRef(value); unsigned int len = JSGetArrayLength(context, valueObj); - LogDebug("Array Length = " << len); + LoggerD("Array Length = " << len); for (unsigned int i = 0; i < len; ++i) { JSValueRef att = JSGetArrayElement(context, valueObj, i); if (JSValueIsUndefined(context, att) || JSValueIsNull(context, att)) { - LogWarning("Invalid array element. Skipping."); + LoggerW("Invalid array element. Skipping."); continue; } IAttachmentPtr attachment = converter->toIAttachment(att); @@ -292,20 +290,20 @@ bool JSMessageBody::setProperty(JSContextRef context, throw DeviceAPI::Common::InvalidValuesException(logMsg.c_str()); } - LogDebug("Adding attachment , shortname: " << attachment->getShortName()); + LoggerD("Adding attachment , shortname: " << attachment->getShortName()); inlineAttachments.push_back(attachment); } } else { IAttachmentPtr attachment = converter->toIAttachment(value); - LogDebug("Adding attachment , shortname: " << attachment->getShortName()); + LoggerD("Adding attachment , shortname: " << attachment->getShortName()); if (attachment->getIsValidAttachment() == false) { throw DeviceAPI::Common::InvalidValuesException("Invalid attachment."); } inlineAttachments.push_back(attachment); } - LogDebug("inlineAttachments Size =" << inlineAttachments.size()); + LoggerD("inlineAttachments Size =" << inlineAttachments.size()); if ( inlineAttachments.size() > 0) { IMessagePtr msg = converter->toIMessage(object); if (msg) { @@ -328,15 +326,15 @@ bool JSMessageBody::setProperty(JSContextRef context, return true; } else { - LogDebug("Not supported property."); + LoggerD("Not supported property."); } } catch (const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return true; } catch (const WrtDeviceApis::Commons::Exception& err) { - LogError(err.GetMessage().c_str()); + LoggerE(err.GetMessage().c_str()); return true; } @@ -347,7 +345,7 @@ void JSMessageBody::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogDebug("Entered"); + LoggerD("Entered"); JSStringRef propertyName = NULL; propertyName = JSStringCreateWithUTF8CString(MSGID); diff --git a/src/Messaging/JSMessageFolder.cpp b/src/Messaging/JSMessageFolder.cpp index 980c6da..f373a35 100644 --- a/src/Messaging/JSMessageFolder.cpp +++ b/src/Messaging/JSMessageFolder.cpp @@ -28,7 +28,7 @@ #include "IMessagingTypes.h" #include - +#include #include #include @@ -119,7 +119,7 @@ JSClassRef JSMessageFolder::m_jsClassRef = JSClassCreate(JSMessageFolder::getCla void JSMessageFolder::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("JSMessageFolder::initialize "); + LoggerD("JSMessageFolder::initialize "); JSMessageFolderPriv* priv = static_cast(JSObjectGetPrivate(object)); if (priv == NULL) @@ -128,7 +128,7 @@ void JSMessageFolder::initialize(JSContextRef context, JSObjectRef object) } else { - LogDebug("JSMessageFolder::already exist "); + LoggerD("JSMessageFolder::already exist "); } } @@ -142,7 +142,7 @@ JSObjectRef JSMessageFolder::createJSObject(JSContextRef context, IMessageFolder void JSMessageFolder::finalize(JSObjectRef object) { JSMessageFolderPriv* priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("JSMessageFolder::Finalrize"); + LoggerD("JSMessageFolder::Finalrize"); if (priv != NULL) { @@ -161,7 +161,7 @@ JSValueRef JSMessageFolder::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("<<<"); + LoggerD("<<<"); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); JSMessageFolderPriv* priv = static_cast(JSObjectGetPrivate(object)); @@ -214,7 +214,7 @@ JSValueRef JSMessageFolder::getProperty(JSContextRef context, } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); return JSValueMakeUndefined(context); } return NULL; @@ -226,7 +226,7 @@ bool JSMessageFolder::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); WrtDeviceApis::CommonsJavaScript::Converter converter(context); try @@ -261,7 +261,7 @@ bool JSMessageFolder::setProperty(JSContextRef context, } catch(const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); return true; } return false; @@ -271,7 +271,7 @@ void JSMessageFolder::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogDebug("Entered"); + LoggerD("Entered"); JSStringRef propertyName = NULL; propertyName = JSStringCreateWithUTF8CString(FOLDERID); diff --git a/src/Messaging/JSMessagingService.cpp b/src/Messaging/JSMessagingService.cpp index 07278f6..6e52be6 100644 --- a/src/Messaging/JSMessagingService.cpp +++ b/src/Messaging/JSMessagingService.cpp @@ -111,11 +111,11 @@ const JSClassRef JSMessagingService::getClassRef() { } void JSMessagingService::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("creation messaging Service instance"); + LoggerD("creation messaging Service instance"); } void JSMessagingService::finalize(JSObjectRef object) { - LogDebug("finalize messaging instance"); + LoggerD("finalize messaging instance"); //JSMessagingServicePriv *priv = static_cast(JSObjectGetPrivate(object)); JSMessagingServicePriv *priv = static_cast(JSObjectGetPrivate(object)); delete priv; @@ -136,11 +136,11 @@ JSValueRef JSMessagingService::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(object)); //get private object if (!priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -149,15 +149,15 @@ JSValueRef JSMessagingService::getProperty(JSContextRef context, ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); if (JSStringIsEqualToUTF8CString(propertyName, MESSAGING_SERVICE_TYPE)) { - LogDebug("type" << ": " << imessagingService->getType()); + LoggerD("type" << ": " << imessagingService->getType()); return JSUtil::toJSValueRef(context, converter->toMessageType(imessagingService->getType())); } else if (JSStringIsEqualToUTF8CString(propertyName, MESSAGING_SERVICE_NAME)) { - LogDebug("name : " << imessagingService->getName()); + LoggerD("name : " << imessagingService->getName()); return JSUtil::toJSValueRef(context, imessagingService->getName()); } else if (JSStringIsEqualToUTF8CString(propertyName, MESSAGING_SERVICE_ID)) { - LogDebug("accountId : " << imessagingService->getAccountID()); + LoggerD("accountId : " << imessagingService->getAccountID()); std::stringstream stream; stream << imessagingService->getAccountID(); @@ -172,10 +172,10 @@ JSValueRef JSMessagingService::getProperty(JSContextRef context, MessagingStoragePrivObjPtr storagePrivObj(new MessagingStoragePrivObj()); storagePrivObj->m_index = imessagingService->getAccountID(); - LogDebug("accountId" << ": " << storagePrivObj->m_index); + LoggerD("accountId" << ": " << storagePrivObj->m_index); storagePrivObj->m_type = imessagingService->getType(); - LogDebug("type" << ": " << storagePrivObj->m_type); + LoggerD("type" << ": " << storagePrivObj->m_type); MessagingStoragePriv *privStorage = new MessagingStoragePriv(l_globalContext, storagePrivObj); @@ -183,11 +183,11 @@ JSValueRef JSMessagingService::getProperty(JSContextRef context, } } catch (const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSValueMakeUndefined(context); } catch (const WrtDeviceApis::Commons::Exception& err) { - LogError(err.GetMessage().c_str()); + LoggerE(err.GetMessage().c_str()); return JSValueMakeUndefined(context); } @@ -200,7 +200,7 @@ bool JSMessagingService::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); if (JSStringIsEqualToUTF8CString(propertyName, MESSAGING_SERVICE_ID)) { return true; @@ -222,7 +222,7 @@ void JSMessagingService::getPropertyNames(JSContextRef context, JSObjectRef object, JSPropertyNameAccumulatorRef propertyNames) { - LogDebug("Entered"); + LoggerD("Entered"); JSStringRef propertyName = NULL; propertyName = JSStringCreateWithUTF8CString(MESSAGING_SERVICE_ID); @@ -247,8 +247,8 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o const JSValueRef arguments[], JSValueRef* exception) { - LogInfo("<<<"); - LogDebug("arumentConunt:" << argumentCount); + LoggerI("<<<"); + LoggerD("arumentConunt:" << argumentCount); JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (priv) @@ -266,12 +266,12 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o JSValueRef objMsg = NULL; MessageType msgType = (MessageType)imessagingService->getType(); - LogInfo("msgType :" << msgType); + LoggerI("msgType :" << msgType); if (msgType == EMAIL) { EmailAccountInfo account = imessagingService->getCurrentEmailAccount(); - LogDebug("Account Address:" << &account); + LoggerD("Account Address:" << &account); objMsg = JSMessage::createJSObject(l_globalContext, account, msgType); //make message JSValueRef. } else @@ -287,7 +287,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o if (!msg) ThrowMsg(WrtDeviceApis::Commons::PlatformException,"platform exception"); - LogDebug ("##### msg type is " << msg->getId()); + LoggerD ("##### msg type is " << msg->getId()); const ScopedJSStringRef subjectStr(JSStringCreateWithUTF8CString("subject")); const ScopedJSStringRef toStr(JSStringCreateWithUTF8CString("to")); @@ -309,7 +309,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o //subject if (!JSValueIsUndefined(l_globalContext, subjectData) ) { - LogDebug ( " Subject : " << converter->toString(subjectData) ); + LoggerD ( " Subject : " << converter->toString(subjectData) ); std::string subject = converter->toString(subjectData); switch (msgType) { @@ -327,7 +327,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o } default: { - LogError("message not supported"); + LoggerE("message not supported"); //Throw(WrtDeviceApis::Commons::UnsupportedException); //break; } @@ -337,7 +337,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o if (!JSValueIsUndefined(l_globalContext, toData) ) { Recipients to = converter->toRecipients(toData); - LogDebug("setting to field, size=" << to.getRecipientSize()); + LoggerD("setting to field, size=" << to.getRecipientSize()); msg->setToRecipients(to); } //cc @@ -359,7 +359,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o if (!JSValueIsUndefined(l_globalContext, htmlBodyData)) { std::string body = converter->toString(htmlBodyData); - LogDebug("html body : " << body); + LoggerD("html body : " << body); email->setHtmlBody(body); } @@ -373,7 +373,7 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o if (!JSValueIsUndefined(l_globalContext, plainBodyData) ) { std::string body = converter->toString(plainBodyData); - LogDebug("plain body : " << body); + LoggerD("plain body : " << body); msg->setBody(body); } @@ -390,12 +390,12 @@ JSValueRef JSMessagingService::createMessage(JSContextRef context, JSObjectRef o JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_TYPE_MISMATCH); } -// LogInfo(">>>"); +// LoggerI(">>>"); // return JSValueMakeUndefined(context); } else { - LogDebug(" Private Object is NULL "); + LoggerD(" Private Object is NULL "); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, JSMESSAGING_EXCEPTION_MSG_NOT_FOUND); } @@ -410,7 +410,7 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -419,7 +419,7 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context, JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -437,7 +437,12 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context, ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Message ( mandatory ) - IMessagePtr msg = converter->toIMessage(validator.toObject(0)); + JSObjectRef messageArg = validator.toObject(0); + if(JSObjectGetPrivate(messageArg) == NULL) { + // no private object in argument -> possibly it's an invalid object + throw DeviceAPI::Common::TypeMismatchException("Invalid first argument content."); + } + IMessagePtr msg = converter->toIMessage(messageArg); // argu 2. Success callback (optional) JSObjectRef successcb = validator.toFunction(1, true); @@ -471,16 +476,16 @@ JSValueRef JSMessagingService::sendMessage(JSContextRef context, MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, globalContext); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -495,7 +500,7 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -504,7 +509,7 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context, JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -520,7 +525,12 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context, ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Message ( mandatory ) - IMessagePtr msg = converter->toIMessage(validator.toObject(0)); + JSObjectRef messageArg = validator.toObject(0); + if(JSObjectGetPrivate(messageArg) == NULL) { + // no private object in argument -> possibly it's an invalid object + throw DeviceAPI::Common::TypeMismatchException("Invalid first argument content."); + } + IMessagePtr msg = converter->toIMessage(messageArg); // argu 2. Success callback callbackManager->setOnSuccess(validator.toFunction(1)); @@ -554,11 +564,11 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context, privateData->setMessageJSValueRef(arguments[0]); //set Message JSValueRef. } - LogInfo(" Checked Message Type " ); + LoggerI(" Checked Message Type " ); IMessagingServicePtr imessagingService = priv->getObject(); int opId = imessagingService->createOpId(MESSAGING_SERVICE_OP_DOWNLOAD_BODY); - LogDebug("Operation ID is = " << opId); + LoggerD("Operation ID is = " << opId); event->opId = opId; imessagingService->setMessageToOpId(opId, event->m_message); @@ -573,16 +583,16 @@ JSValueRef JSMessagingService::loadMessageBody(JSContextRef context, MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, globalContext); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -597,7 +607,7 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -606,7 +616,7 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -622,7 +632,12 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, ArgumentValidator validator(context, argumentCount, arguments); //argu 1. Attachment (mandatory) - IAttachmentPtr iAttchmentPtr = converter->toIAttachment(validator.toObject(0)); + JSObjectRef attachmentArg = validator.toObject(0); + if(JSObjectGetPrivate(attachmentArg) == NULL) { + // no private object in argument -> possibly it's an invalid object + throw DeviceAPI::Common::TypeMismatchException("Invalid first argument content."); + } + IAttachmentPtr iAttchmentPtr = converter->toIAttachment(attachmentArg); // argu 2. Success callback callbackManager->setOnSuccess(validator.toFunction(1)); @@ -635,7 +650,7 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, throw DeviceAPI::Common::UnknownException("Private data is NULL."); } - LogInfo("iAttchmentPtr->getDownloaded() : " << iAttchmentPtr->getDownloaded()); + LoggerI("iAttchmentPtr->getDownloaded() : " << iAttchmentPtr->getDownloaded()); if(iAttchmentPtr->getDownloaded() > 0) { callbackManager->callOnSuccess(converter->toJSValueRef(iAttchmentPtr)); @@ -656,7 +671,7 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, if (imessagingService) { int opId = imessagingService->createOpId(MESSAGING_SERVICE_OP_DOWNLOAD_ATTACHMENT); - LogDebug("Operation ID is = " << opId); + LoggerD("Operation ID is = " << opId); event->opId = opId; imessagingService->setMessageToOpId(opId, event->m_message); @@ -672,11 +687,11 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, } } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -687,7 +702,7 @@ JSValueRef JSMessagingService::loadMessageAttachment(JSContextRef context, JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -696,7 +711,7 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function, JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -719,12 +734,12 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function, // argu 3. limit ( optional ) int limit = validator.toLong(2, true, -1); //sync limit - LogDebug("limit : " << limit); + LoggerD("limit : " << limit); IMessagingServicePtr imessagingService = priv->getObject(); //get MessagingService. MessageType msgType = (MessageType)imessagingService->getType(); - LogInfo("msgType :" << msgType); + LoggerI("msgType :" << msgType); if (msgType != EMAIL) { std::string errMessage = converter->toMessageType(imessagingService->getType()) + " not supported"; throw DeviceAPI::Common::NotSupportedException(errMessage.c_str()); @@ -749,11 +764,11 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function, return JSUtil::toJSValueRef(context, (long int)event->opId); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -762,7 +777,7 @@ JSValueRef JSMessagingService::sync(JSContextRef context, JSObjectRef function, JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -771,7 +786,7 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -787,7 +802,12 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Folder (mandatory) - IMessageFolderPtr folder = converter->toIMessageFolder(validator.toObject(0)); + JSObjectRef folderArg = validator.toObject(0); + if(JSObjectGetPrivate(folderArg) == NULL) { + // no private object in argument -> possibly it's an invalid object + throw DeviceAPI::Common::TypeMismatchException("Invalid first argument content."); + } + IMessageFolderPtr folder = converter->toIMessageFolder(folderArg); // argu 2. Success callback (optional & nullable) callbackManager->setOnSuccess(validator.toFunction(1, true)); @@ -797,12 +817,12 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func // argu 4. limit ( optional ) int limit = validator.toLong(3, true, -1); //sync limit - LogDebug("limit : " << limit); + LoggerD("limit : " << limit); IMessagingServicePtr imessagingService = priv->getObject(); //get MessagingService. MessageType msgType = (MessageType)imessagingService->getType(); - LogInfo("msgType :" << msgType); + LoggerI("msgType :" << msgType); if (msgType != EMAIL) { std::string errMessage = converter->toMessageType(imessagingService->getType()) + " not supported"; throw DeviceAPI::Common::NotSupportedException(errMessage.c_str()); @@ -817,7 +837,7 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func event->m_sync_folder_id = folder->getId(); //it will be changed to the folder ptr } - LogDebug("folderName : " << event->m_folder_name); + LoggerD("folderName : " << event->m_folder_name); event->opId = imessagingService->createOpId(MESSAGING_SERVICE_OP_SYNC_FOLDER); event->m_sync_account_id = imessagingService->getAccountID() ; event->m_sync_limit = limit; @@ -834,16 +854,16 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func return JSUtil::toJSValueRef(context, (long int)event->opId); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -852,7 +872,7 @@ JSValueRef JSMessagingService::syncFolder(JSContextRef context, JSObjectRef func JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); //get private object @@ -861,13 +881,13 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef IMessagingServicePtr imessagingService = priv->getObject(); Try { - LogInfo(">>> argument count : " << argumentCount); + LoggerI(">>> argument count : " << argumentCount); if ( argumentCount == 1 && !Validator(context).isCallback(arguments[0])) { ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); MessageType msgType = (MessageType)imessagingService->getType(); - LogInfo("msgType :" << msgType); + LoggerI("msgType :" << msgType); int opId = converter->toLong( arguments[0] ); //Fetch operation ID int handle = imessagingService->getHandleFromOpId(opId); @@ -877,14 +897,14 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef } int opType = imessagingService->getOpTypeFromOpId(opId); - LogInfo("operation ID :" << opId << " operation Type : " << opType); + LoggerI("operation ID :" << opId << " operation Type : " << opType); if ( opType == MESSAGING_SERVICE_OP_SEND_MESSAGE) { IMessagePtr msg = imessagingService->getMessageFromOpId(opId); if (msg) { - LogDebug("Call Cancel Function"); + LoggerD("Call Cancel Function"); msg->sendCancel(handle); imessagingService->deleteOpId(opId); } @@ -898,22 +918,22 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef if ( opType == MESSAGING_SERVICE_OP_DOWNLOAD_BODY ) { - LogDebug("Cancel Download Body , handle = " << handle); + LoggerD("Cancel Download Body , handle = " << handle); email->downloadBodyCancel(handle); } else if ( opType == MESSAGING_SERVICE_OP_DOWNLOAD_ATTACHMENT) { - LogDebug("Cancel Download Attachment , handle = " << handle); + LoggerD("Cancel Download Attachment , handle = " << handle); email->downloadAttachmentCancel(handle); } else if ( opType == MESSAGING_SERVICE_OP_SYNC ) { - LogDebug("Cancel Sync , handle = " << handle); + LoggerD("Cancel Sync , handle = " << handle); imessagingService->syncCancel(handle); } else if ( opType == MESSAGING_SERVICE_OP_SYNC_FOLDER ) { - LogDebug("Cancel Sync Folder, handle = " << handle); + LoggerD("Cancel Sync Folder, handle = " << handle); imessagingService->syncFolderCancel(handle); } imessagingService->deleteOpId(opId); @@ -932,22 +952,22 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef } Catch (WrtDeviceApis::Commons::InvalidArgumentException){ - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT); } Catch (WrtDeviceApis::Commons::NotFoundException){ - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, JSMESSAGING_EXCEPTION_MSG_NOT_FOUND); } Catch (WrtDeviceApis::Commons::UnsupportedException){ - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, JSMESSAGING_EXCEPTION_MSG_NOT_SUPPORTED); } Catch (WrtDeviceApis::Commons::Exception){ - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } @@ -955,12 +975,12 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef } else { - LogDebug(" Private Object is NULL "); + LoggerD(" Private Object is NULL "); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, JSMESSAGING_EXCEPTION_MSG_NOT_FOUND); } - LogDebug(">>>"); + LoggerD(">>>"); return JSValueMakeUndefined(context); } #endif @@ -968,11 +988,11 @@ JSValueRef JSMessagingService::cancelOperation(JSContextRef context, JSObjectRef JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); JSMessagingServicePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -982,13 +1002,13 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi // argu 1. opId int opId = validator.toLong(0); - LogDebug("opId : " << opId); + LoggerD("opId : " << opId); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); IMessagingServicePtr imessagingService = priv->getObject(); MessageType msgType = (MessageType)imessagingService->getType(); - LogInfo("msgType :" << msgType); + LoggerI("msgType :" << msgType); if (msgType != EMAIL) { std::string errMessage = converter->toMessageType(imessagingService->getType()) + " not supported"; throw DeviceAPI::Common::NotSupportedException(errMessage.c_str()); @@ -997,20 +1017,21 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi int handle = imessagingService->getHandleFromOpId(opId); if ( handle < 0 ) { - throw DeviceAPI::Common::InvalidValuesException("Operation ID Not found"); + LogInfo("operation ID is not found : " << opId); + return JSValueMakeUndefined(context); } int opType = imessagingService->getOpTypeFromOpId(opId); - LogInfo("operation ID :" << opId << " operation Type : " << opType); + LoggerI("operation ID :" << opId << " operation Type : " << opType); if ( opType == MESSAGING_SERVICE_OP_SYNC ) { - LogDebug("Cancel Sync , handle = " << handle); + LoggerD("Cancel Sync , handle = " << handle); imessagingService->syncCancel(handle); } else if ( opType == MESSAGING_SERVICE_OP_SYNC_FOLDER ) { - LogDebug("Cancel Sync Folder, handle = " << handle); + LoggerD("Cancel Sync Folder, handle = " << handle); imessagingService->syncFolderCancel(handle); } else @@ -1022,7 +1043,7 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi EventMessagingServicePtr event = imessagingService->getEventFromOpId(opId); if (event) { - LogDebug("get callback Manager"); + LoggerD("get callback Manager"); EventMessagingServicePrivateDataPtr privateData = DPL::StaticPointerCast(event->getPrivateData()); @@ -1030,7 +1051,7 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi JSContextRef globalContext = callbackManager->getContext(); if (callbackManager) { - LogDebug("call error callback."); + LoggerD("call error callback."); callbackManager->callOnError(JSDOMExceptionFactory::AbortException.make(globalContext, JSMESSAGING_EXCEPTION_MSG_ABORT_ERROR)); } } @@ -1038,11 +1059,11 @@ JSValueRef JSMessagingService::stopSync(JSContextRef context, JSObjectRef functi imessagingService->deleteOpId(opId); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } diff --git a/src/Messaging/JSMessagingServiceManager.cpp b/src/Messaging/JSMessagingServiceManager.cpp index 28c9bca..b94c732 100644 --- a/src/Messaging/JSMessagingServiceManager.cpp +++ b/src/Messaging/JSMessagingServiceManager.cpp @@ -90,7 +90,7 @@ namespace Messaging { } void JSMessagingServiceManager::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("creation messaging instance"); + LoggerD("creation messaging instance"); JSMessagingServiceManagerPriv *priv = static_cast(JSObjectGetPrivate(object)); if (priv == NULL) @@ -99,20 +99,20 @@ namespace Messaging { priv = new JSMessagingServiceManagerPriv( context, MessagingServiceManager); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } else { - LogDebug("already exist"); - LogDebug("global context=" << priv->getContext()); + LoggerD("already exist"); + LoggerD("global context=" << priv->getContext()); } } void JSMessagingServiceManager::finalize(JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); JSMessagingServiceManagerPriv* priv = static_cast(JSObjectGetPrivate(object)); MessagingListener::getInstance().deregisterMessageReceivedEmitter(); @@ -120,7 +120,7 @@ namespace Messaging { JSObjectSetPrivate(object, NULL); delete priv; // object will be deleted, but used to show that private object is deleted } - LogDebug("Leave"); + LoggerD("Leave"); } @@ -140,11 +140,11 @@ JSValueRef JSMessagingServiceManager::getMessagingServices(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); JSMessagingServiceManagerPriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -161,7 +161,7 @@ JSValueRef JSMessagingServiceManager::getMessagingServices(JSContextRef context, callbackManager->setOnSuccess(validator.toFunction(1)); callbackManager->setOnError(validator.toFunction(2, true)); - LogDebug("Messaging Service Type: " << messagingType); + LoggerD("Messaging Service Type: " << messagingType); // JSCallbackManager contains function pointers of successCallback and errorCallback. // The function pointers is be using to return results to Javascriptcore. So JSCallbackManager should be executed by main thread. @@ -181,11 +181,11 @@ JSValueRef JSMessagingServiceManager::getMessagingServices(JSContextRef context, MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, gContext); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } diff --git a/src/Messaging/JSMessagingStorage.cpp b/src/Messaging/JSMessagingStorage.cpp index f335739..89e2ce5 100644 --- a/src/Messaging/JSMessagingStorage.cpp +++ b/src/Messaging/JSMessagingStorage.cpp @@ -109,17 +109,17 @@ const JSClassRef JSMessagingStorage::getClassRef() void JSMessagingStorage::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("creation messaging instance"); + LoggerD("creation messaging instance"); } void JSMessagingStorage::finalize(JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { - LogDebug("deleting private object (messaging)"); + LoggerD("deleting private object (messaging)"); // for messaging object, private object is shared pointer, so will be deleted automatically delete priv; // object will be deleted, but used to show that private object is deleted @@ -135,7 +135,7 @@ bool JSMessagingStorage::hasInstance(JSContextRef context, JSObjectRef construct #if 0 JSValueRef JSMessagingStorage::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("<<< "); + LoggerD("<<< "); JSValueRef retVal = NULL; Try @@ -143,22 +143,22 @@ bool JSMessagingStorage::hasInstance(JSContextRef context, JSObjectRef construct Converter convert(context); if (JSStringIsEqualToUTF8CString(propertyName, "FOLDER_INBOX")) { - LogDebug("FOLDER_INBOX" << ":" << "1"); + LoggerD("FOLDER_INBOX" << ":" << "1"); retVal = convert.toJSValueRef(INBOX); } else if (JSStringIsEqualToUTF8CString(propertyName, "FOLDER_OUTBOX")) { - LogDebug("FOLDER_OUTBOX" << ":" << "2"); + LoggerD("FOLDER_OUTBOX" << ":" << "2"); retVal = convert.toJSValueRef(OUTBOX); } else if (JSStringIsEqualToUTF8CString(propertyName, "FOLDER_DRAFTS")) { - LogDebug("FOLDER_DRAFTS" << ":" << "3"); + LoggerD("FOLDER_DRAFTS" << ":" << "3"); retVal = convert.toJSValueRef(DRAFTBOX); } else if (JSStringIsEqualToUTF8CString(propertyName, "FOLDER_SENTBOX")) { - LogDebug("FOLDER_SENTBOX" << ":" << "4"); + LoggerD("FOLDER_SENTBOX" << ":" << "4"); retVal = convert.toJSValueRef(SENTBOX); } else @@ -168,12 +168,12 @@ bool JSMessagingStorage::hasInstance(JSContextRef context, JSObjectRef construct } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN); } - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } #endif @@ -181,7 +181,7 @@ bool JSMessagingStorage::hasInstance(JSContextRef context, JSObjectRef construct JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -190,14 +190,14 @@ JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -205,7 +205,7 @@ JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -248,26 +248,26 @@ JSValueRef JSMessagingStorage::addDraftMessage(JSContextRef context, JSObjectRef MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -279,7 +279,7 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -288,14 +288,14 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -303,7 +303,7 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -368,26 +368,26 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -398,7 +398,7 @@ JSValueRef JSMessagingStorage::findMessages(JSContextRef context, JSObjectRef ob JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -407,14 +407,14 @@ JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -422,7 +422,7 @@ JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -472,26 +472,26 @@ JSValueRef JSMessagingStorage::removeMessages(JSContextRef context, JSObjectRef MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -503,7 +503,7 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -512,14 +512,14 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -527,7 +527,7 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -578,26 +578,26 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -608,7 +608,7 @@ JSValueRef JSMessagingStorage::updateMessages(JSContextRef context, JSObjectRef JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -617,14 +617,14 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -632,7 +632,7 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -697,26 +697,26 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -727,7 +727,7 @@ JSValueRef JSMessagingStorage::findConversations(JSContextRef context, JSObjectR JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -736,14 +736,14 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -751,7 +751,7 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -802,26 +802,26 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -832,7 +832,7 @@ JSValueRef JSMessagingStorage::removeConversations(JSContextRef context, JSObjec JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -841,14 +841,14 @@ JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef obj MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -856,7 +856,7 @@ JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef obj WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager(NULL); callbackManager = JSCallbackManager::createObject(priv->getContext()); if (!callbackManager) { - LogError("callbackManager is NULL."); + LoggerE("callbackManager is NULL."); DeviceAPI::Common::UnknownException err("callbackManager is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -903,26 +903,26 @@ JSValueRef JSMessagingStorage::findFolders(JSContextRef context, JSObjectRef obj MessageAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, priv->getContext()); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::NullPointerException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -934,7 +934,7 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -943,14 +943,14 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -975,7 +975,7 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Messages Change Callback ( mandatory ) - functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0)); + functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0), MESSAGES_MULTI_FUNCTION); funtionIndex = functionResult.functionIndex; if(funtionIndex < 0) { @@ -983,8 +983,10 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J } onSuccessForCbm = functionResult.messagesAdded; - messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); - messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); + if(functionResult.messagesUpdated) + messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); + if(functionResult.messagesRemoved) + messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); EventOnMessagingStorageChangesPrivateDataPtr privData( new EventOnMessagingStorageChangesPrivateData(callbackManager, messagesUpdatedCbm, messagesRemovedCbm, funtionIndex)); @@ -1023,31 +1025,31 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J return JSValueMakeNumber(context, id); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::UnsupportedException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::AlreadyInUseException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -1056,7 +1058,7 @@ JSValueRef JSMessagingStorage::addMessagesChangeListener(JSContextRef context, J JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -1065,14 +1067,14 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -1097,7 +1099,7 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Messages Change Callback ( mandatory ) - functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0)); + functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0), CONVERSATIONS_MULTI_FUNCTION); funtionIndex = functionResult.functionIndex; if(funtionIndex < 0) { @@ -1105,8 +1107,10 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte } onSuccessForCbm = functionResult.messagesAdded; - messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); - messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); + if(functionResult.messagesUpdated) + messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); + if(functionResult.messagesRemoved) + messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); EventOnMessagingStorageChangesPrivateDataPtr privData( new EventOnMessagingStorageChangesPrivateData(callbackManager, messagesUpdatedCbm, messagesRemovedCbm, funtionIndex)); @@ -1146,31 +1150,31 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::UnsupportedException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::AlreadyInUseException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -1180,7 +1184,7 @@ JSValueRef JSMessagingStorage::addConversationsChangeListener(JSContextRef conte JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -1189,14 +1193,14 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -1220,7 +1224,7 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS ArgumentValidator validator(context, argumentCount, arguments); // argu 1. Messages Change Callback ( mandatory ) - functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0)); + functionResult = converter->toMessageMultifunctions(validator.toJSValueRef(0), FOLDERS_MULTI_FUNCTION); funtionIndex = functionResult.functionIndex; if(funtionIndex < 0) { @@ -1228,8 +1232,10 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS } onSuccessForCbm = functionResult.messagesAdded; - messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); - messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); + if(functionResult.messagesUpdated) + messagesUpdatedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesUpdated, NULL); + if(functionResult.messagesRemoved) + messagesRemovedCbm = JSCallbackManager::createObject(priv->getContext(), functionResult.messagesRemoved, NULL); EventOnMessagingStorageChangesPrivateDataPtr privData( new EventOnMessagingStorageChangesPrivateData(callbackManager, messagesUpdatedCbm, messagesRemovedCbm, funtionIndex)); @@ -1268,31 +1274,31 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS return JSValueMakeNumber(context, id); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::UnsupportedException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::AlreadyInUseException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } @@ -1301,7 +1307,7 @@ JSValueRef JSMessagingStorage::addFoldersChangeListener(JSContextRef context, JS JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered"); + LoggerD("Entered"); //check permission. AceSecurityStatus status = MESSAGING_CHECK_ACCESS( @@ -1310,14 +1316,14 @@ JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObje MessagingStoragePriv* priv = static_cast(JSObjectGetPrivate(thisObject)); if (!priv) { - LogError("Private object is NULL."); + LoggerE("Private object is NULL."); DeviceAPI::Common::UnknownException err("Private object is NULL."); return JSWebAPIError::throwException(context, exception, err); } MessagingStoragePrivObjPtr objectPriv = priv->getObject(); if (!objectPriv) { - LogError("objectPriv is NULL."); + LoggerE("objectPriv is NULL."); DeviceAPI::Common::UnknownException err("objectPriv is NULL."); return JSWebAPIError::throwException(context, exception, err); } @@ -1333,28 +1339,35 @@ JSValueRef JSMessagingStorage::removeChangeListener(JSContextRef context, JSObje // argu 1. watchId ( mandatory ) long handler = validator.toLong(0); - MessagingListener::getInstance().removeIncomingMsgCallback(handler, objectPriv->getType(), objectPriv->getIndex()); + try{ + MessagingListener::getInstance().removeIncomingMsgCallback(handler, objectPriv->getType(), objectPriv->getIndex()); + } + catch(const WrtDeviceApis::Commons::NotFoundException& exc) + { + LogError(exc.GetMessage().c_str()); + return JSValueMakeUndefined(context); + } MessageListenerCancellerPtr canceller = MessageListenerCancellerPtr(new MessageListenerCanceller(priv->getContext(), thisObject, objectPriv->getIndex())); IListenerItemPtr listenerItem = DPL::StaticPointerCast(canceller); MessageListenerManagerSingleton::Instance().unregisterListener(listenerItem); } catch(const BasePlatformException& err) { - LogError(err.getMessage().c_str()); + LoggerE(err.getMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::ConversionException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::TypeMismatchException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::InvalidArgumentException& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::InvalidValuesException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } catch (const WrtDeviceApis::Commons::Exception& exc) { - LogError(exc.GetMessage().c_str()); + LoggerE(exc.GetMessage().c_str()); DeviceAPI::Common::UnknownException err(exc.GetMessage().c_str()); return JSWebAPIError::throwException(context, exception, err); } diff --git a/src/Messaging/JSRecipientArray.cpp b/src/Messaging/JSRecipientArray.cpp old mode 100755 new mode 100644 index 27a898a..b1776a7 --- a/src/Messaging/JSRecipientArray.cpp +++ b/src/Messaging/JSRecipientArray.cpp @@ -15,10 +15,10 @@ // limitations under the License. // -#include #include "JSRecipientArray.h" #include #include +#include namespace { const char* FUNCTION_CONCAT = "concat"; @@ -86,7 +86,7 @@ JSValueRef JSRecipientArray::getLength(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); Try { JSRecipientArrayPrivate* priv = @@ -100,7 +100,7 @@ JSValueRef JSRecipientArray::getLength(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid conversion"); + LoggerE("invalid conversion"); } return JSValueMakeUndefined(context); } @@ -111,7 +111,7 @@ RecipientsPtr JSRecipientArray::getRecipients(JSContextRef context, JSRecipientArrayPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { - LogError("Array contains no private object"); + LoggerE("Array contains no private object"); ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Array contains no private object"); } return priv->getObject(); @@ -142,12 +142,12 @@ JSClassRef JSRecipientArray::getClassRef() void JSRecipientArray::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); } void JSRecipientArray::finalize(JSObjectRef object) { - LogDebug("enter"); + LoggerD("enter"); JSRecipientArrayPrivate* priv = static_cast(JSObjectGetPrivate(object)); delete priv; @@ -163,7 +163,7 @@ bool JSRecipientArray::hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::Converter converter(context); Try { @@ -190,7 +190,7 @@ JSValueRef JSRecipientArray::getProperty(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::Converter converter(context); Try { @@ -210,7 +210,7 @@ JSValueRef JSRecipientArray::getProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("invalid property"); + LoggerE("invalid property"); } return JSValueMakeUndefined(context); } @@ -221,7 +221,7 @@ bool JSRecipientArray::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::Converter converter(context); Try { @@ -231,7 +231,7 @@ bool JSRecipientArray::setProperty(JSContextRef context, address = converter.toString(value); } if (!checkValue(address)) { - LogError("trying to assing invalid value"); + LoggerE("trying to assing invalid value"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } JSRecipientArrayPrivate* priv = @@ -244,7 +244,7 @@ bool JSRecipientArray::setProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("error occured"); + LoggerE("error occured"); } return false; } @@ -256,7 +256,7 @@ JSValueRef JSRecipientArray::concat(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -267,7 +267,7 @@ JSValueRef JSRecipientArray::join(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -278,7 +278,7 @@ JSValueRef JSRecipientArray::pop(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -289,7 +289,7 @@ JSValueRef JSRecipientArray::push(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -300,7 +300,7 @@ JSValueRef JSRecipientArray::reverse(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -311,7 +311,7 @@ JSValueRef JSRecipientArray::shift(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -322,7 +322,7 @@ JSValueRef JSRecipientArray::slice(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -333,7 +333,7 @@ JSValueRef JSRecipientArray::sort(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -344,7 +344,7 @@ JSValueRef JSRecipientArray::splice(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -355,7 +355,7 @@ JSValueRef JSRecipientArray::toString(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -366,7 +366,7 @@ JSValueRef JSRecipientArray::unshift(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } @@ -377,7 +377,7 @@ JSValueRef JSRecipientArray::valueOf(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); return JSValueMakeUndefined(context); } } diff --git a/src/Messaging/MailSender.cpp b/src/Messaging/MailSender.cpp index 521e8a3..adc8a83 100644 --- a/src/Messaging/MailSender.cpp +++ b/src/Messaging/MailSender.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include "MailSender.h" #include "NetworkStatus.h" #include "Messaging.h" +#include namespace { const char* DBUS_FILTER_NETWORK_STATUS = @@ -55,7 +55,7 @@ int MailSender::send(const IEmailPtr& mail) Assert(mail && "Mail must not be NULL."); int mailId = mail->convertId(mail->getIdRef()); - LogDebug("send mailId = " << mailId); + LoggerD("send mailId = " << mailId); SendRequestsIterator it = m_requests.find(mailId); if (m_requests.end() != it) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -71,7 +71,7 @@ void MailSender::cancel(int handle) if (m_requests.end() == it) { //ThrowMsg(WrtDeviceApis::Commons::PlatformException, // "Email handle : " << handle << " not found."); - LogDebug("Email handle" << handle << " not found!"); + LoggerD("Email handle" << handle << " not found!"); return; } else @@ -83,10 +83,10 @@ void MailSender::cancel(int handle) // TODO Copied from former solution, refactor it. void MailSender::OnEventReceived(const DBus::MessageEvent& event) { - LogDebug("enter"); + LoggerD("enter"); NetworkStatusPtr msg(new NetworkStatus(event.GetArg0())); int mailId = msg->getMailId(); - LogDebug("status : " << msg->getStatus() << " mailId : " << mailId); + LoggerD("status : " << msg->getStatus() << " mailId : " << mailId); int handle = 0; if ( msg->getStatus() == NOTI_SEND_FINISH || msg->getStatus() == NOTI_SEND_FAIL) @@ -98,37 +98,37 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event) if ( it->second.mail->getUID() == mailId) { handle = it->first; - LogDebug("handle : " << handle); + LoggerD("handle : " << handle); break; } } if (msg->getStatus() == NOTI_SEND_FAIL) { - LogDebug(" Error Code : " << msg->getErrorCode()); + LoggerD(" Error Code : " << msg->getErrorCode()); } } else { if ( msg->getStatus() == NOTI_SEND_START ) { - LogDebug("NOTI_SEND_START"); + LoggerD("NOTI_SEND_START"); } else if ( msg->getStatus() == NOTI_SEND_CANCEL ) { - LogDebug("NOTI_SEND_CANCEL"); + LoggerD("NOTI_SEND_CANCEL"); } return ; } - LogDebug("handle : " << handle); + LoggerD("handle : " << handle); SendRequestsIterator it = m_requests.find(handle); //find reqeuset if (m_requests.end() != it) { switch (msg->getStatus()) { case NOTI_SEND_START: - LogInfo("Start sending e-mail: " << mailId); + LoggerI("Start sending e-mail: " << mailId); break; case NOTI_SEND_FINISH: @@ -157,7 +157,7 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event) } mail->setMessageStatus(MESSAGE_STATUS_SENT); - LogInfo("E-mail sent: " << mailId); + LoggerI("E-mail sent: " << mailId); m_requests.erase(mailId); break; } @@ -205,7 +205,7 @@ void MailSender::OnEventReceived(const DBus::MessageEvent& event) } mail->setMessageStatus(MESSAGE_STATUS_FAILED); - LogInfo("Sending e-mail: " << mailId << + LoggerI("Sending e-mail: " << mailId << " failed with error: " << msg->getErrorCode()); m_requests.erase(mailId); break; @@ -218,7 +218,7 @@ MailSender::MailSender() : m_dbusThread(new DPL::Thread()), m_dbus(new DBus::Connection()) { - LogDebug("enter"); + LoggerD("enter"); m_dbusThread->Run(); m_dbus->setWorkerThread(m_dbusThread.Get()); @@ -231,16 +231,16 @@ MailSender::MailSender() : //start email service if (EMAIL_ERROR_NONE == email_service_begin()) { - LogDebug("Email service Begin\n"); + LoggerD("Email service Begin\n"); if (EMAIL_ERROR_NONE == email_open_db()) { - LogDebug("Email open DB success\n"); + LoggerD("Email open DB success\n"); } else{ - LogDebug("Email open DB failed\n"); + LoggerD("Email open DB failed\n"); } } else{ - LogDebug("Email service not started\n"); + LoggerD("Email service not started\n"); } } @@ -255,16 +255,16 @@ MailSender::~MailSender() //close email service if (EMAIL_ERROR_NONE == email_close_db()) { - LogDebug("Email Close DB Success\n"); + LoggerD("Email Close DB Success\n"); if (EMAIL_ERROR_NONE == email_service_end()){ - LogDebug("Email service close Success\n"); + LoggerD("Email service close Success\n"); } else{ - LogDebug("Email service end failed\n"); + LoggerD("Email service end failed\n"); } } else{ - LogDebug("Email Close DB failed\n"); + LoggerD("Email Close DB failed\n"); } } @@ -281,7 +281,7 @@ int MailSender::sendInternal(const IEmailPtr& mail) &email_handle); if (EMAIL_ERROR_NONE != error) { - LogDebug("Send Fail error = " << error ); + LoggerD("Send Fail error = " << error ); m_requests.erase(mailId); mail->setMessageStatus(MESSAGE_STATUS_SENDING); ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -293,7 +293,7 @@ int MailSender::sendInternal(const IEmailPtr& mail) m_requests.insert(std::make_pair(email_handle, SendRequestData(email_handle, mail))); } - LogDebug("emf Handle : " << email_handle + LoggerD("emf Handle : " << email_handle << "requests size :" << m_requests.size() ); return email_handle; diff --git a/src/Messaging/MailSync.cpp b/src/Messaging/MailSync.cpp index d94752d..0a25b04 100644 --- a/src/Messaging/MailSync.cpp +++ b/src/Messaging/MailSync.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -37,6 +36,8 @@ #include #include +#include + namespace { const char* DBUS_FILTER_NETWORK_STATUS = "type='signal',interface='User.Email.NetworkStatus'"; @@ -72,17 +73,17 @@ MailSync::MailSync() : //start email service int error = email_service_begin(); if (error == EMAIL_ERROR_NONE) { - LogDebug("Email service Begin\n"); + LoggerD("Email service Begin\n"); if (EMAIL_ERROR_NONE == email_open_db()) { - LogDebug("Email open DB success\n"); + LoggerD("Email open DB success\n"); } else{ - LogDebug("Email open DB failed\n"); + LoggerD("Email open DB failed\n"); } } else{ - LogDebug("Email service not started\n"); - LogDebug("Error : " << error); + LoggerD("Email service not started\n"); + LoggerD("Error : " << error); } //get retriving count @@ -91,7 +92,7 @@ MailSync::MailSync() : if ( slot_size > 0 ) m_default_slot_size = slot_size; - LogDebug( "Slot Size : " << m_default_slot_size ); + LoggerD( "Slot Size : " << m_default_slot_size ); } @@ -104,18 +105,18 @@ MailSync::~MailSync() //close email service if (EMAIL_ERROR_NONE == email_close_db()) { - LogDebug("Email Close DB Success\n"); + LoggerD("Email Close DB Success\n"); if (EMAIL_ERROR_NONE == email_service_end()) { - LogDebug("Email service close Success\n"); + LoggerD("Email service close Success\n"); } else { - LogDebug("Email service end failed\n"); + LoggerD("Email service end failed\n"); } } else{ - LogDebug("Email Close DB failed\n"); + LoggerD("Email Close DB failed\n"); } } @@ -124,21 +125,21 @@ int MailSync::downloadBody( const IEmailPtr& mail ) if ( mail ) { int mailId = mail->convertId(mail->getIdRef()); // get mail id - LogDebug("start attachment, mail Id : " << mail->getIdRef()); + LoggerD("start attachment, mail Id : " << mail->getIdRef()); SyncRequestIterator it; int synType; for( it = m_SyncRequests.begin(); it != m_SyncRequests.end(); ++it) { synType = it->second.syncType; - LogDebug("synType : " << synType); + LoggerD("synType : " << synType); if( synType != MESSAGING_SERVICE_SYNC_TYPE_DOWNLOAD_BODY ) { - LogDebug("skip"); + LoggerD("skip"); continue; } const IEmailPtr& email = it->second.mail; - LogDebug ( "Requests mail ID:" << mail->convertId(email->getIdRef()) ); + LoggerD ( "Requests mail ID:" << mail->convertId(email->getIdRef()) ); if ( mailId == mail->convertId(email->getIdRef())) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -164,7 +165,7 @@ void MailSync::cancelDownloadBody(int handle) } else { - LogDebug("Don't find cancel DownloadBody handle : " << handle); + LoggerD("Don't find cancel DownloadBody handle : " << handle); //ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Email: " << mailId << " not found."); } @@ -183,7 +184,7 @@ void MailSync::cancelDownloadAttachment(int handle) } else { - LogDebug("Don't find cancel DownloadAttachment handle : " << handle); + LoggerD("Don't find cancel DownloadAttachment handle : " << handle); } } @@ -193,22 +194,22 @@ int MailSync::downloadAttachment(const IEmailPtr& mail, const IAttachmentPtr& at if ( mail && attachment ) { //int mailId = mail->convertId(mail->getIdRef()); // get mail id - LogDebug("start attachment, mail Id : " << mail->getIdRef()); + LoggerD("start attachment, mail Id : " << mail->getIdRef()); SyncRequestIterator it; int synType; for( it = m_SyncRequests.begin(); it != m_SyncRequests.end(); ++it) { synType = it->second.syncType; - LogDebug("synType : " << synType); + LoggerD("synType : " << synType); if( synType != MESSAGING_SERVICE_SYNC_TYPE_DOWNLOAD_ATTACHMENT ) { - LogDebug("skip"); + LoggerD("skip"); continue; } const IAttachmentPtr& iattachment = it->second.attachment; - LogDebug ( "Requests Attachment ID:" << iattachment->getAttachmentID() << " Input Attachment ID: " << attachment->getAttachmentID()); + LoggerD ( "Requests Attachment ID:" << iattachment->getAttachmentID() << " Input Attachment ID: " << attachment->getAttachmentID()); if (iattachment->getAttachmentID() == attachment->getAttachmentID()) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -223,28 +224,28 @@ int MailSync::downloadAttachment(const IEmailPtr& mail, const IAttachmentPtr& at int MailSync::syncAccount(const IMessagingServicePtr& messagingService, const int limit) { - LogDebug("syncAccount : " << limit); + LoggerD("syncAccount : " << limit); if (messagingService) { int accountId = messagingService->getAccountID(); - LogDebug("start sync, account Id : " << accountId); + LoggerD("start sync, account Id : " << accountId); SyncRequestIterator it; int synType; for( it = m_SyncRequests.begin(); it != m_SyncRequests.end(); ++it) { synType = it->second.syncType; - LogDebug("synType : " << synType); + LoggerD("synType : " << synType); if( synType != MESSAGING_SERVICE_SYNC_TYPE_SYNC ) { - LogDebug("skip"); + LoggerD("skip"); continue; } const IMessagingServicePtr& messagingService = it->second.messagingService; if (messagingService && messagingService->getAccountID() == accountId) { - LogDebug("accountId is sync requested already"); + LoggerD("accountId is sync requested already"); // ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Sync: " << accountId << " already requested to be Sync Account."); } } @@ -252,16 +253,16 @@ int MailSync::syncAccount(const IMessagingServicePtr& messagingService, const in } else { - LogDebug("messagingService is NULL"); + LoggerD("messagingService is NULL"); } - LogDebug("end sync" ); + LoggerD("end sync" ); return -1; } int MailSync::syncAccountInternal( const IMessagingServicePtr& messagingService, const int limit) { - LogDebug("syncAccountInternal limit: " << limit); + LoggerD("syncAccountInternal limit: " << limit); int account_id = messagingService->getAccountID(); int err = 0; @@ -280,19 +281,19 @@ int MailSync::syncAccountInternal( const IMessagingServicePtr& messagingService, email_set_mail_slot_size(0, 0, slot_size); -// LogDebug("mailbox.account_id " << mailbox.account_id ); +// LoggerD("mailbox.account_id " << mailbox.account_id ); // err = email_sync_header(&mailbox, &email_handle); -// LogDebug("emf_handle " << emf_handle); +// LoggerD("emf_handle " << emf_handle); err = email_sync_header(account_id, 0, &email_handle); - LogDebug("email_handle " << email_handle); + LoggerD("email_handle " << email_handle); if (err != EMAIL_ERROR_NONE) { - LogDebug("fail to sync all folders - err : " << err); + LoggerD("fail to sync all folders - err : " << err); } else { - LogDebug("Insert sync request"); + LoggerD("Insert sync request"); SyncRequestData data = SyncRequestData(email_handle, MESSAGING_SERVICE_SYNC_TYPE_SYNC, messagingService); m_SyncRequests.insert(std::make_pair(email_handle, data)); } @@ -302,7 +303,7 @@ int MailSync::syncAccountInternal( const IMessagingServicePtr& messagingService, void MailSync::syncAccountCancel(const int handle) { - LogDebug("sync cancel"); + LoggerD("sync cancel"); Assert(handle > -1); SyncRequestIterator it = m_SyncRequests.find(handle); @@ -313,29 +314,29 @@ void MailSync::syncAccountCancel(const int handle) } else { - LogDebug("Don't find cancel Sync handle : " << handle); + LoggerD("Don't find cancel Sync handle : " << handle); //ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Email: " << mailId << " not found."); } } int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int folder_id, const int limit) { - LogDebug("sync folder : " << folder_id << " limit : " << limit); + LoggerD("sync folder : " << folder_id << " limit : " << limit); if (messagingService) { int accountId = messagingService->getAccountID(); - LogDebug("start sync, account Id : " << accountId); + LoggerD("start sync, account Id : " << accountId); SyncRequestIterator it; int synType; for( it = m_SyncRequests.begin(); it != m_SyncRequests.end(); ++it) { synType = it->second.syncType; - LogDebug("synType : " << synType); + LoggerD("synType : " << synType); if( synType != MESSAGING_SERVICE_SYNC_TYPE_SYNC_FOLDER ) { - LogDebug("skip"); + LoggerD("skip"); continue; } @@ -343,7 +344,7 @@ int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int if (messagingService && messagingService->getAccountID() == accountId && it->second.folderId == folder_id) { - LogDebug("accountId is syncFolder requested already"); + LoggerD("accountId is syncFolder requested already"); // ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Sync: " << accountId << " already requested to be Sync Account."); } } @@ -352,7 +353,7 @@ int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int } else { - LogDebug("messagingService is NULL"); + LoggerD("messagingService is NULL"); } return -1; @@ -361,7 +362,7 @@ int MailSync::syncFolder(const IMessagingServicePtr& messagingService, const int void MailSync::syncFolderCancel(const int handle) { - LogDebug("sync Folder Cancel"); + LoggerD("sync Folder Cancel"); Assert(handle > -1); SyncRequestIterator it = m_SyncRequests.find(handle); @@ -372,14 +373,14 @@ void MailSync::syncFolderCancel(const int handle) } else { - LogDebug("Don't find cancel Sync Folder handle : " << handle); + LoggerD("Don't find cancel Sync Folder handle : " << handle); //ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Email: " << mailId << " not found."); } } int MailSync::syncFolderInternal(const IMessagingServicePtr& messagingService, const int folder_id, const int limit) { - LogDebug("Folder Id=" << folder_id << " limit : " << limit); + LoggerD("Folder Id=" << folder_id << " limit : " << limit); int account_id = messagingService->getAccountID(); @@ -416,11 +417,11 @@ int MailSync::syncFolderInternal(const IMessagingServicePtr& messagingService, c // err = email_sync_header(mailbox, &email_handle); err = email_sync_header(account_id, mailbox->mailbox_id, &email_handle); if (err != EMAIL_ERROR_NONE) { - LogDebug("fail to sync folders - err : " << err); + LoggerD("fail to sync folders - err : " << err); } else { - LogDebug("Insert sync request"); + LoggerD("Insert sync request"); SyncRequestData data = SyncRequestData(email_handle, MESSAGING_SERVICE_SYNC_TYPE_SYNC_FOLDER, messagingService, folder_id); m_SyncRequests.insert(std::make_pair(email_handle, data)); @@ -432,7 +433,7 @@ int MailSync::syncFolderInternal(const IMessagingServicePtr& messagingService, c if ( mailbox != NULL ) { if ( EMAIL_ERROR_NONE != email_free_mailbox( &mailbox , 1) ) - LogDebug("fail to email_free_mailbox - err "); + LoggerD("fail to email_free_mailbox - err "); mailbox = NULL; } @@ -443,25 +444,25 @@ int MailSync::syncFolderInternal(const IMessagingServicePtr& messagingService, c // TODO Copied from former solution, refactor it. void MailSync::OnEventReceived(const DBus::MessageEvent& event) { - LogDebug("OnEventReceived"); + LoggerD("OnEventReceived"); SyncNetworkStatusPtr syncNetworkStatus(new SyncNetworkStatus(event.GetArg0())); int mailId = syncNetworkStatus->getMailId(); //if email body download mode. int status = syncNetworkStatus->getStatus(); int handle = syncNetworkStatus->getHandle(); - LogDebug("mailId : " << mailId << " status : " << status << " handle : " << handle); + LoggerD("mailId : " << mailId << " status : " << status << " handle : " << handle); // if Attachment Load if ( status == NOTI_DOWNLOAD_ATTACH_FINISH ||status == NOTI_DOWNLOAD_ATTACH_FAIL ) { int nth = handle; - LogDebug(" Debus mailID = " << mailId << " , Nth = " << nth ); + LoggerD(" Debus mailID = " << mailId << " , Nth = " << nth ); SyncRequestIterator it = m_SyncRequests.begin(); for ( ; it != m_SyncRequests.end(); it++ ) { const IEmailPtr& mail = it->second.mail; - LogDebug(" request mailID = " << mail->getUID() << " , Nth = " << (it->second.attachment)->getNth() ); + LoggerD(" request mailID = " << mail->getUID() << " , Nth = " << (it->second.attachment)->getNth() ); if ( mail->getUID() == mailId && nth == (it->second.attachment)->getNth()) { EventMessagingServiceReqReceiver* requestReceiver = mail->getRequestReceiver(); @@ -472,24 +473,24 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) if (status == NOTI_DOWNLOAD_ATTACH_FINISH) { - LogDebug(" Attachment Finish " ); + LoggerD(" Attachment Finish " ); const IAttachmentPtr& attachment = it->second.attachment; if (attachment) { email_attachment_data_t* attachment_data = NULL; int attachmentId = attachment->getAttachmentID(); - LogDebug("Attachment ID = " << attachmentId); + LoggerD("Attachment ID = " << attachmentId); int err = email_get_attachment_data(attachmentId, &attachment_data); if (err == EMAIL_ERROR_NONE) { - LogDebug("attachment Name : " << attachment_data->attachment_name); - LogDebug("attachment ID : " << attachment_data->attachment_id); + LoggerD("attachment Name : " << attachment_data->attachment_name); + LoggerD("attachment ID : " << attachment_data->attachment_id); attachment->init(attachment_data->attachment_path, false); } else { - LogDebug("fail to email_get_attachment_data - err : " << err); + LoggerD("fail to email_get_attachment_data - err : " << err); } if ( attachment_data != NULL ) @@ -503,11 +504,11 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) else { event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException); - LogDebug(" Attachment Failed " ); + LoggerD(" Attachment Failed " ); } - LogDebug("remove downloadAttachment request"); - LogDebug("handle : " << it->first ); + LoggerD("remove downloadAttachment request"); + LoggerD("handle : " << it->first ); requestReceiver->ManualAnswer(event); m_SyncRequests.erase(it->first); @@ -518,7 +519,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) } else if ( status == NOTI_DOWNLOAD_ATTACH_START ) { - LogDebug("DownLoading... attachment : size = " << syncNetworkStatus->getErrorCode()); + LoggerD("DownLoading... attachment : size = " << syncNetworkStatus->getErrorCode()); return; } @@ -526,13 +527,13 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) if ( m_SyncRequests.end() != it) { int syncType = it->second.syncType; - LogDebug(" Sync ... handle : " << handle << " status : " << status << " SyncType: " << syncType); + LoggerD(" Sync ... handle : " << handle << " status : " << status << " SyncType: " << syncType); switch(syncType) { case MESSAGING_SERVICE_SYNC_TYPE_SYNC: { - LogDebug(" Sync Account"); + LoggerD(" Sync Account"); const IMessagingServicePtr& messagingService = it->second.messagingService; EventMessagingServiceReqReceiver* requestReceiver = messagingService->getRequestReceiver(); @@ -544,13 +545,13 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) { if ( status == NOTI_DOWNLOAD_FINISH ) { - LogDebug("Sync Success"); + LoggerD("Sync Success"); requestReceiver->ManualAnswer(event); m_SyncRequests.erase( handle ); } else if ( status == NOTI_DOWNLOAD_FAIL ) { - LogDebug("Sync Fail"); + LoggerD("Sync Fail"); event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException ); requestReceiver->ManualAnswer(event); m_SyncRequests.erase( handle ); @@ -565,7 +566,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) } case MESSAGING_SERVICE_SYNC_TYPE_SYNC_FOLDER: { - LogDebug("Sync Folder"); + LoggerD("Sync Folder"); const IMessagingServicePtr& messagingService = it->second.messagingService; EventMessagingServiceReqReceiver* requestReceiver = messagingService->getRequestReceiver(); @@ -576,13 +577,13 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) { if ( status == NOTI_DOWNLOAD_FINISH ) { - LogDebug("Sync Success"); + LoggerD("Sync Success"); requestReceiver->ManualAnswer(event); m_SyncRequests.erase( handle ); } else if ( status == NOTI_DOWNLOAD_FAIL ) { - LogDebug("Sync Fail"); + LoggerD("Sync Fail"); event->setExceptionCode( WrtDeviceApis::Commons::ExceptionCodes::UnknownException ); requestReceiver->ManualAnswer(event); m_SyncRequests.erase( handle ); @@ -597,7 +598,7 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) } case MESSAGING_SERVICE_SYNC_TYPE_DOWNLOAD_BODY: { - LogDebug(" DownLoad Body"); + LoggerD(" DownLoad Body"); const IEmailPtr& mail = it->second.mail; // IEmailPtr EventMessagingServiceReqReceiver* requestReceiver = mail->getRequestReceiver(); if (mail && requestReceiver) { @@ -630,24 +631,24 @@ void MailSync::OnEventReceived(const DBus::MessageEvent& event) int MailSync::downloadBodyInternal( const IEmailPtr& mail, int account_id) { - LogDebug("downloadInternal"); + LoggerD("downloadInternal"); int err = 0; int mailId = mail->convertId(mail->getIdRef()); int email_handle = 0; - LogDebug("folder type = " << mail->getCurrentFolder()); - LogDebug("mail ID :" << mailId ); + LoggerD("folder type = " << mail->getCurrentFolder()); + LoggerD("mail ID :" << mailId ); err = email_download_body(mailId, 0, &email_handle); if (err != EMAIL_ERROR_NONE) { - LogDebug("fail to downloadBody - err : " << err); + LoggerD("fail to downloadBody - err : " << err); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to initialize downloadBody request. [" << err << "]"); } else { - LogDebug("Insert downloadBody request"); - LogDebug("handle : " << email_handle); + LoggerD("Insert downloadBody request"); + LoggerD("handle : " << email_handle); SyncRequestData data = SyncRequestData(email_handle, MESSAGING_SERVICE_SYNC_TYPE_DOWNLOAD_BODY, mail); m_SyncRequests.insert(std::make_pair(email_handle, data)); } @@ -658,7 +659,7 @@ int MailSync::downloadBodyInternal( const IEmailPtr& mail, int account_id) int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, const IAttachmentPtr& attachment) { - LogDebug("downloadAttachmentInternal"); + LoggerD("downloadAttachmentInternal"); Assert(mail); int err = 0; @@ -675,7 +676,7 @@ int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, "Couldn't find message " << mailId << ". [" << error << "]"); } - LogDebug("Attachment ID :" << attachment->getAttachmentID()); + LoggerD("Attachment ID :" << attachment->getAttachmentID()); //get nth std::vector attachments = mail->getAttachments(); @@ -683,10 +684,10 @@ int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, unsigned int attachmentSize = attachments.size(); unsigned int inlineAttachmentSize = inlineAttachments.size(); - LogDebug( "attachment sizes = " << attachmentSize << ",inline attachment size : " << inlineAttachmentSize); + LoggerD( "attachment sizes = " << attachmentSize << ",inline attachment size : " << inlineAttachmentSize); for ( unsigned int i = 0 ; i < attachmentSize ; i ++) { - LogDebug( "attachment ID is = " << attachments[i]->getAttachmentID()); + LoggerD( "attachment ID is = " << attachments[i]->getAttachmentID()); if (attachments[i]->getAttachmentID() == attachment->getAttachmentID()) { // nth = i; @@ -696,7 +697,7 @@ int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, } for ( unsigned int i = 0 ; i < inlineAttachmentSize ; i ++) { - LogDebug( "inline attachment ID is = " << inlineAttachments[i]->getAttachmentID()); + LoggerD( "inline attachment ID is = " << inlineAttachments[i]->getAttachmentID()); if (inlineAttachments[i]->getAttachmentID() == attachment->getAttachmentID()) { // nth = i; @@ -705,17 +706,17 @@ int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, } } - LogDebug("nth = " << nth); - LogDebug("attachment Order Index = " << nth); + LoggerD("nth = " << nth); + LoggerD("attachment Order Index = " << nth); err = email_download_attachment(mailId, nth , &email_handle); if (err != EMAIL_ERROR_NONE) { - LogDebug("fail to downloadAttachment - err : " << err); + LoggerD("fail to downloadAttachment - err : " << err); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to initialize downloadAttachment request. [" << err << "]"); } else { - LogDebug("Insert downloadAttachment request"); - LogDebug("handle : " << email_handle); + LoggerD("Insert downloadAttachment request"); + LoggerD("handle : " << email_handle); SyncRequestData data = SyncRequestData( email_handle, MESSAGING_SERVICE_SYNC_TYPE_DOWNLOAD_ATTACHMENT, mail, attachment ); m_SyncRequests.insert(std::make_pair(email_handle, data)); @@ -723,18 +724,18 @@ int MailSync::downloadAttachmentInternal(const IEmailPtr& mail, int account_id, if ( result ) if ( EMAIL_ERROR_NONE != email_free_mail_data( &result , 1) ) - LogDebug("fail to email_free_mail_data - err "); + LoggerD("fail to email_free_mail_data - err "); return email_handle; } void MailSync::cancelEmailJobInternal(int accountId, int handle) { - LogDebug("cancel Email Job, account : " < #include #include "Sms.h" #include "BinarySms.h" @@ -24,6 +23,7 @@ #include "EmptyMessage.h" #include "MessageFactory.h" #include "IAttachment.h" +#include using namespace std; using namespace WrtDeviceApis::Commons; @@ -36,7 +36,7 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, const std::string& id) { - LogInfo("enter"); + LoggerI("enter"); ISms* retSms = NULL; IMms* retMms =NULL; @@ -49,7 +49,7 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, switch (msgType) { case SMS: { - LogDebug("creation sms message with id"); + LoggerD("creation sms message with id"); retSms = new Sms(id); imsg = (IMessagePtr) retSms; break; @@ -57,7 +57,7 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, case BINARYSMS: { - LogDebug("creation binary sms message with id"); + LoggerD("creation binary sms message with id"); retBinarySms = new BinarySms(id); imsg = (IMessagePtr) retBinarySms; break; @@ -65,7 +65,7 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, case MMS: { - LogDebug("creation mms message with id"); + LoggerD("creation mms message with id"); retMms = new Mms(id); imsg = (IMessagePtr) retMms; @@ -74,30 +74,30 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, unsigned int idx = 0; for (; idx < attachments.size() ; idx++ ) { - LogDebug("set Messsage ID = " << attachments[idx]->getAttachmentID()); + LoggerD("set Messsage ID = " << attachments[idx]->getAttachmentID()); attachments[idx]->setMessage(imsg); } break; } case EMAIL: { - LogDebug("creation email message with id"); + LoggerD("creation email message with id"); retEmail= new Email(id); imsg = (IMessagePtr) retEmail; break; } case EMPTY_MESSAGE: { - LogDebug("creation empty message with id"); + LoggerD("creation empty message with id"); retEmptyMessage = new EmptyMessage(id); imsg = (IMessagePtr) retEmptyMessage; break; } default: - LogError("creation error, unknown message type"); + LoggerE("creation error, unknown message type"); break; } - LogInfo("end"); + LoggerI("end"); return imsg; } @@ -114,7 +114,7 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, IMessagePtr MessageFactory::createMessage(const MessageType msgType, const int id, const msg_struct_t msg_data) { - LogInfo("enter"); + LoggerI("enter"); IMessage* retVal = NULL; std::ostringstream stream; stream << id; @@ -122,44 +122,44 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, switch (msgType) { case SMS: - LogDebug("creation sms message with data"); + LoggerD("creation sms message with data"); retVal = new Sms(idStr, msg_data); break; case MMS: - LogDebug("creation mms message with data"); + LoggerD("creation mms message with data"); retVal = new Mms(idStr, msg_data); break; case EMPTY_MESSAGE: - LogDebug("creation empty message with data"); + LoggerD("creation empty message with data"); retVal = new EmptyMessage(idStr); break; default: - LogError("creation error, unknown message type"); + LoggerE("creation error, unknown message type"); break; } - LogInfo("end"); + LoggerI("end"); return IMessagePtr(retVal); } IMessagePtr MessageFactory::createMessage(const MessageType msgType, EmailAccountInfo& account, const std::string& id ) { - LogInfo("enter, CreateMessage with account"); + LoggerI("enter, CreateMessage with account"); std::ostringstream stream; stream << id; std::string idStr = stream.str(); - LogInfo("createMessage with , idstr =" << idStr); + LoggerI("createMessage with , idstr =" << idStr); if (msgType == EMAIL) { - LogDebug("Account Address:" << &account); + LoggerD("Account Address:" << &account); IMessage* retVal = NULL; - LogDebug("creation email message with account"); + LoggerD("creation email message with account"); retVal = new Email(account); return IMessagePtr(retVal); } @@ -170,9 +170,9 @@ IMessagePtr MessageFactory::createMessage(const MessageType msgType, IMessagePtr MessageFactory::createEmailMessage(const int accountId, const int mailId) { - LogInfo("enter, Create Email Message with account ID"); + LoggerI("enter, Create Email Message with account ID"); IEmail* email = NULL; - LogDebug("creation email message with account ID"); + LoggerD("creation email message with account ID"); std::stringstream stream; unsigned int idx; @@ -190,13 +190,13 @@ IMessagePtr MessageFactory::createEmailMessage(const int accountId, const int ma for (idx = 0; idx < attachments.size() ; idx++ ) { - LogDebug("set Attachment ID = " << attachments[idx]->getAttachmentID()); + LoggerD("set Attachment ID = " << attachments[idx]->getAttachmentID()); attachments[idx]->setMessage(imsg); } for (idx = 0; idx < inlineAttachments.size() ; idx++ ) { - LogDebug("set inline Attachment ID = " << inlineAttachments[idx]->getAttachmentID()); + LoggerD("set inline Attachment ID = " << inlineAttachments[idx]->getAttachmentID()); inlineAttachments[idx]->setMessage(imsg); } @@ -205,7 +205,7 @@ IMessagePtr MessageFactory::createEmailMessage(const int accountId, const int ma #if 0 IMessage* retVal = NULL; - LogDebug("creation email message with account ID"); + LoggerD("creation email message with account ID"); std::stringstream stream; @@ -226,7 +226,7 @@ IMessagePtr MessageFactory::createEmailMessage(const int accountId, const int ma IMessagePtr MessageFactory::createEmailMessage() { - LogInfo("enter, Create Temporary Email Message without account"); + LoggerI("enter, Create Temporary Email Message without account"); IEmail* email = NULL; diff --git a/src/Messaging/MessageFilterConverter.cpp b/src/Messaging/MessageFilterConverter.cpp index 1ca7860..3a35d2e 100644 --- a/src/Messaging/MessageFilterConverter.cpp +++ b/src/Messaging/MessageFilterConverter.cpp @@ -23,8 +23,7 @@ */ #include "MessageFilterConverter.h" - -#include +#include namespace DeviceAPI { namespace Messaging { @@ -160,7 +159,7 @@ MessageMessagesFilterConverter::MessageMessagesFilterConverter(JSContextRef cont MessageMessagesFilterConverter::~MessageMessagesFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MessageConversationsFilterConverter::MessageConversationsFilterConverter(JSContextRef context) : @@ -170,7 +169,7 @@ MessageConversationsFilterConverter::MessageConversationsFilterConverter(JSConte MessageConversationsFilterConverter::~MessageConversationsFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MessageFoldersFilterConverter::MessageFoldersFilterConverter(JSContextRef context) : @@ -180,7 +179,7 @@ MessageFoldersFilterConverter::MessageFoldersFilterConverter(JSContextRef contex MessageFoldersFilterConverter::~MessageFoldersFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MessageMessagesChangeFilterConverter::MessageMessagesChangeFilterConverter(JSContextRef context) : @@ -190,7 +189,7 @@ MessageMessagesChangeFilterConverter::MessageMessagesChangeFilterConverter(JSCon MessageMessagesChangeFilterConverter::~MessageMessagesChangeFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MessageConversationsChangeFilterConverter::MessageConversationsChangeFilterConverter(JSContextRef context) : @@ -200,7 +199,7 @@ MessageConversationsChangeFilterConverter::MessageConversationsChangeFilterConve MessageConversationsChangeFilterConverter::~MessageConversationsChangeFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } MessageFoldersChangeFilterConverter::MessageFoldersChangeFilterConverter(JSContextRef context) : @@ -210,7 +209,7 @@ MessageFoldersChangeFilterConverter::MessageFoldersChangeFilterConverter(JSConte MessageFoldersChangeFilterConverter::~MessageFoldersChangeFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } } // Messaging diff --git a/src/Messaging/MessageFilterValidator.cpp b/src/Messaging/MessageFilterValidator.cpp old mode 100755 new mode 100644 index 13e9ecf..7fe7758 --- a/src/Messaging/MessageFilterValidator.cpp +++ b/src/Messaging/MessageFilterValidator.cpp @@ -17,9 +17,8 @@ #include "MessageFilterValidator.h" #include "MessageFilterValidatorFactory.h" - -#include #include "log.h" +#include using namespace DeviceAPI::Tizen; @@ -105,7 +104,7 @@ namespace DeviceAPI { bool retVal = false; if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)!=0){ - MsgLogError(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); + MsgLoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); return false; } @@ -164,16 +163,16 @@ namespace DeviceAPI { } retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue, depth); - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } bool MessageFilterValidator::validateAttributeEach(std::string& attrName,MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); if(attrName.compare(MessageFilterValidatorFactory::ATTRIBUTE_TYPE)==0){ if(m_isTypeSetted == true){ - MsgLogError(">>> [ERROR] duplicated type :[" << attrName << "], value:[" << + MsgLoggerE(">>> [ERROR] duplicated type :[" << attrName << "], value:[" << value->toString()<< "]"); return false; }else{ @@ -194,7 +193,7 @@ namespace DeviceAPI { return false; } - LogDebug(">>> return true"); + LoggerD(">>> return true"); return true; } diff --git a/src/Messaging/MessageListenerManager.h b/src/Messaging/MessageListenerManager.h index 376663c..ff96965 100644 --- a/src/Messaging/MessageListenerManager.h +++ b/src/Messaging/MessageListenerManager.h @@ -20,11 +20,11 @@ #include #include -#include #include #include #include #include "JSMessagingStorage.h" +#include namespace DeviceAPI { namespace Messaging { @@ -64,7 +64,7 @@ public: if (!priv) { - LogDebug("priv is NULL."); + LoggerD("priv is NULL."); return; } @@ -72,16 +72,16 @@ public: if (!objectPriv) { - LogDebug("objectPriv is NULL."); + LoggerD("objectPriv is NULL."); return; } Try { - LogDebug("objectPriv type : " << objectPriv->getType() << " Id : " << objectPriv->getIndex()); + LoggerD("objectPriv type : " << objectPriv->getType() << " Id : " << objectPriv->getIndex()); MessagingListener::getInstance().removeIncomingMsgCallback(m_watchId, objectPriv->getType(), objectPriv->getIndex()); }Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("Try to deregister by unmatched service"); + LoggerE("Try to deregister by unmatched service"); return; } } diff --git a/src/Messaging/MessageQueryGenerator.cpp b/src/Messaging/MessageQueryGenerator.cpp old mode 100755 new mode 100644 index 756b72a..f4ce798 --- a/src/Messaging/MessageQueryGenerator.cpp +++ b/src/Messaging/MessageQueryGenerator.cpp @@ -28,8 +28,7 @@ #include #include #include - -#include +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -61,7 +60,7 @@ namespace DeviceAPI { MessageQueryGenerator::MessageQueryGenerator(const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset): m_messageType(MESSAGE_TYPE_NOT_INITIALIZED){ - LogDebug("<<< limit:" << limit << ", offset:" << offset); + LoggerD("<<< limit:" << limit << ", offset:" << offset); m_query.append(getQueryPrefix()); @@ -77,7 +76,7 @@ namespace DeviceAPI { MessageQueryGenerator::MessageQueryGenerator(const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset, const int type): m_messageType(MESSAGE_TYPE_NOT_INITIALIZED){ - LogDebug("<<< limit:" << limit << ", offset:" << offset); + LoggerD("<<< limit:" << limit << ", offset:" << offset); m_query.append(getQueryPrefix()); //TODO check sort mode validation @@ -172,7 +171,7 @@ namespace DeviceAPI { } void MessageQueryGenerator::setSmsMmsAttributeMap(){ - LogDebug("<<<"); + LoggerD("<<<"); attributeMap.clear(); attributeMap.insert( @@ -216,18 +215,18 @@ namespace DeviceAPI { std::pair( MessageFilterValidatorFactory::ATTRIBUTE_TYPE, "A.MAIN_TYPE")); - LogDebug(">>"); + LoggerD(">>"); } void MessageQueryGenerator::initAttributeMap(){ switch (m_mode){ case MODE_EMAIL: - LogDebug("MODE_EMAIL"); + LoggerD("MODE_EMAIL"); setEmailAttributeMap(); break; case MODE_SMS: case MODE_MMS: - LogDebug("MODE_SMS or MODE_MMS"); + LoggerD("MODE_SMS or MODE_MMS"); setSmsMmsAttributeMap(); break; default: //TODO throw exception @@ -236,24 +235,24 @@ namespace DeviceAPI { } void MessageQueryGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); m_queryVector.push_back("("); - LogDebug("getServiceType = " << getServiceType()); - LogDebug(">>>"); + LoggerD("getServiceType = " << getServiceType()); + LoggerD(">>>"); } void MessageQueryGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(m_typeProcessing == 1){ m_typeProcessing = 0; if(type != INTERSECTION_FILTER){ - LogError("[ERROR] >>> invalid Filter type:" << type); + LoggerE("[ERROR] >>> invalid Filter type:" << type); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid Fiilter Type"); } - LogDebug(">>>"); + LoggerD(">>>"); if(m_mode == MODE_EMAIL) { return; @@ -267,15 +266,15 @@ namespace DeviceAPI { // m_queryVector.push_back("OR"); // } else{ - LogError("[ERROR] invalid Filter type:" << type); + LoggerE("[ERROR] invalid Filter type:" << type); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid Fiilter Type"); } - LogDebug(">>>"); + LoggerD(">>>"); } void MessageQueryGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(m_typeProcessing == 1){ m_typeProcessing = 0; if(m_mode == MODE_EMAIL) @@ -286,11 +285,11 @@ namespace DeviceAPI { } m_queryVector.push_back(")"); - LogDebug(">>>"); + LoggerD(">>>"); } std::string MessageQueryGenerator::convertToEmfAttrName(std::string attrName){ - LogDebug("<<< attrName:[" << attrName << "]"); + LoggerD("<<< attrName:[" << attrName << "]"); std::string retString; @@ -301,13 +300,13 @@ namespace DeviceAPI { retString = static_cast(attributeMap.find(attrName)->second); } - LogDebug(">> retString:[" << retString << "]"); + LoggerD(">> retString:[" << retString << "]"); return retString; } std::string MessageQueryGenerator::createTimeString(std::string& timeString) { - LogDebug("<<< timeString:[" << timeString << "]"); + LoggerD("<<< timeString:[" << timeString << "]"); size_t pos = timeString.find("-",0); while(pos!= std::string::npos){ @@ -315,42 +314,42 @@ namespace DeviceAPI { pos = timeString.find('-',0); } - LogDebug(">>> timeString:[" << timeString << "]"); + LoggerD(">>> timeString:[" << timeString << "]"); return timeString; } std::string MessageQueryGenerator::createFolderType(std::string& value) { - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string retFolderType; std::ostringstream outstream; if(value.compare("1") == 0){ - LogDebug("<<< value:[INBOX]"); + LoggerD("<<< value:[INBOX]"); outstream << MSG_INBOX_ID; }else if(value.compare("2") == 0){ - LogDebug("<<< value:[OUTBOX]"); + LoggerD("<<< value:[OUTBOX]"); outstream << MSG_OUTBOX_ID; }else if(value.compare("3") == 0){ - LogDebug("<<< value:[DRAFTBOX]"); + LoggerD("<<< value:[DRAFTBOX]"); outstream << MSG_DRAFT_ID; }else if(value.compare("4") == 0){ - LogDebug("<<< value:[SENTBOX]"); + LoggerD("<<< value:[SENTBOX]"); outstream << MSG_SENTBOX_ID; }else{ - LogDebug("[ERROR] unsupported type:["<< value << "]"); + LoggerD("[ERROR] unsupported type:["<< value << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "invalid folder id"); } retFolderType = outstream.str(); - LogDebug(">>> retFolderType:[" << retFolderType << "]"); + LoggerD(">>> retFolderType:[" << retFolderType << "]"); return retFolderType; } std::string MessageQueryGenerator::createPriorityTypeForEmail(std::string& value) { - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string retPriorityType; if(value.compare("true")==0){ @@ -363,7 +362,7 @@ namespace DeviceAPI { } std::string MessageQueryGenerator::createPriorityTypeForSmsMms(std::string& value){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string retPriorityType; if(value.compare("true")==0){ @@ -371,7 +370,7 @@ namespace DeviceAPI { }else if(value.compare("false")==0){ retPriorityType = "0"; }else{ - LogError(">>> invalid value:[" << value << "]"); + LoggerE(">>> invalid value:[" << value << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "unsupported value"); } @@ -380,7 +379,7 @@ namespace DeviceAPI { std::string MessageQueryGenerator::convertToTimeFormat(const std::string& timeString){ - LogDebug("<<< timeString:[" << timeString << "]"); + LoggerD("<<< timeString:[" << timeString << "]"); std::string retString; retString.append("'"); @@ -415,24 +414,24 @@ namespace DeviceAPI { retString.append(timeString.substr(nextStart, secondLength)); retString.append("'"); - LogDebug(">>> retString:[" << retString << "]"); + LoggerD(">>> retString:[" << retString << "]"); return retString; } //convert from '20111115000000' to 2011-11-15 00:00:00 std::string MessageQueryGenerator::createDateTimeTypeForSmsMms(DeviceAPI::Tizen::AnyPtr& value){ std::string initialValueStr; - LogDebug("<<< value:[" << value->toString() << "]"); + LoggerD("<<< value:[" << value->toString() << "]"); if (!value->isNullOrUndefined()) { if( value->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); tm date = *value->getDateTm(); initialValueStr = toDateDbStr(date); - LogDebug("<<getType()"); + LoggerE("initialValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid value Type"); } } @@ -447,12 +446,12 @@ namespace DeviceAPI { secondsSinceType.append(tmpValueString); secondsSinceType.append(")"); - LogDebug(">>> retPriorityType:[" << secondsSinceType << "]"); + LoggerD(">>> retPriorityType:[" << secondsSinceType << "]"); return secondsSinceType; } std::string MessageQueryGenerator::createDateTimeTypeForSmsMms(std::string& timeString){ - LogDebug("<<< value:[" << timeString << "]"); + LoggerD("<<< value:[" << timeString << "]"); std::string tmpValueString; std::string secondsSinceType; @@ -464,29 +463,29 @@ namespace DeviceAPI { secondsSinceType.append(tmpValueString); secondsSinceType.append(")"); - LogDebug(">>> retPriorityType:[" << secondsSinceType << "]"); + LoggerD(">>> retPriorityType:[" << secondsSinceType << "]"); return secondsSinceType; } std::string MessageQueryGenerator::createDateTimeTypeForEmail(DeviceAPI::Tizen::AnyPtr& value) { std::string initialValueStr; - LogDebug("<<< value:[" << value->toString() << "]"); + LoggerD("<<< value:[" << value->toString() << "]"); if(!value->isType(PrimitiveType_Time)){ - LogError("[ERROR]>> invalid type"); + LoggerE("[ERROR]>> invalid type"); return NULL; } if (!value->isNullOrUndefined()) { if( value->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); tm date = *value->getDateTm(); initialValueStr = toDateDbStr(date); - LogDebug("<<getType()"); + LoggerE("initialValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid value Type"); } } @@ -513,7 +512,7 @@ namespace DeviceAPI { }else if(booleanString.compare("false") == 0){ retString = "0"; }else{ - LogError("invalid booleanString:[" << booleanString << "]"); + LoggerE("invalid booleanString:[" << booleanString << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "invalid booleanString :[" + booleanString + "]"); } return retString; @@ -678,20 +677,20 @@ namespace DeviceAPI { void MessageQueryGenerator::visitAttribute(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth){ - LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); + LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); if(matchValue == NULL) return; - LogDebug("matchValue:" << matchValue->toString()); + LoggerD("matchValue:" << matchValue->toString()); visitAttributeEach(attrName, matchFlag, matchValue, depth); - LogDebug(">>>"); + LoggerD(">>>"); } int MessageQueryGenerator::convertMessageType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -702,17 +701,17 @@ namespace DeviceAPI { }else if(stringType.compare("messaging.email") ==0){ retMessageType = EMAIL; }else{ - MsgLogError("invalid type:[" << stringType << "]"); + MsgLoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } std::string MessageQueryGenerator::convertMessageTypeToString(std::string& stringType){ - LogDebug("<<< value:[" << stringType << "]"); + LoggerD("<<< value:[" << stringType << "]"); std::string retMessageType; std::ostringstream outstream; @@ -732,7 +731,7 @@ namespace DeviceAPI { } void MessageQueryGenerator::visitAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); if(attrName.compare("type")==0){ m_typeProcessing = 1; @@ -741,7 +740,7 @@ namespace DeviceAPI { m_messageType = convertMessageType(m_currentType); if(m_messageType == EMAIL) { - LogDebug(">>> skip type"); + LoggerD(">>> skip type"); return; } } @@ -749,35 +748,35 @@ namespace DeviceAPI { std::string emfAttributeName = convertToEmfAttrName(attrName); // if(emfAttributeName == NULL){ -// LogDebug(">>> emfAttributeName is NULL"); +// LoggerD(">>> emfAttributeName is NULL"); // return; // } std::string tmpStringBuffer; if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){ - LogDebug("STRING_MATCH_EXACTLY"); + LoggerD("STRING_MATCH_EXACTLY"); tmpStringBuffer.append(getMatchExactlyClause(attrName, value)); }else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){ - LogDebug("STRING_MATCH_CONTAINS"); + LoggerD("STRING_MATCH_CONTAINS"); tmpStringBuffer.append(getMatchContainsClause(attrName, value)); }else if(matchFlag == DeviceAPI::Tizen::MATCH_STARTSWITH){ - LogDebug("STRING_MATCH_STARTSWITH"); + LoggerD("STRING_MATCH_STARTSWITH"); tmpStringBuffer.append(getMatchStartsWithClause(attrName, value)); }else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){ - LogDebug("STRING_MATCH_ENDSWITH"); + LoggerD("STRING_MATCH_ENDSWITH"); tmpStringBuffer.append(getMatchEndsWithClause(attrName, value)); }else{ - LogDebug("[ERROR]invalid match flag[" << matchFlag << "]"); + LoggerD("[ERROR]invalid match flag[" << matchFlag << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "invalid match flag:[" << matchFlag << "]"); } // else if(iter->find(MATCH_CASESENSITIVE)){ //TODO check case sensitive // } m_queryVector.push_back(tmpStringBuffer); - LogDebug(">>>"); + LoggerD(">>>"); } void MessageQueryGenerator::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth) { - LogDebug("<<< sttrName:[" << attrName <<"]"); + LoggerD("<<< sttrName:[" << attrName <<"]"); string initialValueStr; string endValueStr; @@ -792,24 +791,24 @@ namespace DeviceAPI { if (!initialValue->isNullOrUndefined()) { if( initialValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); tm date = *initialValue->getDateTm(); initialValueStr = toDateDbStr(date); - LogDebug("<<getType()"); + LoggerE("initialValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid initialValue Type"); } } if (!endValue->isNullOrUndefined()) { if( endValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); tm date = *endValue->getDateTm(); endValueStr = toDateDbStr(date); } else { - LogError("endValue->getType()"); + LoggerE("endValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid endValue Type"); } } @@ -825,7 +824,7 @@ namespace DeviceAPI { } m_queryVector.push_back(tmpStringBuffer); - LogDebug(">>>"); + LoggerD(">>>"); } std::string MessageQueryGenerator::getQueryFromVector() @@ -839,7 +838,7 @@ namespace DeviceAPI { it++; } - LogDebug(">>> retString:" << retString); + LoggerD(">>> retString:" << retString); return retString; } @@ -848,7 +847,7 @@ namespace DeviceAPI { m_query.append(getQueryFromVector()); - LogDebug("m_limit : " << m_limit << " m_offset : " << m_offset); + LoggerD("m_limit : " << m_limit << " m_offset : " << m_offset); if(m_sortMode != NULL) { @@ -869,11 +868,11 @@ namespace DeviceAPI { m_orderLimit.append(buffer.str()); if(m_query.compare(getQueryPrefix())==0){ - LogDebug("m_query null"); + LoggerD("m_query null"); return ""; }else{ m_query.append(getQuerySuffix()); - LogDebug("m_query not null"); + LoggerD("m_query not null"); return m_query; } } diff --git a/src/Messaging/Messaging.cpp b/src/Messaging/Messaging.cpp old mode 100755 new mode 100644 index ec886ac..fe5bf42 --- a/src/Messaging/Messaging.cpp +++ b/src/Messaging/Messaging.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include "Messaging.h" #include "Sms.h" @@ -28,19 +27,13 @@ #include "BinarySms.h" #include "Email.h" #include "EmailConverter.h" - #include "log.h" - - - #include "StorageChangesMessageFilterValidatorFactory.h" #include "StorageChangesConversationFilterValidatorFactory.h" #include "StorageChangesFolderFilterValidatorFactory.h" #include "MessageQueryGenerator.h" - #include "ConversationQueryGenerator.h" #include "FolderQueryGenerator.h" - #include "messageDB/MessageStorageReader.h" extern "C" { @@ -53,12 +46,13 @@ extern "C" { #include "Conversation.h" #include "MessageFolder.h" #include +#include IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::MsgServiceHandle) -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); +#define LOG_ENTER LoggerD("---> ENTER"); +#define LOG_EXIT LoggerD("---> EXIT"); using namespace std; @@ -93,35 +87,35 @@ Messaging::Messaging() : Try { const vector accounts = getEmailAccounts(); - LogDebug("Number of emails account=" << accounts.size()); + LoggerD("Number of emails account=" << accounts.size()); if (accounts.size() > 0) { // set default email account - first from the list setCurrentEmailAccount(accounts[0]); } else { - LogError("no default email account set"); + LoggerE("no default email account set"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("No email accounts available"); + LoggerE("No email accounts available"); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("No email accounts available"); + LoggerE("No email accounts available"); //current email not configured, skipped } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); } // Begin service for email management ?? pmi question if it should be added before email actions if (0 == m_objCounter) { int error = email_service_begin(); if (EMAIL_ERROR_NONE != error) { - LogError("email_service_begin() returned error " << error); + LoggerE("email_service_begin() returned error " << error); } else { - LogInfo("email_service_begin() executed without error"); + LoggerI("email_service_begin() executed without error"); } } ++m_objCounter; @@ -143,9 +137,9 @@ Messaging::~Messaging() if (!--m_objCounter) { int error = email_service_end(); if (EMAIL_ERROR_NONE != error) { - LogError("email_service_end() returned error " << error); + LoggerE("email_service_end() returned error " << error); } else { - LogDebug("email_service_end() executed without error"); + LoggerD("email_service_end() executed without error"); } } } @@ -158,7 +152,7 @@ void Messaging::getNumberOfMessages(MessageType msgType, { if (NULL == readed || NULL == unReaded) { - LogError("output pointers are NULL"); + LoggerE("output pointers are NULL"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } *readed = 0; @@ -170,7 +164,7 @@ void Messaging::getNumberOfMessages(MessageType msgType, } else if (EMAIL == msgType) { getNumberOfEmails(folder, readed, unReaded); } else { - LogError("wrong message type"); + LoggerE("wrong message type"); Throw(WrtDeviceApis::Commons::PlatformException); } } @@ -179,12 +173,12 @@ vector Messaging::findMessages(const vector& msgTypes, const string &folder, const DeviceAPI::Tizen::FilterPtr& filter) { - LogDebug("enter"); + LoggerD("enter"); vector retVal; back_insert_iterator< vector > biit(retVal); vector::const_iterator it = msgTypes.begin(); for (; it != msgTypes.end(); ++it) { - LogDebug("Finding messages (" << *it << ") in folder: " << folder); + LoggerD("Finding messages (" << *it << ") in folder: " << folder); vector result; switch (*it) { @@ -206,10 +200,10 @@ vector Messaging::findMessages(const vector& msgTypes, break; } default: - LogError("message type unknown"); + LoggerE("message type unknown"); Throw(WrtDeviceApis::Commons::PlatformException); } - LogDebug("Found: " << result.size()); + LoggerD("Found: " << result.size()); copy(result.begin(), result.end(), biit); } @@ -217,7 +211,7 @@ vector Messaging::findMessages(const vector& msgTypes, } */ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filter){ - LogDebug("<<<"); + LoggerD("<<<"); std::string filterSql; MessageQueryGeneratorPtr queryGenerator(new MessageQueryGenerator()); @@ -225,7 +219,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug(">>> filterSql:[" << filterSql << "]"); + LoggerD(">>> filterSql:[" << filterSql << "]"); return filterSql; } @@ -233,7 +227,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt vector Messaging::findMessages(const vector& msgTypes, FolderType folder, const DeviceAPI::Tizen::FilterPtr& filter) { - LogDebug("enter"); + LoggerD("enter"); vector retVal; back_insert_iterator< vector > biit(retVal); @@ -243,7 +237,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt vector::const_iterator it = msgTypes.begin(); for (; it != msgTypes.end(); ++it) { - LogDebug("Finding messages (" << *it << ") in folder: " << folder); + LoggerD("Finding messages (" << *it << ") in folder: " << folder); vector(Messaging::*findFnPtr)(FolderType folder, const DeviceAPI::Tizen::FilterPtr& filter) = NULL; switch (*it) { @@ -263,12 +257,12 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt break; } default: - LogError("message type unknown"); + LoggerE("message type unknown"); Throw(WrtDeviceApis::Commons::PlatformException); } vector result = (this->*findFnPtr)(folder, filter); - LogDebug("Found: " << result.size()); + LoggerD("Found: " << result.size()); copy(result.begin(), result.end(), biit); } @@ -278,36 +272,36 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt void Messaging::printErrorMessage(int errorCode){ switch(errorCode){ case EMAIL_ERROR_MAIL_NOT_FOUND:{ - LogDebug("EMAIL_ERROR_MAIL_NOT_FOUND"); + LoggerD("EMAIL_ERROR_MAIL_NOT_FOUND"); break; } case EMAIL_ERROR_DB_FAILURE:{ - LogDebug("EMAIL_ERROR_DB_FAILURE"); + LoggerD("EMAIL_ERROR_DB_FAILURE"); break; } default:{ - LogDebug("other error message:" << errorCode); + LoggerD("other error message:" << errorCode); } } } vector Messaging::createVectorFromeMessageList(const msg_struct_list_s &message_list){ // vector Messaging::createVectorFromeMessageList(const msg_struct_list_s message_list){ - LogDebug("<<<"); + LoggerD("<<<"); vector retVal; int tempInt; // int l_msgId = 0; MessageType webApiMsgType; - LogDebug("message_list.nCount:" << message_list.nCount); + LoggerD("message_list.nCount:" << message_list.nCount); for (int i = 0; i < message_list.nCount; i++) { int err = msg_get_int_value(message_list.msg_struct_info[i], MSG_MESSAGE_TYPE_INT, &tempInt); if(err != MSG_SUCCESS) { ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message type fail"); } - LogDebug("Message type : " << tempInt); + LoggerD("Message type : " << tempInt); switch(tempInt){ case MSG_TYPE_SMS:{ @@ -319,14 +313,14 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt break; } default:{ - LogError("[ERROR]invalid message type:" << tempInt); + LoggerE("[ERROR]invalid message type:" << tempInt); continue; } } // int l_msgId = msg_get_message_id(message_list.msgInfo[i]); err = msg_get_int_value(message_list.msg_struct_info[i], MSG_MESSAGE_ID_INT, &tempInt); - LogDebug("Message Id : " << tempInt); + LoggerD("Message Id : " << tempInt); if(err != MSG_SUCCESS) { ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get message id fail"); @@ -337,7 +331,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt retVal.push_back(msg); } //for - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } @@ -345,7 +339,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt vector recVec; if (threadViewList.nCount <= 0) { - LogDebug("Empty..."); + LoggerD("Empty..."); } else { for (int i = 0; i < threadViewList.nCount; i++) { // IConversationPtr convPtr(new Conversation(i)); @@ -359,7 +353,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt } vector Messaging::querySmsMmsMessages(const std::string& queryString){ - LogDebug("<<< queryString:[" << queryString <<"]"); + LoggerD("<<< queryString:[" << queryString <<"]"); vector retVal; std::string tempString = ""; @@ -374,7 +368,7 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt res = reader.queryMessage(queryString, tempString, &message_list); if (MSG_SUCCESS != res) { - LogError("msg_get_folder_view_list failed " << res); + LoggerE("msg_get_folder_view_list failed " << res); Throw(WrtDeviceApis::Commons::PlatformException); } reader.MsgStoDisconnectDB(); @@ -382,20 +376,20 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt retVal = createVectorFromeMessageList(message_list); reader.msg_release_list_struct_private(&message_list); }Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (message_list.nCount) { reader.msg_release_list_struct_private(&message_list); } throw; } //Catch - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } vector Messaging::querySmsMmsMessages(const std::string& queryString, const std::string& orderLimitString){ - LogDebug("<<< queryString:[" << queryString <<"]"); - LogDebug("<<< orderLimitString:[" << orderLimitString <<"]"); + LoggerD("<<< queryString:[" << queryString <<"]"); + LoggerD("<<< orderLimitString:[" << orderLimitString <<"]"); vector retVal; // MSG_LIST_S message_list = {0, NULL}; @@ -409,30 +403,30 @@ std::string Messaging::generateFilterSql(const DeviceAPI::Tizen::FilterPtr& filt res = reader.queryMessage(queryString, orderLimitString, &message_list); if (MSG_SUCCESS != res) { - LogError("msg_get_folder_view_list failed " << res); + LoggerE("msg_get_folder_view_list failed " << res); Throw(WrtDeviceApis::Commons::PlatformException); } reader.MsgStoDisconnectDB(); retVal = createVectorFromeMessageList(message_list); - LogDebug("<<< message_list.nCount:[" << message_list.nCount <<"]"); + LoggerD("<<< message_list.nCount:[" << message_list.nCount <<"]"); reader.msg_release_list_struct_private(&message_list); }Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (message_list.nCount) { reader.msg_release_list_struct_private(&message_list); } throw; } //Catch - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } vector Messaging::querySmsMmsConversation(const std::string& sqlWhereClause, const std::string& orderLimitString){ - LogDebug("sqlWhereClause:[" << sqlWhereClause << "]"); - LogDebug("<<< orderLimitString:[" << orderLimitString <<"]"); + LoggerD("sqlWhereClause:[" << sqlWhereClause << "]"); + LoggerD("<<< orderLimitString:[" << orderLimitString <<"]"); std::vector recVec; // MSG_THREAD_VIEW_LIST_S threadViewList; @@ -445,7 +439,7 @@ vector Messaging::querySmsMmsConversation(const std::string& s res = reader.queryConversation(sqlWhereClause, orderLimitString, &threadViewList); if (MSG_SUCCESS != res) { - LogError("queryConversation failed:" << res); + LoggerE("queryConversation failed:" << res); Throw(WrtDeviceApis::Commons::PlatformException); } reader.MsgStoDisconnectDB(); @@ -454,12 +448,12 @@ vector Messaging::querySmsMmsConversation(const std::string& s reader.msg_release_list_struct_private(&threadViewList); - LogDebug(">>>"); + LoggerD(">>>"); return recVec; } vector Messaging::queryEmailConversation(const std::string& sqlWhereClause){ - LogDebug("sqlWhereClause:[" << sqlWhereClause << "]"); + LoggerD("sqlWhereClause:[" << sqlWhereClause << "]"); std::vector emailResultVector; email_mail_list_item_t* mailList = NULL; @@ -468,10 +462,10 @@ vector Messaging::queryEmailConversation(const std::string& sq errCode = email_query_mail_list(const_cast(sqlWhereClause.c_str()), &mailList, &mailListCount); if(errCode != EMAIL_ERROR_NONE){ - LogError("[ERROR]email_query_mail_list failed:" << errCode); + LoggerE("[ERROR]email_query_mail_list failed:" << errCode); printErrorMessage(errCode); }else{ - LogDebug("message found mailListCount:" << mailListCount); + LoggerD("message found mailListCount:" << mailListCount); std::map checkUnique; for(int i=0; i Messaging::queryEmailConversation(const std::string& sq IConversationPtr convPtr(new Conversation(mailList[i].thread_id, EMAIL)); //TODO for debug - LogDebug("mailList[i].thread_id:[" << mailList[i].thread_id << "]"); - LogDebug("mailList[i].full_address_from:[" << mailList[i].full_address_from << "]"); - LogDebug("mailList[i].email_address_sender : [" << mailList[i].email_address_sender <<"]"); - LogDebug("mailList[i].subject:[" << mailList[i].subject << "]"); - LogDebug("mailList[i].preview_text:[" << mailList[i].preview_text << "]"); - LogDebug("mailList[i].flags_seen_field:[" << mailList[i].flags_seen_field << "]"); - LogDebug("mailList[i].priority:[" << mailList[i].priority<< "]"); + LoggerD("mailList[i].thread_id:[" << mailList[i].thread_id << "]"); + LoggerD("mailList[i].full_address_from:[" << mailList[i].full_address_from << "]"); + LoggerD("mailList[i].email_address_sender : [" << mailList[i].email_address_sender <<"]"); + LoggerD("mailList[i].subject:[" << mailList[i].subject << "]"); + LoggerD("mailList[i].preview_text:[" << mailList[i].preview_text << "]"); + LoggerD("mailList[i].flags_seen_field:[" << mailList[i].flags_seen_field << "]"); + LoggerD("mailList[i].priority:[" << mailList[i].priority<< "]"); if (convPtr->getResult() == true) { @@ -500,12 +494,12 @@ vector Messaging::queryEmailConversation(const std::string& sq free(mailList); } - LogDebug(">>>"); + LoggerD(">>>"); return emailResultVector; } vector Messaging::queryEmailMessage(const std::string& sqlWhereClause){ - LogDebug("sqlWhereClause:[" << sqlWhereClause << "]"); + LoggerD("sqlWhereClause:[" << sqlWhereClause << "]"); vector emailResultVector; @@ -515,24 +509,24 @@ vector Messaging::queryEmailMessage(const std::string& sqlWhereClau errCode = email_query_mail_list(const_cast(sqlWhereClause.c_str()), &mailList, &mailListCount); if(errCode != EMAIL_ERROR_NONE){ - LogError("[ERROR]email_query_mail_list failed:" << errCode); + LoggerE("[ERROR]email_query_mail_list failed:" << errCode); printErrorMessage(errCode); }else{ - LogDebug("message found mailListCount:" << mailListCount); + LoggerD("message found mailListCount:" << mailListCount); for(int i=0; i Messaging::queryEmailMessage(const std::string& sqlWhereClau free(mailList); } - LogDebug(">>>"); + LoggerD(">>>"); return emailResultVector; } /* vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& filter){ - LogDebug("<<<"); + LoggerD("<<<"); vector retVal; std::string filterSql; @@ -557,18 +551,18 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); int messageType = queryGenerator->getMessageType(); switch(messageType){ case EMAIL: - LogDebug("message type is EMAIL:[" << messageType <<"]"); + LoggerD("message type is EMAIL:[" << messageType <<"]"); retVal = queryEmailMessage(filterSql); break; case SMS: case MMS: - LogDebug("message type is SMS or MMS:[" << messageType <<"]"); + LoggerD("message type is SMS or MMS:[" << messageType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_SMS_MMS); filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor); @@ -577,11 +571,11 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f break; default: - LogError("[ERROR] >>> invlid message type:[" << messageType <<"]"); + LoggerE("[ERROR] >>> invlid message type:[" << messageType <<"]"); return retVal; } - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } */ @@ -589,7 +583,7 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f //TODO refactoring vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& filter, const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset) { - LogDebug("<<<"); + LoggerD("<<<"); vector retVal; std::string filterSql; @@ -599,18 +593,18 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); int messageType = queryGenerator->getMessageType(); switch(messageType){ case EMAIL: - LogDebug("message type is EMAIL:[" << messageType <<"]"); + LoggerD("message type is EMAIL:[" << messageType <<"]"); retVal = queryEmailMessage(filterSql); break; case SMS: case MMS: - LogDebug("message type is SMS or MMS:[" << messageType <<"]"); + LoggerD("message type is SMS or MMS:[" << messageType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_SMS_MMS); filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor); @@ -619,17 +613,17 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f break; default: - MsgLogError("[ERROR] >>> invlid message type:[" << messageType <<"]"); + MsgLoggerE("[ERROR] >>> invlid message type:[" << messageType <<"]"); return retVal; } - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } */ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& filter, const DeviceAPI::Tizen::SortModePtr& sortMode, const long limit, const long offset, const int type) { - LogDebug("<<<"); + LoggerD("<<<"); vector retVal; std::string filterSql; @@ -644,71 +638,71 @@ vector Messaging::findMessages(const DeviceAPI::Tizen::FilterPtr& f filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); orderLimitSql = queryGenerator->getOrderLimit(); - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql:[" << orderLimitSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql:[" << orderLimitSql <<"]"); int messageType = queryGenerator->getMessageType(); if(messageType != -1) { if(messageType != type) { - LogDebug("filter messageType and service msg type is diff"); + LoggerD("filter messageType and service msg type is diff"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid Fiilter Type"); } } switch(type){ case EMAIL: - LogDebug("message type is EMAIL:[" << messageType <<"]"); + LoggerD("message type is EMAIL:[" << messageType <<"]"); emailFilterSql = filterSql + orderLimitSql; - LogDebug("filterSql:[" << emailFilterSql <<"]"); + LoggerD("filterSql:[" << emailFilterSql <<"]"); retVal = queryEmailMessage(emailFilterSql); break; case SMS: - LogDebug("message type is SMS :[" << messageType <<"]"); + LoggerD("message type is SMS :[" << messageType <<"]"); typeString.append("1"); typeAndString.append("1"); if(filterSql.length() == 0) { filterSql.append(typeString); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); } else { filterSql.append(typeAndString); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); } - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql.length():[" << orderLimitSql.length() <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]"); retVal = querySmsMmsMessages(filterSql, orderLimitSql); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); break; case MMS: - LogDebug("message type is MMS:[" << messageType <<"]"); + LoggerD("message type is MMS:[" << messageType <<"]"); typeString.append("2"); typeAndString.append("2"); if(filterSql.length() == 0) { filterSql.append(typeString); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); } else { filterSql.append(typeAndString); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); } - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql.length():[" << orderLimitSql.length() <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql.length():[" << orderLimitSql.length() <<"]"); retVal = querySmsMmsMessages(filterSql, orderLimitSql); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); break; default: - MsgLogError("[ERROR] >>> invlid message type:[" << messageType <<"]"); + MsgLoggerE("[ERROR] >>> invlid message type:[" << messageType <<"]"); return retVal; } - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } @@ -724,7 +718,7 @@ vector Messaging::getMessageIds(MessageType msgType, case EMAIL: return getEmailIds(folder); default: - LogError("not supported message type"); + LoggerE("not supported message type"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } @@ -745,7 +739,7 @@ vector Messaging::getSmsIds(FolderType folder) &folder_list_view); if (MSG_SUCCESS != res) { - LogError("msg_Get_folder_view_list failed" << res); + LoggerE("msg_Get_folder_view_list failed" << res); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -765,7 +759,7 @@ vector Messaging::getSmsIds(FolderType folder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (folder_list_view.nCount) { msg_release_list_struct(&folder_list_view); } @@ -794,7 +788,7 @@ vector Messaging::getMmsIds(FolderType folder) &folder_list_view); if (MSG_SUCCESS != res) { - LogError("msg_Get_folder_view_list failed" << res); + LoggerE("msg_Get_folder_view_list failed" << res); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -814,7 +808,7 @@ vector Messaging::getMmsIds(FolderType folder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (folder_list_view.nCount) { msg_release_list_struct(&folder_list_view); } @@ -832,7 +826,7 @@ vector Messaging::getEmailIds(FolderType folder) vector retVal; //TODO - LogError("TODO"); + LoggerE("TODO"); Throw(WrtDeviceApis::Commons::UnknownException); return retVal; @@ -840,7 +834,7 @@ vector Messaging::getEmailIds(FolderType folder) */ vector Messaging::getEmailAccounts() const { - LogError("enter"); + LoggerE("enter"); email_account_t* accounts = NULL; int count = 0; Try { @@ -848,7 +842,7 @@ vector Messaging::getEmailAccounts() const ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't get e-mail accounts."); } - LogError( "count : " << count); + LoggerE( "count : " << count); if (0 == count) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "No e-mail account found."); @@ -859,7 +853,7 @@ vector Messaging::getEmailAccounts() const { if(accounts[i].incoming_server_user_name != NULL) { - LogError("server user name is NULL"); + LoggerE("server user name is NULL"); EmailAccountInfo account(accounts[i].account_id, accounts[i].incoming_server_user_name, accounts[i].user_email_address); @@ -867,7 +861,7 @@ vector Messaging::getEmailAccounts() const } else { - LogError("normal case"); + LoggerE("normal case"); std::string Unknown = "UNKNOWN"; EmailAccountInfo account(accounts[i].account_id, Unknown, @@ -879,21 +873,21 @@ vector Messaging::getEmailAccounts() const if (accounts != NULL) { email_free_account(&accounts, count); } - LogError("end"); + LoggerE("end"); return result; } Catch(WrtDeviceApis::Commons::PlatformException) { if (accounts != NULL) { email_free_account(&accounts, count); } - LogError("PlatformException"); + LoggerE("PlatformException"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "No e-mail account found."); } Catch(WrtDeviceApis::Commons::UnknownException) { if (accounts != NULL) { email_free_account(&accounts, count); } - LogError("UnknownException"); + LoggerE("UnknownException"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't convert e-mail account id"); } } @@ -910,19 +904,19 @@ int Messaging::getEmailAccountId(const std::string& account) if (account.empty()) { tmpAccount = getCurrentEmailAccount().getAddress(); if (tmpAccount.empty()) { - LogError( + LoggerE( "current email account is not set, possible that no account created"); Throw(WrtDeviceApis::Commons::PlatformException); } } if (!email_get_account_list(&pAccountArray, &iCount)) { - LogError("email_get_account_list error"); + LoggerE("email_get_account_list error"); Throw(WrtDeviceApis::Commons::PlatformException); } if (0 == iCount) { - LogError("no email account exist"); + LoggerE("no email account exist"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -936,23 +930,23 @@ int Messaging::getEmailAccountId(const std::string& account) } if (0 == m_currentEmailAccountId) { - LogError("wrong email account ID"); + LoggerE("wrong email account ID"); Throw(WrtDeviceApis::Commons::PlatformException); } if (pAccountArray != NULL) { - LogDebug("free account, ptr=" << pAccountArray); + LoggerD("free account, ptr=" << pAccountArray); email_free_account(&pAccountArray, iCount); } if (0 == retVal) { - LogError("no email account created"); + LoggerE("no email account created"); Throw(WrtDeviceApis::Commons::PlatformException); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("exception catch, platform exception"); + LoggerE("exception catch, platform exception"); if (pAccountArray != NULL) { email_free_account(&pAccountArray, iCount); } @@ -970,17 +964,17 @@ void Messaging::fetchEmailHeaders() int error = 0; mailbox = static_cast(calloc(sizeof (email_mailbox_t), 1)); if (!mailbox) { - LogError("calloc failed"); + LoggerE("calloc failed"); return; } mailbox->account_id = m_currentEmailAccountId; mailbox->mailbox_name = strdup(EMAIL_INBOX_NAME); // if (EMAIL_ERROR_NONE != email_sync_header(mailbox, &handle)) { if (EMAIL_ERROR_NONE != email_sync_header(mailbox->account_id, 0, &handle)) { - LogError("email_sync_header failed"); + LoggerE("email_sync_header failed"); } error = email_free_mailbox(&mailbox, 1); - LogError("email_free_mailbox : " << error); + LoggerE("email_free_mailbox : " << error); */ } @@ -1003,7 +997,7 @@ int Messaging::convertFolderToPlatform(const FolderType folder) case SPAMBOX: // intentionally not break in platform is no spambox default: - LogError("Invalid folder: " << folder); + LoggerE("Invalid folder: " << folder); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1020,7 +1014,7 @@ int Messaging::convertFolderToPlatform(const std::string &folder) { if (MSG_SUCCESS != msg_get_folder_list(MsgGetCommonHandle(), &folderList)) { - LogError("msg_get_folder_list error"); + LoggerE("msg_get_folder_list error"); Throw(WrtDeviceApis::Commons::PlatformException); } for (int i = 0; i < folderList.nCount; ++i) { @@ -1049,16 +1043,16 @@ int Messaging::convertFolderToPlatform(const std::string &folder) void Messaging::addOnMessageReceived( const EmitterMessageReceivedPtr& emitter, const DeviceAPI::Tizen::FilterPtr& filter, int funtionIndex) { - LogDebug("ENTER"); + LoggerD("ENTER"); if(filter != NULL) { Try { - LogDebug("funtionIndex = " << funtionIndex); + LoggerD("funtionIndex = " << funtionIndex); bool isValidFilter = validateFilter(filter, funtionIndex); if(isValidFilter == false){ - LogError("[ERROR]this filter is invalid"); + LoggerE("[ERROR]this filter is invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } @@ -1067,7 +1061,7 @@ void Messaging::addOnMessageReceived( } }else { - LogDebug("filter is NULL"); + LoggerD("filter is NULL"); } @@ -1084,12 +1078,12 @@ void Messaging::addOnMessageReceived( this); } Catch(WrtDeviceApis::Commons::PlatformException){ - LogDebug("addOnMessageReceived failed"); + LoggerD("addOnMessageReceived failed"); Throw(WrtDeviceApis::Commons::PlatformException); } if (err != MSG_SUCCESS) { - LogError("Couldn't register on MMS received callback, err=" << err); + LoggerE("Couldn't register on MMS received callback, err=" << err); } m_dbusConnection->open(DBUS_BUS_SYSTEM); @@ -1099,16 +1093,16 @@ void Messaging::addOnMessageReceived( void Messaging::addOnMessageReceived( const EmitterConversationReceivedPtr& emitter, const DeviceAPI::Tizen::FilterPtr& filter, int funtionIndex) { - LogDebug("ENTER"); + LoggerD("ENTER"); if(filter != NULL) { Try { - LogDebug("funtionIndex = " << funtionIndex); + LoggerD("funtionIndex = " << funtionIndex); bool isValidFilter = validateFilter(filter, funtionIndex); if(isValidFilter == false){ - LogError("[ERROR]this filter is invalid"); + LoggerE("[ERROR]this filter is invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } @@ -1117,7 +1111,7 @@ void Messaging::addOnMessageReceived( } }else { - LogDebug("filter is NULL"); + LoggerD("filter is NULL"); } @@ -1134,12 +1128,12 @@ void Messaging::addOnMessageReceived( this); } Catch(WrtDeviceApis::Commons::PlatformException){ - LogDebug("addOnMessageReceived failed"); + LoggerD("addOnMessageReceived failed"); Throw(WrtDeviceApis::Commons::PlatformException); } if (err != MSG_SUCCESS) { - LogError("Couldn't register on MMS received callback, err=" << err); + LoggerE("Couldn't register on MMS received callback, err=" << err); } m_dbusConnection->open(DBUS_BUS_SYSTEM); @@ -1149,16 +1143,16 @@ void Messaging::addOnMessageReceived( void Messaging::addOnMessageReceived( const EmitterFolderReceivedPtr& emitter, const DeviceAPI::Tizen::FilterPtr& filter, int funtionIndex) { - LogDebug("ENTER"); + LoggerD("ENTER"); if(filter != NULL) { Try { - LogDebug("funtionIndex = " << funtionIndex); + LoggerD("funtionIndex = " << funtionIndex); bool isValidFilter = validateFilter(filter, funtionIndex); if(isValidFilter == false){ - LogError("[ERROR]this filter is invalid"); + LoggerE("[ERROR]this filter is invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } @@ -1167,7 +1161,7 @@ void Messaging::addOnMessageReceived( } }else { - LogDebug("filter is NULL"); + LoggerD("filter is NULL"); } @@ -1186,12 +1180,12 @@ void Messaging::addOnMessageReceived( this); } Catch(WrtDeviceApis::Commons::PlatformException){ - LogDebug("addOnMessageReceived failed"); + LoggerD("addOnMessageReceived failed"); Throw(WrtDeviceApis::Commons::PlatformException); } if (err != MSG_SUCCESS) { - LogError("Couldn't register on MMS received callback, err=" << err); + LoggerE("Couldn't register on MMS received callback, err=" << err); // Throw(WrtDeviceApis::Commons::UnknownException); } @@ -1200,10 +1194,10 @@ void Messaging::addOnMessageReceived( } bool Messaging::validateFilter(const DeviceAPI::Tizen::FilterPtr& filter, const int funtionIndex){ - LogDebug("<<<"); + LoggerD("<<<"); bool retBool = false; - LogDebug("funtionIndex = " << funtionIndex); + LoggerD("funtionIndex = " << funtionIndex); if(filter != NULL){ if(funtionIndex == 0) @@ -1233,11 +1227,11 @@ bool Messaging::validateFilter(const DeviceAPI::Tizen::FilterPtr& filter, const Throw(WrtDeviceApis::Commons::InvalidArgumentException); } }else{ - LogDebug("filter is NULL"); + LoggerD("filter is NULL"); retBool = false; } - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } @@ -1245,7 +1239,7 @@ bool Messaging::validateFilter(const DeviceAPI::Tizen::FilterPtr& filter, const void Messaging::removeOnMessageMsgReceived(EmitterMessageReceived::IdType id) { - LogDebug("ENTER"); + LoggerD("ENTER"); m_onMessageReceived.detach(id); EmittersMessageReceived::LockType lock = m_onMessageReceived.getLock(); if ((m_onMessageReceived.size()+m_onConversationReceived.size()+m_onFolderReceived.size()) == 0) { @@ -1256,7 +1250,7 @@ void Messaging::removeOnMessageMsgReceived(EmitterMessageReceived::IdType id) void Messaging::removeOnMessageConvReceived(EmitterConversationReceived::IdType id) { - LogDebug("ENTER"); + LoggerD("ENTER"); m_onConversationReceived.detach(id); EmittersConversationReceived::LockType lock = m_onConversationReceived.getLock(); if ((m_onMessageReceived.size()+m_onConversationReceived.size()+m_onFolderReceived.size()) == 0) { @@ -1267,7 +1261,7 @@ void Messaging::removeOnMessageConvReceived(EmitterConversationReceived::IdType void Messaging::removeOnMessageFolderReceived(EmitterFolderReceived::IdType id) { - LogDebug("ENTER"); + LoggerD("ENTER"); m_onFolderReceived.detach(id); EmittersFolderReceived::LockType lock = m_onFolderReceived.getLock(); if ((m_onMessageReceived.size()+m_onConversationReceived.size()+m_onFolderReceived.size()) == 0) { @@ -1278,7 +1272,7 @@ void Messaging::removeOnMessageFolderReceived(EmitterFolderReceived::IdType id) void Messaging::OnEventReceived(const DBus::MessageEvent& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); EventMessageReceivedPtr jsEvent(new EventMessageReceived()); DBus::MessagePtr message = event.GetArg0(); @@ -1301,33 +1295,33 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) if ((i == 0) && (it->getArgType() == DBUS_TYPE_INT32)) { status = it->getInt(); - LogInfo("status: " << status); + LoggerI("status: " << status); } else if ((i == 1) && (it->getArgType() == DBUS_TYPE_INT32)) { account_id = it->getInt(); - LogInfo("account_id: " << account_id); + LoggerI("account_id: " << account_id); } else if ((i == 2) && (it->getArgType() == DBUS_TYPE_INT32)) { mail_id = it->getInt(); - LogInfo("mail_id: " << mail_id); + LoggerI("mail_id: " << mail_id); } else if ((i == 3) && (it->getArgType() == DBUS_TYPE_STRING)) { name = it->getString(); - LogInfo("name: " << name); + LoggerI("name: " << name); } else if ((i == 4) && (it->getArgType() == DBUS_TYPE_INT32)) { thread_id = it->getInt(); - LogInfo("thread_id: " << thread_id); + LoggerI("thread_id: " << thread_id); } } if ((mail_id > 0) && (NOTI_MAIL_ADD == status)) { // TODO also RECEIVE_THREAD_ITEM? - LogInfo("Email received. mail_id: " << mail_id); + LoggerI("Email received. mail_id: " << mail_id); IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id); IConversationPtr conversation(new Conversation(thread_id, EMAIL)); @@ -1336,7 +1330,7 @@ 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); + LoggerI("Added message is in folder: " << folder); jsEvent->setMessage(msg); jsEvent->setConversation(conversation); @@ -1363,20 +1357,20 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } } else { - LogWarning("New email message in ignored folder: " << folder); + LoggerW("New email message in ignored folder: " << folder); } */ } else if ((mail_id > 0) && (NOTI_MAIL_DELETE == status)) { // TODO also RECEIVE_THREAD_ITEM? - LogInfo("Email received. delete type: " << mail_id); + LoggerI("Email received. delete type: " << mail_id); std::vector strIds = String::split(name, ','); std::stringstream stream; for (std::vector::iterator it = strIds.begin(); it != strIds.end(); ++it) { - LogDebug("ID is :" << *it); + LoggerD("ID is :" << *it); if ( (*it).length() > 0 ) //vaild id { @@ -1398,7 +1392,7 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } } else { - LogWarning("New email message in ignored folder: " << folder); + LoggerW("New email message in ignored folder: " << folder); } } @@ -1408,7 +1402,7 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } else if ((mail_id > 0) && (NOTI_MAIL_UPDATE == status)) { // TODO also RECEIVE_THREAD_ITEM? - LogInfo("Email received. mail_id: " << mail_id); + LoggerI("Email received. mail_id: " << mail_id); IMessagePtr msg = MessageFactory::createMessage(EMAIL, mail_id); IConversationPtr conversation(new Conversation(thread_id, EMAIL)); @@ -1424,12 +1418,12 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) if(m_onConversationReceived.size() > 0) m_onConversationReceived.emit(jsEvent); } else { - LogWarning("New email message in ignored folder: " << folder); + LoggerW("New email message in ignored folder: " << folder); } } else if ((mail_id > 0) && (NOTI_THREAD_DELETE == status)) { // TODO also RECEIVE_THREAD_ITEM? - LogInfo("Email received. delete thread Id : " << mail_id); + LoggerI("Email received. delete thread Id : " << mail_id); IConversationPtr conversation(new Conversation()); conversation->setConvId(mail_id); @@ -1442,14 +1436,14 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } else if (NOTI_MAILBOX_ADD == status) { - LogInfo("Emailbox received. account Id: " << account_id); - LogInfo("name Id: " << name); - LogInfo("mailBox Id: " << mail_id); + LoggerI("Emailbox received. account Id: " << account_id); + LoggerI("name Id: " << name); + LoggerI("mailBox Id: " << mail_id); email_mailbox_t* mail_box = NULL; if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) { - LogError("Couldn't retrieve message or it has been malformed."); + LoggerE("Couldn't retrieve message or it has been malformed."); } if(mail_box != NULL) @@ -1468,20 +1462,20 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) if ( mail_box ) { if( EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) ) - LogDebug("fail to email_free_mailbox - err "); + LoggerD("fail to email_free_mailbox - err "); } } else if (NOTI_MAILBOX_UPDATE == status) { - LogInfo("Emailbox received. account Id: " << account_id); - LogInfo("name Id: " << name); - LogInfo("mailBox Id: " << mail_id); + LoggerI("Emailbox received. account Id: " << account_id); + LoggerI("name Id: " << name); + LoggerI("mailBox Id: " << mail_id); email_mailbox_t* mail_box = NULL; if (EMAIL_ERROR_NONE != email_get_mailbox_by_mailbox_id(mail_id, &mail_box)) { - LogError("Couldn't retrieve message or it has been malformed."); + LoggerE("Couldn't retrieve message or it has been malformed."); } if(mail_box != NULL) @@ -1501,14 +1495,14 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) if ( mail_box ) { if( EMAIL_ERROR_NONE != email_free_mailbox( &mail_box , 1) ) - LogDebug("fail to email_free_mailbox - err "); + LoggerD("fail to email_free_mailbox - err "); } } else if (NOTI_MAILBOX_DELETE == status) { - LogInfo("Emailbox received. account Id: " << account_id); - LogInfo("name Id: " << name); - LogInfo("mailBox Id: " << mail_id); + LoggerI("Emailbox received. account Id: " << account_id); + LoggerI("name Id: " << name); + LoggerI("mailBox Id: " << mail_id); // make empty mailbox m_mailboxes.mailbox_id = mail_id; @@ -1527,12 +1521,12 @@ void Messaging::OnEventReceived(const DBus::MessageEvent& event) } else { - LogError("Couldn't retrieve message or it has been malformed."); + LoggerE("Couldn't retrieve message or it has been malformed."); } } else // DBUS_INTERFACE_EMAIL_RECEIVED { - LogDebug("Wrong DBus interface, skipping it."); + LoggerD("Wrong DBus interface, skipping it."); } } } @@ -1543,13 +1537,13 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); msg_error_t err = MSG_SUCCESS; if(storageChangeType == MSG_STORAGE_CHANGE_CONTACT) { - LogDebug("storageChangeType is MSG_STORAGE_CHANGE_CONTACT"); + LoggerD("storageChangeType is MSG_STORAGE_CHANGE_CONTACT"); return; } @@ -1558,12 +1552,12 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, { Try { int msgCount = pMsgIdList->nCount; - LogDebug("msgCount = "<< msgCount); + LoggerD("msgCount = "<< msgCount); for(int index = 0; index < msgCount; index++) { - LogDebug("storageChangeType = "<< storageChangeType); + LoggerD("storageChangeType = "<< storageChangeType); if(storageChangeType == MSG_STORAGE_CHANGE_DELETE) { @@ -1592,8 +1586,8 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, if (err != MSG_SUCCESS) { - LogDebug("Get Message Failed!"); - LogDebug("err" << err); + LoggerD("Get Message Failed!"); + LoggerD("err" << err); msg_release_struct(&msg); msg_release_struct(&sendOpt); msg = NULL; @@ -1602,7 +1596,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, } int msgType = 0; msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &msgType); - LogDebug("msgType : " << msgType); + LoggerD("msgType : " << msgType); if((msgType > MSG_TYPE_INVALID) && ( msgType <= MSG_TYPE_SMS_REJECT)) { if(msgType != MSG_TYPE_MMS_NOTI) @@ -1622,12 +1616,12 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, if(storageChangeType == MSG_STORAGE_CHANGE_INSERT) { - LogDebug("MSG_STORAGE_CHANGE_INSERT"); + LoggerD("MSG_STORAGE_CHANGE_INSERT"); event->setMsg_Event_Type(EventMessageReceived::MSG_ADDED); } else if(storageChangeType == MSG_STORAGE_CHANGE_UPDATE) { - LogDebug("MSG_STORAGE_CHANGE_UPDATE"); + LoggerD("MSG_STORAGE_CHANGE_UPDATE"); event->setMsg_Event_Type(EventMessageReceived::MSG_UPDATED); } @@ -1640,7 +1634,7 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, } else { - LogError("Ignore this sms, this is mms noti."); + LoggerE("Ignore this sms, this is mms noti."); } } else if((msgType >= MSG_TYPE_MMS) && (msgType <= MSG_TYPE_MMS_NOTI)) @@ -1683,13 +1677,13 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, } else { - LogError("Ignore this mms, this is mms noti."); + LoggerE("Ignore this mms, this is mms noti."); } } if(msg != NULL) { - LogError("release msg : " << msg); + LoggerE("release msg : " << msg); msg_release_struct(&msg); } msg_release_struct(&sendOpt); @@ -1697,10 +1691,10 @@ void Messaging::onMessageStorageChanged(msg_handle_t handle, } } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("Couldn't convert message to sms."); + LoggerE("Couldn't convert message to sms."); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("onMessageStorageChanged platform exception"); + LoggerE("onMessageStorageChanged platform exception"); } } } @@ -1710,7 +1704,7 @@ void Messaging::onSmsReceived(MSG_HANDLE_T handle, msg_message_t msg, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); Messaging* this_ = static_cast(data); if (this_) { Try { @@ -1731,11 +1725,11 @@ void Messaging::onSmsReceived(MSG_HANDLE_T handle, } else { - LogError("Ignore this sms, this is mms noti."); + LoggerE("Ignore this sms, this is mms noti."); } } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("Couldn't convert message to sms."); + LoggerE("Couldn't convert message to sms."); } } } @@ -1744,7 +1738,7 @@ void Messaging::onMmsReceived(MSG_HANDLE_T handle, msg_message_t msg, void* data) { - LogDebug("ENTER"); + LoggerD("ENTER"); Messaging* this_ = static_cast(data); if (this_) { Try { @@ -1761,7 +1755,7 @@ void Messaging::onMmsReceived(MSG_HANDLE_T handle, this_->m_onMessageReceived.emit(event); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("Couldn't convert message to mms."); + LoggerE("Couldn't convert message to mms."); } } } @@ -1821,7 +1815,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, } else if (MMS == msgType) { msgTypePlatform = MSG_TYPE_MMS; } else { - LogError("no supported message type in this method"); + LoggerE("no supported message type in this method"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1840,7 +1834,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, msgFolderId = MSG_DRAFT_ID; break; default: - LogError("wrong folder type"); + LoggerE("wrong folder type"); Throw(WrtDeviceApis::Commons::PlatformException); break; } @@ -1849,15 +1843,15 @@ void Messaging::getNumberOfSmsMms(FolderType folder, if (msg_get_folder_view_list(MsgGetCommonHandle(), msgFolderId, &sort_rules, &folderListView) != MSG_SUCCESS) { - LogDebug( + LoggerD( "msg_get_folder_view_list empty or failed, msgFolderId=" << (int) msgFolderId); Throw(WrtDeviceApis::Commons::PlatformException); } // go thtough all message to check type of message - LogDebug("msgCount=" << (int) folderListView.nCount); + LoggerD("msgCount=" << (int) folderListView.nCount); for (int msg_cnt = 0; msg_cnt < folderListView.nCount; msg_cnt++) { - LogDebug("msgMainType=" << + LoggerD("msgMainType=" << (int) msg_get_message_type(folderListView. msgInfo[ msg_cnt]) << @@ -1875,7 +1869,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, } msg_release_list_struct(&folderListView); - LogDebug("readed=" << *read << ", unReaded=" << *unread); + LoggerD("readed=" << *read << ", unReaded=" << *unread); } Catch(WrtDeviceApis::Commons::PlatformException) { @@ -1888,7 +1882,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, vector Messaging::findSms(FolderType folder, const DeviceAPI::Tizen::FilterPtr& filter) { - LogDebug("<<<"); + LoggerD("<<<"); vector retVal; msg_message_t msg = msg_new_message(); @@ -1901,7 +1895,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, res = msg_get_folder_view_list(MsgGetCommonHandle(), platformFolder, &sort_rules, &folder_list_view); if (MSG_SUCCESS != res) { - LogError("msg_get_folder_view_list failed " << res); + LoggerE("msg_get_folder_view_list failed " << res); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1919,7 +1913,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, msg_release_list_struct(&folder_list_view); }Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (folder_list_view.nCount) { msg_release_list_struct(&folder_list_view); } @@ -1929,7 +1923,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, throw; } - LogDebug(">>>"); + LoggerD(">>>"); return retVal; } @@ -1950,7 +1944,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, &folder_list_view); if (MSG_SUCCESS != res) { - LogError("msg_Get_folder_view_list failed" << res); + LoggerE("msg_Get_folder_view_list failed" << res); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1968,7 +1962,7 @@ void Messaging::getNumberOfSmsMms(FolderType folder, } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); if (folder_list_view.nCount) { msg_release_list_struct(&folder_list_view); } @@ -1993,7 +1987,7 @@ void Messaging::createFolder(MessageType msgType, createEmailFolder(userFolder); break; default: - LogError("msg not supported"); + LoggerE("msg not supported"); Throw(WrtDeviceApis::Commons::UnknownException); } } @@ -2002,7 +1996,7 @@ void Messaging::createMsgServiceFolder(const std::string& userFolder) { /* if (userFolder.length() > MAX_FOLDER_NAME_SIZE) { - LogError("folder name to long"); + LoggerE("folder name to long"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -2014,7 +2008,7 @@ void Messaging::createMsgServiceFolder(const std::string& userFolder) folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; if (msg_add_folder(MsgGetCommonHandle(), &folderInfo) != MSG_SUCCESS) { - LogError("msg_add_folder failed"); + LoggerE("msg_add_folder failed"); Throw(WrtDeviceApis::Commons::PlatformException); } */ @@ -2023,7 +2017,7 @@ void Messaging::createMsgServiceFolder(const std::string& userFolder) void Messaging::createEmailFolder(const std::string& userFolder) { //TODO - LogError("TODO"); + LoggerE("TODO"); Throw(WrtDeviceApis::Commons::UnknownException); } @@ -2039,7 +2033,7 @@ void Messaging::deleteFolder(MessageType msgType, deleteEmailFolder(userFolder); break; default: - LogError("msg not supported"); + LoggerE("msg not supported"); Throw(WrtDeviceApis::Commons::UnknownException); } } @@ -2052,7 +2046,7 @@ void Messaging::deleteMsgServiceFolder(const string& userFolder) int platformFolderId = convertFolderToPlatform(userFolder); if (MSG_SUCCESS != msg_delete_folder(MsgGetCommonHandle(), platformFolderId)) { - LogError("msg_get_folder_list failed"); + LoggerE("msg_get_folder_list failed"); Throw(WrtDeviceApis::Commons::PlatformException); } } @@ -2065,7 +2059,7 @@ void Messaging::deleteMsgServiceFolder(const string& userFolder) void Messaging::deleteEmailFolder(const string& userFolder) { //TODO - LogError("TODO"); + LoggerE("TODO"); Throw(WrtDeviceApis::Commons::UnknownException); } @@ -2078,7 +2072,7 @@ vector Messaging::getFolderNames(MessageType msgType) case EMAIL: return getFolderNamesEmail(); default: - LogError("msg not supported"); + LoggerE("msg not supported"); Throw(WrtDeviceApis::Commons::UnknownException); } } @@ -2094,15 +2088,15 @@ vector Messaging::getFolderNamesMsgService() { if (msg_get_folder_list(MsgGetCommonHandle(), &msgFolderList) != MSG_SUCCESS) { - LogError("msg_get_folder_list failed"); + LoggerE("msg_get_folder_list failed"); Throw(WrtDeviceApis::Commons::PlatformException); } - LogDebug("number of folder=" << msgFolderList.nCount); + LoggerD("number of folder=" << msgFolderList.nCount); for (int i = 0; i < msgFolderList.nCount; i++) { - LogDebug("folderName=" << msgFolderList.folderInfo[i].folderName); - LogDebug("folderId=" << (int) msgFolderList.folderInfo[i].folderId); - LogDebug( + LoggerD("folderName=" << msgFolderList.folderInfo[i].folderName); + LoggerD("folderId=" << (int) msgFolderList.folderInfo[i].folderId); + LoggerD( "folderType=" << (int) msgFolderList.folderInfo[i].folderType); retVal.push_back(msgFolderList.folderInfo[i].folderName); @@ -2134,23 +2128,23 @@ vector Messaging::getFolderNamesEmail() { if (!email_get_mailbox_list(account.getIntId(), -1, &mailboxes, &mailboxesCount) || !mailboxes) { - LogError("error during get mailboxes"); + LoggerE("error during get mailboxes"); } if(mailboxes == NULL) { - LogError("error during get mailboxes"); + LoggerE("error during get mailboxes"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't get mailboxes"); } for (int i = 0; i < mailboxesCount; i++) { retVal.push_back(mailboxes->mailbox_name); - LogDebug("mailbox found, name=" << mailboxes->mailbox_name); + LoggerD("mailbox found, name=" << mailboxes->mailbox_name); mailboxes++; } if(mailboxes != NULL) { if( EMAIL_ERROR_NONE != email_free_mailbox( &mailboxes , mailboxesCount) ) - LogDebug("fail to email_free_mailbox - err "); + LoggerD("fail to email_free_mailbox - err "); } } @@ -2169,7 +2163,7 @@ vector Messaging::findEmail(const std::string &folder, EmailAccountInfo account = getCurrentEmailAccount(); if (account.getId().empty()) { - LogWarning("No valid email accounts. Skipping"); + LoggerW("No valid email accounts. Skipping"); return retVal; } @@ -2193,10 +2187,10 @@ vector Messaging::findEmail(const std::string &folder, DPL::ScopedFree autoFree(results); (void)autoFree; if (EMAIL_ERROR_MAIL_NOT_FOUND == err || results == NULL) { - LogWarning("No emails found in mailbox: " << folder); + LoggerW("No emails found in mailbox: " << folder); break; } else if (EMAIL_ERROR_NONE != err) { - LogError( + LoggerE( "Unable to get mail list for mailbox: " << folder << ", Error: " << err); Throw(WrtDeviceApis::Commons::PlatformException); @@ -2228,7 +2222,7 @@ vector Messaging::findEmail(FolderType folder, EmailAccountInfo account = getCurrentEmailAccount(); if (account.getId().empty()) { - LogWarning("No valid email accounts."); + LoggerW("No valid email accounts."); return result; } @@ -2237,7 +2231,7 @@ vector Messaging::findEmail(FolderType folder, name = EmailConverter::toMailboxName(folder); } catch (const WrtDeviceApis::Commons::PlatformException& ex) { - LogWarning(ex.DumpToString()); + LoggerW(ex.DumpToString()); return result; } @@ -2256,7 +2250,7 @@ vector Messaging::findEmail(FolderType folder, &count); DPL::ScopedFree freeGuard(messages); if ((EMAIL_ERROR_MAIL_NOT_FOUND == error) || (NULL == messages)) { - LogWarning("No emails found in mailbox: " << name); + LoggerW("No emails found in mailbox: " << name); break; } else if (EMAIL_ERROR_NONE != error) { ThrowMsg(WrtDeviceApis::Commons::PlatformException, @@ -2283,7 +2277,7 @@ vector Messaging::findEmail(FolderType folder, */ int Messaging::getConversationId(const int& msgId, const MessageType& msgtype) { - LogDebug("Enter"); + LoggerD("Enter"); switch(msgtype) { @@ -2294,7 +2288,7 @@ int Messaging::getConversationId(const int& msgId, const MessageType& msgtype) email_mail_list_item_t *mailList = NULL; email_mail_data_t* result = NULL; - LogDebug("Current Account " << m_currentEmailAccountId); + LoggerD("Current Account " << m_currentEmailAccountId); try { @@ -2326,7 +2320,7 @@ int Messaging::getConversationId(const int& msgId, const MessageType& msgtype) // if (mailBox) // free(mailBox); email_free_mail_data(&result,1); - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); throw; } return MSG_ERR_INVALID_MSG_TYPE; @@ -2351,7 +2345,7 @@ int Messaging::getConversationId(const int& msgId, const MessageType& msgtype) int threadId = 0; err = msg_get_int_value(msg, MSG_MESSAGE_THREAD_ID_INT, &threadId); - LogDebug(err); + LoggerD(err); if( err < MSG_SUCCESS ) { @@ -2375,7 +2369,7 @@ int Messaging::getConversationId(const int& msgId, const MessageType& msgtype) std::vector Messaging::queryConversations(const DeviceAPI::Tizen::SortModePtr& sortMode, const DeviceAPI::Tizen::FilterPtr& filter, long limit, long offset) { - LogDebug("Enter"); + LoggerD("Enter"); std::vector result; std::string filterSql; @@ -2385,12 +2379,12 @@ std::vector Messaging::queryConversations(const DeviceAPI::Tiz IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); int conversationType = queryGenerator->getMessageType(); switch(conversationType){ case EMAIL:{ - LogDebug("type is EMAIL:[" << conversationType <<"]"); + LoggerD("type is EMAIL:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_EMAIL); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); @@ -2399,31 +2393,31 @@ std::vector Messaging::queryConversations(const DeviceAPI::Tiz } case SMS:{ - LogDebug("type is SMS:[" << conversationType <<"]"); + LoggerD("type is SMS:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_SMS_MMS); IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql:[" << orderLimitSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql:[" << orderLimitSql <<"]"); result = querySmsMmsConversation(filterSql, orderLimitSql); break; } case MMS:{ - LogDebug("type is MMS:[" << conversationType <<"]"); + LoggerD("type is MMS:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_SMS_MMS); IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql:[" << orderLimitSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql:[" << orderLimitSql <<"]"); result = querySmsMmsConversation(filterSql, orderLimitSql); break; } default:{ - LogError("[ERROR] >>> invlid type:[" << conversationType <<"]"); + LoggerE("[ERROR] >>> invlid type:[" << conversationType <<"]"); return result; } } //switch @@ -2434,7 +2428,7 @@ std::vector Messaging::queryConversations(const DeviceAPI::Tiz std::vector Messaging::queryConversations(const DeviceAPI::Tizen::FilterPtr& filter, const DeviceAPI::Tizen::SortModePtr& sortMode, int type, long limit, long offset) { - LogDebug("Enter"); + LoggerD("Enter"); std::vector result; std::string filterSql; @@ -2444,55 +2438,55 @@ std::vector Messaging::queryConversations(const DeviceAPI::Tiz IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); int conversationType = queryGenerator->getMessageType(); if(conversationType != -1) { if(conversationType != type) { - LogDebug("filter conversationType and service msg type is diff"); + LoggerD("filter conversationType and service msg type is diff"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid Fiilter Type"); } } switch(type){ case EMAIL:{ - LogDebug("type is EMAIL:[" << conversationType <<"]"); + LoggerD("type is EMAIL:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_EMAIL); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); - LogDebug("filterSql:[" << filterSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); result = queryEmailConversation(filterSql); break; } case SMS:{ - LogDebug("type is SMS:[" << conversationType <<"]"); + LoggerD("type is SMS:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_SMS); IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); orderLimitSql = queryGenerator->getOrderLimit(); - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql:[" << orderLimitSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql:[" << orderLimitSql <<"]"); result = querySmsMmsConversation(filterSql, orderLimitSql); break; } case MMS:{ - LogDebug("type is MMS:[" << conversationType <<"]"); + LoggerD("type is MMS:[" << conversationType <<"]"); queryGenerator->reset(MessageQueryGenerator::MODE_MMS); IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); filter->travel(filterVisitor, 0); filterSql = queryGenerator->getQuery(); orderLimitSql = queryGenerator->getOrderLimit(); - LogDebug("filterSql:[" << filterSql <<"]"); - LogDebug("orderLimitSql:[" << orderLimitSql <<"]"); + LoggerD("filterSql:[" << filterSql <<"]"); + LoggerD("orderLimitSql:[" << orderLimitSql <<"]"); result = querySmsMmsConversation(filterSql, orderLimitSql); break; } default:{ - LogError("[ERROR] >>> invlid type:[" << conversationType <<"]"); + LoggerE("[ERROR] >>> invlid type:[" << conversationType <<"]"); return result; } } //switch @@ -2502,7 +2496,7 @@ std::vector Messaging::queryConversations(const DeviceAPI::Tiz /* bool Messaging::deleteConversations(const DeviceAPI::Tizen::SortModePtr& sortMode, const DeviceAPI::Tizen::FilterPtr& filter) { - LogDebug("Enter"); + LoggerD("Enter"); std::vector conversationsToDelete = queryConversations(sortMode, filter); return deleteConversations(conversationsToDelete); @@ -2510,14 +2504,14 @@ bool Messaging::deleteConversations(const DeviceAPI::Tizen::SortModePtr& sortMod */ bool Messaging::deleteConversations(const std::vector& conversations) { - LogDebug("Enter"); + LoggerD("Enter"); if (conversations.size() == 0) return false; if (conversations[0]->getType() == EMAIL) { - LogDebug("Enter-Email"); + LoggerD("Enter-Email"); int threadId = 0; for (std::size_t i = 0; i < conversations.size(); ++i) @@ -2532,7 +2526,7 @@ bool Messaging::deleteConversations(const std::vector& convers } else { - LogDebug("Enter-Msg"); + LoggerD("Enter-Msg"); msg_thread_id_t threadId = 0; msg_handle_t handle = MsgGetCommonHandle(); @@ -2550,7 +2544,7 @@ bool Messaging::deleteConversations(const std::vector& convers std::vector Messaging::queryFolders(const DeviceAPI::Tizen::FilterPtr& filter) { - LogDebug("Enter"); + LoggerD("Enter"); email_mailbox_t* mailboxes = NULL; email_mailbox_t* mailboxes_org = NULL; @@ -2565,7 +2559,7 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F EmailAccountInfo account = getCurrentEmailAccount(); if (account.getId().empty()) { - LogWarning("No valid email accounts. Skipping"); + LoggerW("No valid email accounts. Skipping"); return result; } @@ -2580,7 +2574,7 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F if(accountId == 0) { - LogWarning("No valid email accounts. accountId : 0"); + LoggerW("No valid email accounts. accountId : 0"); return result; } @@ -2590,7 +2584,7 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F if(email_get_mailbox_by_name(accountId, folderName.c_str(), &mailboxes) != 1) { - LogError("error during get mailboxes"); + LoggerE("error during get mailboxes"); return result; } @@ -2602,7 +2596,7 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F if (!email_get_mailbox_list(accountId, -1, &mailboxes, &mailboxesCount) || !mailboxes) { - LogError("error during get mailboxes"); + LoggerE("error during get mailboxes"); return result; } @@ -2610,11 +2604,11 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F if (mailboxesCount <= 0) { - LogDebug("Empty..."); + LoggerD("Empty..."); } else { - LogDebug("found mailboxs : " << mailboxesCount); + LoggerD("found mailboxs : " << mailboxesCount); for (int i = 0; i < mailboxesCount; i++) { @@ -2630,11 +2624,11 @@ std::vector Messaging::queryFolders(const DeviceAPI::Tizen::F if(mailboxes != NULL) { error = email_free_mailbox(&mailboxes,mailboxesCount); - LogError("email_free_mailbox : " << error); + LoggerE("email_free_mailbox : " << error); } } - LogDebug("End"); + LoggerD("End"); return result; diff --git a/src/Messaging/MessagingController.cpp b/src/Messaging/MessagingController.cpp index 661d03e..9b126bf 100644 --- a/src/Messaging/MessagingController.cpp +++ b/src/Messaging/MessagingController.cpp @@ -34,6 +34,7 @@ #include "MessageAsyncCallbackManager.h" #include +#include IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::MessagingController) @@ -51,13 +52,13 @@ MessagingController::MessagingController() : GetMessagingServiceReceiver (ThreadEnum::NULL_THREAD), MessagingServiceReceiver (ThreadEnum::NULL_THREAD) { - LogDebug("<<< "); - LogDebug(">>>"); + LoggerD("<<< "); + LoggerD(">>>"); } MessagingController::~MessagingController() { - LogDebug("<<<"); - LogDebug(">>>"); + LoggerD("<<<"); + LoggerD(">>>"); } MessagingController& MessagingController::getInstance() @@ -67,7 +68,7 @@ MessagingController& MessagingController::getInstance() } void MessagingController::OnAnswerReceived(const EventGetMessagingServicePtr &event) { - LogDebug("<<<"); + LoggerD("<<<"); WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast (event->getPrivateData()); MessageAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); @@ -80,7 +81,7 @@ void MessagingController::OnAnswerReceived(const EventGetMessagingServicePtr &ev JSObjectRef jsMessagingServiceObject[count]; //make - LogDebug(" Service Count :" << count); + LoggerD(" Service Count :" << count); for (index = 0; index < count; index++) { @@ -92,7 +93,7 @@ void MessagingController::OnAnswerReceived(const EventGetMessagingServicePtr &ev } else { - LogDebug("Operation failed. Exception code: " << event->getExceptionCode()); + LoggerD("Operation failed. Exception code: " << event->getExceptionCode()); JSContextRef context = callbackManager->getContext(); JSValueRef errorObject = NULL; @@ -118,12 +119,12 @@ void MessagingController::OnAnswerReceived(const EventGetMessagingServicePtr &ev callbackManager->callOnError(errorObject); } - LogDebug(">>>"); + LoggerD(">>>"); } void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event) { - LogDebug(" <<< EventMessagingServicePtr >>> "); + LoggerD(" <<< EventMessagingServicePtr >>> "); EventMessagingServicePrivateDataPtr privateData = DPL::StaticPointerCast(event->getPrivateData()); @@ -134,21 +135,21 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event JSContextRef globalContext = callbackManager->getContext(); int MessagingServiceEventType = event->getEventType(); - LogDebug(" MessagingServiceEvent Type :" << MessagingServiceEventType); + LoggerD(" MessagingServiceEvent Type :" << MessagingServiceEventType); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(globalContext); if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_BODY) { - LogDebug(" Message Load Body"); - LogDebug("Operation ID : " << event->opId); + LoggerD(" Message Load Body"); + LoggerD("Operation ID : " << event->opId); if ( event->m_messagingService) event->m_messagingService->deleteOpId(event->opId); if (event->getExceptionCode() == ExceptionCodes::None && event->m_message) { - LogDebug(" Message Type :" << event->m_message->getMessageType()); + LoggerD(" Message Type :" << event->m_message->getMessageType()); JSValueRef msg = JSMessage::createJSObject(globalContext, event->m_message); if(msg) callbackManager->callOnSuccess(msg); @@ -164,14 +165,14 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event } else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_ATTACHMENT) { - LogDebug(" Message load attachment"); - LogDebug("Operation ID : " << event->opId); + LoggerD(" Message load attachment"); + LoggerD("Operation ID : " << event->opId); if ( event->m_messagingService) event->m_messagingService->deleteOpId(event->opId); if (event->getExceptionCode() == ExceptionCodes::None && event->m_attachment) { - LogDebug(" Message Type :" << event->m_message->getMessageType()); + LoggerD(" Message Type :" << event->m_message->getMessageType()); JSValueRef attachment = JSMessageAttachment::createJS(globalContext, event->m_attachment ); if ( attachment) @@ -187,8 +188,8 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event } else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC) { - LogDebug(" Message Sync :"); - LogDebug("Operation ID : " << event->opId); + LoggerD(" Message Sync :"); + LoggerD("Operation ID : " << event->opId); if ( event->m_messagingService) event->m_messagingService->deleteOpId(event->opId); @@ -203,8 +204,8 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event } else if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_SYNC_FOLDER) { - LogDebug(" Message Sync Folder"); - LogDebug("Operation ID : " << event->opId); + LoggerD(" Message Sync Folder"); + LoggerD("Operation ID : " << event->opId); if ( event->m_messagingService) event->m_messagingService->deleteOpId(event->opId); if (event->getExceptionCode() == ExceptionCodes::None) @@ -240,20 +241,20 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event //remove operation handle if (event->m_messagingService) { - LogDebug("Operation ID : " << event->opId); + LoggerD("Operation ID : " << event->opId); event->m_messagingService->deleteOpId(event->opId); } if (WrtDeviceApis::Commons::ExceptionCodes::None == event->getExceptionCode()) { - LogDebug(" success size : " << event->m_successRecipients.size()); + LoggerD(" success size : " << event->m_successRecipients.size()); std::vector successRecipentList; int cnt = event->m_successRecipients.size(); - LogDebug( "success count : " << cnt); + LoggerD( "success count : " << cnt); for(int index = 0; index < cnt; index++) { - LogDebug( "success recipent : " << event->m_successRecipients[index]); + LoggerD( "success recipent : " << event->m_successRecipients[index]); successRecipentList.push_back(converter.toJSValueRef(event->m_successRecipients[index])); } @@ -276,7 +277,7 @@ void MessagingController::OnAnswerReceived(const EventMessagingServicePtr &event } void MessagingController::OnAnswerReceived(const EventSendMessagePtr& event) { - LogDebug("ENTER"); + LoggerD("ENTER"); JSValueRef error = NULL; EventSendMessagePrivateDataPtr privateData = @@ -311,22 +312,22 @@ void MessagingController::OnAnswerReceived(const EventSendMessagePtr& event) //remove operation handle if (event->m_messagingService) { - LogDebug("Operation ID : " << event->opId); + LoggerD("Operation ID : " << event->opId); event->m_messagingService->deleteOpId(event->opId); } if (WrtDeviceApis::Commons::ExceptionCodes::None == event->getExceptionCode()) { - LogDebug(" success size : " << event->m_successRecipients.size()); + LoggerD(" success size : " << event->m_successRecipients.size()); //JSObjectRef result = JSObjectMakeArray(context, event->m_successRecipients.size(), jsMessagingServiceObject, NULL); std::vector successRecipentList; int cnt = event->m_successRecipients.size(); - LogDebug( "success count : " << cnt); + LoggerD( "success count : " << cnt); for(int index = 0; index < cnt; index++) { - LogDebug( "success recipent : " << event->m_successRecipients[index]); + LoggerD( "success recipent : " << event->m_successRecipients[index]); successRecipentList.push_back(converter.toJSValueRef(event->m_successRecipients[index])); } diff --git a/src/Messaging/MessagingController.h b/src/Messaging/MessagingController.h index 6b41617..a143124 100755 --- a/src/Messaging/MessagingController.h +++ b/src/Messaging/MessagingController.h @@ -18,7 +18,6 @@ #ifndef WRTPLUGINS_TIZEN_MESSAGING_CONTROLLER_H_ #define WRTPLUGINS_TIZEN_MESSAGING_CONTROLLER_H_ -#include #include #include "IMessagingServiceManager.h" #include "IMessagingService.h" diff --git a/src/Messaging/MessagingListener.cpp b/src/Messaging/MessagingListener.cpp index e037aa0..2f1d4db 100644 --- a/src/Messaging/MessagingListener.cpp +++ b/src/Messaging/MessagingListener.cpp @@ -76,7 +76,7 @@ void MessagingListener::OnAnswerReceived( WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); Assert(NULL != callbackManager); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); JSContextRef context = callbackManager->getContext(); Assert(NULL != context); @@ -102,22 +102,22 @@ void MessagingListener::OnAnswerReceived( } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("InvalidArgument error"); + LoggerE("InvalidArgument error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -132,7 +132,7 @@ void MessagingListener::OnAnswerReceived( WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); Assert(NULL != callbackManager); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); JSContextRef context = callbackManager->getContext(); Assert(NULL != context); @@ -163,26 +163,26 @@ void MessagingListener::OnAnswerReceived( } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -194,7 +194,7 @@ void MessagingListener::OnAnswerReceived( WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); Assert(NULL != callbackManager); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); JSContextRef context = callbackManager->getContext(); Assert(NULL != context); @@ -219,19 +219,19 @@ void MessagingListener::OnAnswerReceived( } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -244,7 +244,7 @@ void MessagingListener::OnAnswerReceived( WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); Assert(NULL != callbackManager); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); JSContextRef context = callbackManager->getContext(); Assert(NULL != context); @@ -269,19 +269,19 @@ void MessagingListener::OnAnswerReceived( } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -294,7 +294,7 @@ void MessagingListener::OnAnswerReceived( WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); Assert(NULL != callbackManager); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); JSContextRef context = callbackManager->getContext(); Assert(NULL != context); @@ -319,19 +319,19 @@ void MessagingListener::OnAnswerReceived( } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -339,7 +339,7 @@ void MessagingListener::OnAnswerReceived( void MessagingListener::OnAnswerReceived(const EventQueryConversationsPtr& event) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); @@ -376,25 +376,25 @@ void MessagingListener::OnAnswerReceived(const EventQueryConversationsPtr& event Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -403,7 +403,7 @@ void MessagingListener::OnAnswerReceived(const EventQueryConversationsPtr& event void MessagingListener::OnAnswerReceived(const EventDeleteConversationsPtr& event) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); JSContextRef context = callbackManager->getContext(); @@ -433,19 +433,19 @@ void MessagingListener::OnAnswerReceived(const EventDeleteConversationsPtr& even } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -453,7 +453,7 @@ void MessagingListener::OnAnswerReceived(const EventDeleteConversationsPtr& even void MessagingListener::OnAnswerReceived(const EventQueryFoldersPtr& event) { - LogDebug("enter"); + LoggerD("enter"); WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); @@ -468,7 +468,7 @@ void MessagingListener::OnAnswerReceived(const EventQueryFoldersPtr& event) { vector folderPtr = event->getFolders(); int size = folderPtr.size(); - LogDebug(size); + LoggerD(size); ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context); callbackManager->callOnSuccess(converter->toJSValueRef(folderPtr)); @@ -491,25 +491,25 @@ void MessagingListener::OnAnswerReceived(const EventQueryFoldersPtr& event) Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error"); + LoggerE("platform error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogError("conversion error"); + LoggerE("conversion error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT)); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("unknown error"); + LoggerE("unknown error"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN)); } @@ -520,11 +520,11 @@ void MessagingListener::OnAnswerReceived(const EventQueryFoldersPtr& event) void MessagingListener::onAnswerReceived( const EventMessageReceivedPtr& event) { - LogDebug("<<<"); + LoggerD("<<<"); if (WrtDeviceApis::Commons::ExceptionCodes::None != event->getExceptionCode()) { - LogError("exception occured: " << event->getExceptionCode()); + LoggerE("exception occured: " << event->getExceptionCode()); return; } @@ -549,7 +549,7 @@ void MessagingListener::onAnswerReceived( if(filter != NULL && msg->getMessageType() != EMPTY_MESSAGE) { - LogDebug("Filter exist"); + LoggerD("Filter exist"); StorageChangesMessageGeneratorPtr queryGenerator(new StorageChangesMessageGenerator(event->getMessage(), event->getConversation())); DeviceAPI::Tizen::IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); @@ -558,19 +558,19 @@ void MessagingListener::onAnswerReceived( // IMessagePtr msg = event->getMessage(); if(queryGenerator->getCompareResult()) { - LogDebug("Message call back"); + LoggerD("Message call back"); msgs.push_back(msg); jsMsg = converter->toJSValueRef(msgs, this); } else { - LogDebug("skip"); + LoggerD("skip"); return; } } else { - LogDebug("Filter not exist or empty message"); + LoggerD("Filter not exist or empty message"); std::vector msgs; // for msg IMessagePtr msg = event->getMessage(); msgs.push_back(msg); @@ -585,7 +585,7 @@ void MessagingListener::onAnswerReceived( if(filter != NULL && msg->getMessageType() != EMPTY_MESSAGE) { - LogDebug("Filter exist"); + LoggerD("Filter exist"); StorageChangesConversationGeneratorPtr queryGenerator(new StorageChangesConversationGenerator(event->getConversation())); DeviceAPI::Tizen::IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); @@ -594,23 +594,23 @@ void MessagingListener::onAnswerReceived( IConversationPtr conversation = event->getConversation(); if(queryGenerator->getCompareResult()) { - LogDebug("Message call back"); + LoggerD("Message call back"); convPtrs.push_back(conversation); jsMsg = converter->toJSValueRef(convPtrs); } else { - LogDebug("skip"); + LoggerD("skip"); return; } } else { - LogDebug("Filter not exist or empty conversation"); + LoggerD("Filter not exist or empty conversation"); std::vector convPtrs; // for conversation IConversationPtr conversation = event->getConversation(); - LogDebug("Conversation call back"); + LoggerD("Conversation call back"); convPtrs.push_back(conversation); jsMsg = converter->toJSValueRef(convPtrs); @@ -622,7 +622,7 @@ void MessagingListener::onAnswerReceived( DeviceAPI::Tizen::FilterPtr filter = multiCallbacks->getFilter(); if(filter != NULL) { - LogDebug("Filter exist"); + LoggerD("Filter exist"); StorageChangesFolderGeneratorPtr queryGenerator(new StorageChangesFolderGenerator(event->getMessageFolder())); DeviceAPI::Tizen::IFilterVisitorPtr filterVisitor = DPL::StaticPointerCast(queryGenerator); @@ -631,23 +631,23 @@ void MessagingListener::onAnswerReceived( IMessageFolderPtr messagefolder = event->getMessageFolder(); if(queryGenerator->getCompareResult()) { - LogDebug("Message call back"); + LoggerD("Message call back"); folderPtrs.push_back(messagefolder); jsMsg = converter->toJSValueRef(folderPtrs); } else { - LogDebug("skip"); + LoggerD("skip"); return; } } else { - LogDebug("Filter not exist"); + LoggerD("Filter not exist"); std::vector folderPtrs; // for messagefoldeer IMessageFolderPtr messagefolder = event->getMessageFolder(); - LogDebug("MessageFolder call back"); + LoggerD("MessageFolder call back"); folderPtrs.push_back(messagefolder); jsMsg = converter->toJSValueRef(folderPtrs); @@ -660,19 +660,28 @@ void MessagingListener::onAnswerReceived( { case EventMessageReceived::MSG_ADDED: { - multiCallbacks->getMessagesAdded()->callOnSuccess(jsMsg); + if(multiCallbacks->getMessagesAdded()) + { + multiCallbacks->getMessagesAdded()->callOnSuccess(jsMsg); + } } break; case EventMessageReceived::MSG_UPDATED: { - defaultCbm = multiCallbacks->getMessagesUpdated(); - defaultCbm->callOnSuccess(jsMsg); + if(multiCallbacks->getMessagesUpdated()) + { + defaultCbm = multiCallbacks->getMessagesUpdated(); + defaultCbm->callOnSuccess(jsMsg); + } } break; case EventMessageReceived::MSG_DELETED: { - defaultCbm = multiCallbacks->getMessagesRemoved(); - defaultCbm->callOnSuccess(jsMsg); + if(multiCallbacks->getMessagesRemoved()) + { + defaultCbm = multiCallbacks->getMessagesRemoved(); + defaultCbm->callOnSuccess(jsMsg); + } } break; default: @@ -694,26 +703,26 @@ long MessagingListener::addIncomingMsgCallback(const WrtDeviceApis::CommonsJavaS { callbacks = &m_MessageCallbacks; handle = static_cast(m_emiterMsgId.back()); - LogWarning("Message Emitter handle : " << handle); + LoggerW("Message Emitter handle : " << handle); } break; case CONVERSATIONS_MULTI_FUNCTION: { callbacks = &m_ConversationCallbacks; handle = static_cast(m_emiterConvId.back()); - LogWarning("Conversation Emitter handle : " << handle); + LoggerW("Conversation Emitter handle : " << handle); } break; case FOLDERS_MULTI_FUNCTION: { callbacks = &m_FolderCallbacks; handle = static_cast(m_emiterFolderId.back()); - LogWarning("Folder Emitter handle : " << handle); + LoggerW("Folder Emitter handle : " << handle); } break; default: { - LogWarning("Unexpected state"); + LoggerW("Unexpected state"); } break; } @@ -739,8 +748,8 @@ void MessagingListener::removeIncomingMsgCallback(long handle, int type, long in if(!checkMessagingEmitter(handle, type, index)) { - LogWarning("Try to deregister by unmatched service"); - Throw(WrtDeviceApis::Commons::InvalidArgumentException); + LoggerW("Try to deregister by unmatched service or unknown id"); + ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Unknown id"); } msgRemoved += m_MessageCallbacks.erase(handle); @@ -749,46 +758,46 @@ void MessagingListener::removeIncomingMsgCallback(long handle, int type, long in // there are duplicate handles if (msgRemoved+msgRemoved+folderRemoved > 1) { - LogError("Duplicate callback handles!"); + LoggerE("Duplicate callback handles!"); } EmitterMessageReceived::IdType temp_handle; temp_handle = static_cast(handle); if (msgRemoved) { - LogWarning("EmitterMessageReceived registered"); + LoggerW("EmitterMessageReceived registered"); IMessaging::getInstance().removeOnMessageMsgReceived(temp_handle); removeMessagingEmitter(temp_handle); for(unsigned int i=0; i(m_emiterMsgId[i])) { - LogWarning("handle : handle " << temp_handle<< " " << static_cast(m_emiterMsgId[i]) ); + LoggerW("handle : handle " << temp_handle<< " " << static_cast(m_emiterMsgId[i]) ); m_emiterMsgId.erase(m_emiterMsgId.begin()+i); } } } else if (convRemoved) { - LogWarning("EmitterConversationReceived registered"); + LoggerW("EmitterConversationReceived registered"); IMessaging::getInstance().removeOnMessageConvReceived(temp_handle); removeMessagingEmitter(temp_handle); for(unsigned int i=0; i(m_emiterConvId[i])) { - LogWarning("handle : handle " << temp_handle<< " " << static_cast(m_emiterConvId[i]) ); + LoggerW("handle : handle " << temp_handle<< " " << static_cast(m_emiterConvId[i]) ); m_emiterConvId.erase(m_emiterConvId.begin()+i); } } } else if (folderRemoved) { - LogWarning("EmitterFolderReceived registered"); + LoggerW("EmitterFolderReceived registered"); IMessaging::getInstance().removeOnMessageFolderReceived(temp_handle); removeMessagingEmitter(temp_handle); for(unsigned int i=0; i(m_emiterFolderId[i])) { - LogWarning("handle : handle " << temp_handle<< " " << static_cast(m_emiterFolderId[i]) ); + LoggerW("handle : handle " << temp_handle<< " " << static_cast(m_emiterFolderId[i]) ); m_emiterFolderId.erase(m_emiterFolderId.begin()+i); } } @@ -831,7 +840,7 @@ void MessagingListener::registerMessageReceivedEmitter(EventOnMessagingStorageCh } } Catch(WrtDeviceApis::Commons::PlatformException){ - LogDebug("registerMessageReceivedEmitter failed"); + LoggerD("registerMessageReceivedEmitter failed"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -839,9 +848,9 @@ void MessagingListener::registerMessageReceivedEmitter(EventOnMessagingStorageCh void MessagingListener::deregisterMessageReceivedEmitter() { - LogDebug("enter"); + LoggerD("enter"); if (m_emiterMsgId.size() > 0) { - LogWarning("EmitterMessageReceived registered"); + LoggerW("EmitterMessageReceived registered"); EmitterMessageReceived::IdType tempId; while(m_emiterMsgId.size() > 0) { @@ -852,7 +861,7 @@ void MessagingListener::deregisterMessageReceivedEmitter() } if (m_emiterConvId.size() > 0) { - LogWarning("EmitterConversationReceived registered"); + LoggerW("EmitterConversationReceived registered"); EmitterConversationReceived::IdType tempId; while(m_emiterConvId.size() > 0) { @@ -863,7 +872,7 @@ void MessagingListener::deregisterMessageReceivedEmitter() } if (m_emiterFolderId.size() > 0) { - LogWarning("EmitterFolderReceived registered"); + LoggerW("EmitterFolderReceived registered"); EmitterFolderReceived::IdType tempId; while(m_emiterFolderId.size() > 0) { @@ -879,7 +888,7 @@ void MessagingListener::deregisterMessageReceivedEmitter() { removeMessagingEmitter(it->first); } - LogDebug("finish"); + LoggerD("finish"); return; } @@ -888,8 +897,8 @@ bool MessagingListener::checkMessagingEmitter(long handle, int type, long index) int ret = FALSE; MessagingEmitterRegistersIterator it = m_requests.find(handle); - LogDebug("handle, type, index"<< handle << " " << type << " " << index); - LogDebug("it->second.type, it->second.accountId"<< it->second.type << " " << it->second.accountId); + LoggerD("handle, type, index"<< handle << " " << type << " " << index); + LoggerD("it->second.type, it->second.accountId"<< it->second.type << " " << it->second.accountId); if((it->second.type == type) && (it->second.accountId == index)) { @@ -900,13 +909,13 @@ bool MessagingListener::checkMessagingEmitter(long handle, int type, long index) void MessagingListener::addMessagingEmitter(long handle, int type, long index) { - LogDebug("handle, type, index"<< handle << " " << type << " " << index); + LoggerD("handle, type, index"<< handle << " " << type << " " << index); m_requests.insert(std::make_pair(handle, MessagingEmitterData(type, index))); } void MessagingListener::removeMessagingEmitter(long handle) { - LogDebug("handle"<< handle ); + LoggerD("handle"<< handle ); m_requests.erase(handle); } diff --git a/src/Messaging/MessagingService.cpp b/src/Messaging/MessagingService.cpp old mode 100755 new mode 100644 index 0d144da..c6738e4 --- a/src/Messaging/MessagingService.cpp +++ b/src/Messaging/MessagingService.cpp @@ -25,6 +25,7 @@ #include #include +#include using namespace DPL; using namespace std; @@ -35,11 +36,11 @@ namespace Messaging { MessagingService::MessagingService() : m_initialized(false) { - LogDebug("Enter"); + LoggerD("Enter"); } MessagingService::~MessagingService() { - LogDebug("Leave"); + LoggerD("Leave"); m_opRequests.clear(); //clean Messaging Service Handles } @@ -47,11 +48,11 @@ MessagingService::~MessagingService() { //public function. void MessagingService::initialize() { - LogDebug("<<<"); + LoggerD("<<<"); m_initialized = true; - LogDebug(">>>"); + LoggerD(">>>"); } void MessagingService::setMessagingServiceType(int type) @@ -71,26 +72,26 @@ void MessagingService::setMessagingServiceId(int serviceId) int MessagingService::sync(const IMessagingServicePtr& messagingService, const int limit) { - LogDebug("<<<"); + LoggerD("<<<"); return MailSync::getInstance().syncAccount( messagingService, limit ); } void MessagingService::syncCancel(int handle) { - LogDebug("<<<"); + LoggerD("<<<"); return MailSync::getInstance().syncAccountCancel(handle); } int MessagingService::syncFolder(const IMessagingServicePtr& messagingService, const int folder_id, const int limit) { - LogDebug("<<<"); + LoggerD("<<<"); return MailSync::getInstance().syncFolder( messagingService, folder_id, limit); } void MessagingService::syncFolderCancel(int handle) { - LogDebug("<<<"); + LoggerD("<<<"); return MailSync::getInstance().syncFolderCancel(handle); } @@ -145,8 +146,8 @@ int MessagingService::createOpId(int type) index = type; } - LogDebug("m_opRequests size : " << cnt ); - LogDebug("index " << index); + LoggerD("m_opRequests size : " << cnt ); + LoggerD("index " << index); m_opRequests.insert(std::make_pair(index, MessagingServiceOpData(0,type))); return index; @@ -154,7 +155,7 @@ int MessagingService::createOpId(int type) int MessagingService::getHandleFromOpId(int opIdx) { - LogDebug("operation index size : " << opIdx); + LoggerD("operation index size : " << opIdx); int handle = -1; @@ -164,14 +165,14 @@ int MessagingService::getHandleFromOpId(int opIdx) handle = it->second.handle; } - LogDebug("index " << handle); + LoggerD("index " << handle); return handle; } IMessagePtr MessagingService::getMessageFromOpId(int opIdx) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); OpRequestsIterator it = m_opRequests.find(opIdx); IMessagePtr msg; if ( m_opRequests.end() != it) @@ -184,12 +185,12 @@ IMessagePtr MessagingService::getMessageFromOpId(int opIdx) EventMessagingServicePtr MessagingService::getEventFromOpId(int opIdx) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); OpRequestsIterator it = m_opRequests.find(opIdx); EventMessagingServicePtr event; if ( m_opRequests.end() != it) { - LogDebug("Find Event"); + LoggerD("Find Event"); event = it->second.event; } @@ -198,21 +199,21 @@ EventMessagingServicePtr MessagingService::getEventFromOpId(int opIdx) EventMessagingServicePtr MessagingService::getEventFromHandle(int handle) { - LogDebug("handle index : " << handle); + LoggerD("handle index : " << handle); EventMessagingServicePtr event; int cnt = m_opRequests.size(); //item count. - LogDebug("cnt : " << cnt); + LoggerD("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); + LoggerD("it->first : " << it->first); + LoggerD("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); + LoggerD("get opId : " << it->first); + LoggerD("event of handle : " << it->second.handle); event = it->second.event; } } @@ -222,12 +223,12 @@ EventMessagingServicePtr MessagingService::getEventFromHandle(int handle) void MessagingService::setHandleToOpId(int opIdx, int handle) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); OpRequestsIterator it = m_opRequests.find(opIdx); if ( m_opRequests.end() != it) { - LogDebug(" find Message "); + LoggerD(" find Message "); it->second.handle = handle; } @@ -235,27 +236,27 @@ void MessagingService::setHandleToOpId(int opIdx, int handle) void MessagingService::setMessageToOpId(int opIdx, IMessagePtr& message) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); OpRequestsIterator it = m_opRequests.find(opIdx); if ( m_opRequests.end() != it) { - LogDebug("set Message "); + LoggerD("set Message "); it->second.message = message; } } void MessagingService::setEventToOpId(int opIdx, EventMessagingServicePtr & event) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); OpRequestsIterator it = m_opRequests.find(opIdx); if ( m_opRequests.end() != it) { - LogDebug("set Message "); + LoggerD("set Message "); if (event) { - LogDebug("vaild event "); + LoggerD("vaild event "); it->second.event = event; } } @@ -263,7 +264,7 @@ void MessagingService::setEventToOpId(int opIdx, EventMessagingServicePtr & even int MessagingService::getOpTypeFromOpId(int opIdx) { - LogDebug("operation index : " << opIdx); + LoggerD("operation index : " << opIdx); int type = 0; @@ -273,7 +274,7 @@ int MessagingService::getOpTypeFromOpId(int opIdx) type = it->second.type; } - LogDebug("type " << type); + LoggerD("type " << type); return type; } @@ -284,7 +285,7 @@ int MessagingService::deleteOpId(int opIdx) if ( m_opRequests.end() != it) { m_opRequests.erase(it); //delete - LogDebug("delete Request : " << m_opRequests.size()); + LoggerD("delete Request : " << m_opRequests.size()); } return opIdx; } @@ -301,12 +302,12 @@ void MessagingService::cancelOperation(int opId, int handle, int eventType, IMes { if ( eventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_BODY ) { - LogDebug("Cancel Download Body , handle = " << handle); + LoggerD("Cancel Download Body , handle = " << handle); email->downloadBodyCancel(handle); } else if ( eventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_ATTACHMENT) { - LogDebug("Cancel Download Attachment , handle = " << handle); + LoggerD("Cancel Download Attachment , handle = " << handle); email->downloadAttachmentCancel(handle); } } diff --git a/src/Messaging/MessagingServiceManager.cpp b/src/Messaging/MessagingServiceManager.cpp index 12a418a..3d30a76 100644 --- a/src/Messaging/MessagingServiceManager.cpp +++ b/src/Messaging/MessagingServiceManager.cpp @@ -24,6 +24,7 @@ //for email service #include #include +#include using namespace std; using namespace DPL; @@ -35,12 +36,12 @@ MessagingServiceManager::MessagingServiceManager() : m_initialized(false), messaging_service_handler(-1) { - LogDebug("Enter"); + LoggerD("Enter"); } MessagingServiceManager::~MessagingServiceManager() { - LogDebug("Leave"); + LoggerD("Leave"); } std::vector MessagingServiceManager::getEmailAccounts() @@ -57,7 +58,7 @@ std::vector MessagingServiceManager::getEmailAccounts() std::stringstream stream; for (int i = 0; i < count; ++i) { stream << "[" << accounts[i].account_name << "] " << accounts[i].incoming_server_user_name; - LogDebug("account ID :" << accounts[i].account_id << "Name :" << accounts[i].incoming_server_user_name << "Addr :" << accounts[i].user_email_address ); + LoggerD("account ID :" << accounts[i].account_id << "Name :" << accounts[i].incoming_server_user_name << "Addr :" << accounts[i].user_email_address ); EmailAccountInfo account(accounts[i].account_id, stream.str(), accounts[i].user_email_address ); result.push_back(account); stream.str(""); @@ -79,9 +80,9 @@ std::vector MessagingServiceManager::getEmailAccounts() //public function. void MessagingServiceManager::getMessagingServiceManager(const EventGetMessagingServicePtr& event) { - LogDebug("<<<"); + LoggerD("<<<"); - LogDebug("event->getAccountID():" << event->getAccountID()); + LoggerD("event->getAccountID():" << event->getAccountID()); if (m_initialized == false) { initialize(); @@ -89,13 +90,13 @@ void MessagingServiceManager::getMessagingServiceManager(const EventGetMessaging EventRequestReceiver::PostRequest(event); - LogDebug(">>>"); + LoggerD(">>>"); } //get the request which posted from the standard layer void MessagingServiceManager::OnRequestReceived(const EventGetMessagingServicePtr& event) { - LogDebug("<<<"); + LoggerD("<<<"); try { @@ -103,7 +104,7 @@ void MessagingServiceManager::OnRequestReceived(const EventGetMessagingServicePt if (m_messagingServices.empty()) { //ToDo: The Message Service Code will be inserted here. - LogDebug("Message Service Type : " << event->getMessagingServiceType()); + LoggerD("Message Service Type : " << event->getMessagingServiceType()); if ( event->getMessagingServiceType() == SMS) { MessagingService* messagingService = new MessagingService(); @@ -126,19 +127,19 @@ void MessagingServiceManager::OnRequestReceived(const EventGetMessagingServicePt else if (event->getMessagingServiceType() == EMAIL) { std::vector EmailAccounts = getEmailAccounts(); - LogDebug("get Account list, size:" << EmailAccounts.size()); + LoggerD("get Account list, size:" << EmailAccounts.size()); int idx = 0; for ( idx = 0 ; idx < (int)EmailAccounts.size(); idx++) { - LogDebug("Account ID:" << EmailAccounts[idx].getIntId() ); + LoggerD("Account ID:" << EmailAccounts[idx].getIntId() ); MessagingService* messagingService = NULL; messagingService = new MessagingService(); messagingService->setMessagingServiceType(EMAIL); messagingService->setCurrentEmailAccount( EmailAccounts[idx] ); - LogDebug("Account ID:" << event->getAccountID()); + LoggerD("Account ID:" << event->getAccountID()); if ( event->getAccountID() >= 0 ) { if (event->getAccountID() == EmailAccounts[idx].getIntId()) @@ -161,17 +162,17 @@ void MessagingServiceManager::OnRequestReceived(const EventGetMessagingServicePt } catch (WrtDeviceApis::Commons::Exception &exc) { - LogError("Exception has occurred: " << std::hex << exc.getCode()); + LoggerE("Exception has occurred: " << std::hex << exc.getCode()); event->setExceptionCode(exc.getCode()); } - LogDebug(">>>"); + LoggerD(">>>"); } // create platform's resources. For examples, it could be camera handle, location handle and so on. void MessagingServiceManager::initialize() { - LogDebug("<<<"); + LoggerD("<<<"); if (!m_initialized) { // retVal = create_messaging_service(); @@ -181,13 +182,13 @@ void MessagingServiceManager::initialize() { m_initialized = true; } - LogDebug(">>>"); + LoggerD(">>>"); } #if 0 void MessagingServiceManager::getEmailAccountList( vector& accounts ) { - LogDebug("<<<"); + LoggerD("<<<"); email_account_t* email_accounts = NULL; int count = 0; @@ -204,15 +205,15 @@ void MessagingServiceManager::getEmailAccountList( vector& acc for (int i = 0; i < count; ++i) { //make email account info. - LogDebug("account id :" << email_accounts[i].account_id ); - LogDebug("account name :" << email_accounts[i].user_name ); - LogDebug("account addr :" << email_accounts[i].email_addr ); + LoggerD("account id :" << email_accounts[i].account_id ); + LoggerD("account name :" << email_accounts[i].user_name ); + LoggerD("account addr :" << email_accounts[i].email_addr ); EmailAccountInfo account(email_accounts[i].account_id, email_accounts[i].incoming_server_user_name, email_accounts[i].user_email_address); if (std::find(accounts.begin(), accounts.end(), account) == accounts.end()) { - LogDebug( "push " << email_accounts[i].account_id << "account" ); + LoggerD( "push " << email_accounts[i].account_id << "account" ); accounts.push_back(account); } } @@ -228,7 +229,7 @@ void MessagingServiceManager::getEmailAccountList( vector& acc throw; } - LogDebug(">>>"); + LoggerD(">>>"); } #endif diff --git a/src/Messaging/Mms.cpp b/src/Messaging/Mms.cpp index 7e62511..d1ca3c7 100644 --- a/src/Messaging/Mms.cpp +++ b/src/Messaging/Mms.cpp @@ -18,12 +18,12 @@ #include "Mms.h" #include -#include #include #include "ReqReceiverMessage.h" #include "Messaging.h" #include "CallbackMgr.h" #include "MsgServiceHandleMgr.h" +#include extern "C" { #include @@ -52,24 +52,24 @@ Mms::Mms(const string& id) : // m_bodyFilePath(string(tmpnam(NULL)) + TEXT_FILE_EXTENSION), m_messageData(NULL) { - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); char buf[] = "XXXXXX"; mode_t mask = umask(S_IWGRP | S_IWOTH); int i = mkstemp(buf); - LogDebug("buf : " << buf << " i : " << i); + LoggerD("buf : " << buf << " i : " << i); umask(mask); m_bodyFilePath = buf; m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION; - LogDebug("m_bodyFilePath : " << m_bodyFilePath); + LoggerD("m_bodyFilePath : " << m_bodyFilePath); if (getIdRef().empty()) { - LogDebug("create new message"); + LoggerD("create new message"); createNewMessage(); } else { - LogDebug("read existing message"); + LoggerD("read existing message"); readExistingMessage(); } } @@ -79,18 +79,18 @@ Mms::Mms(const string& id, const msg_struct_t msg_data) : // m_bodyFilePath(string(tmpnam(NULL)) + TEXT_FILE_EXTENSION), m_messageData(msg_data) { - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); char buf[] = "XXXXXX"; mode_t mask = umask(S_IWGRP | S_IWOTH); int i = mkstemp(buf); - LogDebug("buf : " << buf << " i : " << i); + LoggerD("buf : " << buf << " i : " << i); umask(mask); m_bodyFilePath = buf; m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION; - LogDebug("m_bodyFilePath : " << m_bodyFilePath); + LoggerD("m_bodyFilePath : " << m_bodyFilePath); readConversationId(m_messageData); readRecipientList(m_messageData); @@ -107,7 +107,7 @@ Mms::Mms(const string& id, const msg_struct_t msg_data) : Mms::~Mms() { - LogDebug("enter"); + LoggerD("enter"); if (m_messageData) { // release platform message structure @@ -118,7 +118,7 @@ Mms::~Mms() //remove tmp file //trying to remove file, return value is skipped if (!m_bodyFilePath.empty()) { - LogDebug("remove tmp file=" << m_bodyFilePath); + LoggerD("remove tmp file=" << m_bodyFilePath); (void) ::remove(m_bodyFilePath.c_str()); } } @@ -146,12 +146,12 @@ void Mms::createNewMessage() setMessageStatus(MESSAGE_STATUS_CREATED); msg_release_struct(&sendOpt); - LogDebug("Message created successfully, Id: " << getIdRef()); + LoggerD("Message created successfully, Id: " << getIdRef()); } void Mms::readExistingMessage() { - LogDebug("entered"); + LoggerD("entered"); if (getIdRef().empty() || (EMPTY_ID == getIdRef())) { @@ -170,10 +170,10 @@ void Mms::readExistingMessage() // trying to get message from platform if (MSG_SUCCESS != msg_get_message(MsgGetCommonHandle(), convertId(getIdRef()), m_messageData, sendOpt)) { - LogError("get message error"); + LoggerE("get message error"); Throw(WrtDeviceApis::Commons::PlatformException); } - LogDebug("message found with msgId=" << getIdRef()); + LoggerD("message found with msgId=" << getIdRef()); // read all mms dat to abstraction layer readConversationId(m_messageData); @@ -189,7 +189,7 @@ void Mms::readExistingMessage() msg_release_struct(&sendOpt); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("exception"); + LoggerE("exception"); // nothing to do msg_release_struct(&sendOpt); } @@ -202,11 +202,11 @@ void Mms::readDateTime(msg_struct_t& messageData) int tempInt = 0; msg_get_int_value(messageData, MSG_MESSAGE_DISPLAY_TIME_INT, &tempInt); - LogError("readDateTime : " <nCount; - LogDebug("Recipient count " << recipientCount); + int recipientCount = msg_list_length(addr_list); + LoggerD("Recipient count " << recipientCount); for (int i = 0; i < recipientCount; ++i) { // int type = msg_get_direction_info(messageData); msg_get_int_value(messageData, MSG_MESSAGE_DIRECTION_INT, &tempInt); int type = tempInt; - LogDebug("Direction: " << type); + LoggerD("Direction: " << type); if (MSG_DIRECTION_TYPE_MT == type) { - msg_struct_t addr_info = addr_list->msg_struct_info[i]; + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); memset(strNumber, 0x00, sizeof(MAX_ADDRESS_VAL_LEN)); msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); phoneNumber = strNumber; @@ -331,16 +333,16 @@ void Mms::readRecipientList(msg_struct_t& messageData) setSourceAddress(phoneNumber); setFrom(phoneNumber); } - LogDebug("MT number: " << phoneNumber); + LoggerD("MT number: " << phoneNumber); } else if (MSG_DIRECTION_TYPE_MO == type) { - msg_struct_t addr_info = addr_list->msg_struct_info[i]; + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); memset(strNumber, 0x00, sizeof(MAX_ADDRESS_VAL_LEN)); msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); msg_get_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt); - LogDebug("MO number: " << strNumber); - LogDebug("Type : " << tempInt); + LoggerD("MO number: " << strNumber); + LoggerD("Type : " << tempInt); switch (tempInt) { case MSG_RECIPIENTS_TYPE_TO: @@ -353,12 +355,12 @@ void Mms::readRecipientList(msg_struct_t& messageData) appendBccRecipients(strNumber); break; default: - LogError("Wrong type of recipient"); + LoggerE("Wrong type of recipient"); } } else { - LogError("Wrong type of recipient"); + LoggerE("Wrong type of recipient"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Wrong type of recipient"); } } @@ -369,7 +371,7 @@ void Mms::readSubject(msg_struct_t& messageData) char strTemp[MAX_SUBJECT_LEN] = {0}; msg_get_str_value(messageData, MSG_MESSAGE_SUBJECT_STR, strTemp, MAX_SUBJECT_LEN); // setSubject(msg_get_subject(messageData)); - LogError("readSubject : " << strTemp); + LoggerE("readSubject : " << strTemp); setSubject(strTemp); } @@ -393,7 +395,7 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) if (ret != MSG_SUCCESS) { - LogError("cannot get mms struct"); + LoggerE("cannot get mms struct"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "cannot get mms struct"); } @@ -409,15 +411,15 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) setMmsType(MULTIPART_MIXED); } - LogDebug("page count: " << pageLen); + LoggerD("page count: " << pageLen); for (int p = 0; p < pageLen; ++p) { - LogDebug("page " << p); + LoggerD("page " << p); page = (msg_struct_t)msg_list_nth_data(page_list, p); if (NULL == page) { - LogError("returned page is null, continue"); + LoggerE("returned page is null, continue"); continue; } @@ -426,11 +428,11 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) for (int m = 0; m < mediaLen; ++m) { - LogDebug("media file " << m); + LoggerD("media file " << m); media = (msg_struct_t)msg_list_nth_data(media_list, m); if (NULL == media) { - LogError("returned media is null, continue"); + LoggerE("returned media is null, continue"); continue; } @@ -442,13 +444,13 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) if ((0 == p) && (MMS_SMIL_MEDIA_TEXT == tempInt)) { //text value on first page goes to body attribute - LogDebug("setting body from " << szFilePath); + LoggerD("setting body from " << szFilePath); FILE* f = NULL; f = fopen(szFilePath, "r"); if (!f) { - LogError("cannot read file with body" << szFilePath); + LoggerE("cannot read file with body" << szFilePath); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Cannot read file with body"); } fseek(f, 0, SEEK_END); @@ -462,14 +464,14 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) setBody(data); delete[] data; } else { - LogError("body is not set"); + LoggerE("body is not set"); } - LogDebug("message body: '" << getBody() << "'"); + LoggerD("message body: '" << getBody() << "'"); fclose(f); } else { - LogDebug("adding attachment " << szFilePath); + LoggerD("adding attachment " << szFilePath); IAttachmentPtr attachment = appendAttachment(szFilePath, false); //attachment->setMessage(this); //set IMessagePtr @@ -478,14 +480,14 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) msg_get_str_value(media, MSG_MMS_MEDIA_FILENAME_STR, szFileName, sizeof(szFileName)); if ((szFileName[0] =! '\0' )&& (strnlen(szFileName, MSG_FILENAME_LEN_MAX) > 0)) { - LogDebug("renaming to " << szFileName); + LoggerD("renaming to " << szFileName); attachment->rename(szFileName); } else if (MMS_SMIL_MEDIA_TEXT == tempInt) { std::stringstream newName; newName << "body_page_" << p + 1 << ".txt"; - LogDebug("renaming to " << newName.str()); + LoggerD("renaming to " << newName.str()); attachment->rename(newName.str()); } } @@ -496,13 +498,13 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) attachLen= msg_list_length(attach_list); - LogDebug("attachment count: " << attachLen); + LoggerD("attachment count: " << attachLen); for (int a = 0; a < attachLen; ++a) { attach = (msg_struct_t)msg_list_nth_data(attach_list, a); if (NULL == attach) { - LogError("attachment is null, continue"); + LoggerE("attachment is null, continue"); continue; } @@ -515,7 +517,7 @@ void Mms::readBodyAndAttachments(msg_struct_t& messageData) IAttachmentPtr att = appendAttachment(szFilePath, false); if ((szFileName[0] =! '\0') && strnlen(szFileName, MSG_FILENAME_LEN_MAX) > 0) { - LogDebug("renaming to " << szFileName); + LoggerD("renaming to " << szFileName); att->rename(szFileName); } } @@ -533,11 +535,11 @@ bool Mms::hasAttachment() void Mms::update(bool draftsOnly) { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -557,7 +559,7 @@ void Mms::updatePriority() return; } int priority = -1; - LogInfo("MMS updating priority"); + LoggerI("MMS updating priority"); //set priority in platform switch (getPriority()) { @@ -571,15 +573,15 @@ void Mms::updatePriority() priority = MSG_MESSAGE_PRIORITY_HIGH; break; default: - LogError("Wrong priority"); + LoggerE("Wrong priority"); Throw(WrtDeviceApis::Commons::PlatformException); } - LogInfo("priority : " << priority); + LoggerI("priority : " << priority); if (MSG_SUCCESS != msg_set_int_value(m_messageData, MSG_MESSAGE_PRIORITY_INT, priority)){ - LogError("Error during setting priority"); + LoggerE("Error during setting priority"); Throw(WrtDeviceApis::Commons::PlatformException); } } @@ -593,31 +595,11 @@ void Mms::updateRecipientList() return; } - LogInfo("MMS updating platform recipients"); + LoggerI("MMS updating platform recipients"); - // reset addresses in platform structure -// msg_reset_address(m_messageData); - msg_struct_list_s *addr_list = NULL; - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); int nToCnt = 0; - nToCnt = addr_list->nCount; - - LogInfo("addr_list->nCount" << addr_list->nCount); - - if (nToCnt > 0) - { - for (int i = 0; i < nToCnt; i++) { - msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, (char *)"", 0); - msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_DISPLAYNAME_STR, (char *)"", 0); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_UNKNOWN); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_CONTACT_ID_INT, 0); - } - nToCnt = 0; - addr_list->nCount = nToCnt; - } - LogInfo("addr_list->nCount" << addr_list->nCount); + msg_list_clear(m_messageData, MSG_MESSAGE_ADDR_LIST_HND); vector to = getToRecipients().getRecipients(); vector cc = getCcRecipients().getRecipients(); @@ -626,112 +608,114 @@ void Mms::updateRecipientList() // update addresses in platform structure if (to.size()) { - LogInfo("updating to"); + LoggerI("updating to"); for (size_t i = 0; i < to.size(); i++) { + msg_struct_t tmpAddr; + if (i >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); + LoggerE("max number of recipient exceeded"); break; } - LogDebug("adding to[" << i << "]=" << to[i]); + LoggerD("adding to[" << i << "]=" << to[i]); + + msg_list_add_item(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); - if (msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, + if (msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO) != MSG_SUCCESS) { - LogError("problem with adding to address"); + LoggerE("problem with adding to address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address"); } - if(msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, + if(msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, const_cast(to[i].c_str()), to[i].size()) != MSG_SUCCESS) { - LogError("problem with adding to address"); + LoggerE("problem with adding to address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address"); } nToCnt ++; } - addr_list->nCount = nToCnt; - LogError("nToCnt : " << nToCnt); - LogError("addr_list->nCount: " <nCount); - + LoggerE("nToCnt : " << nToCnt); } - LogInfo("addr_list->nCount" << addr_list->nCount); if (cc.size()) { - LogInfo("updating cc"); + LoggerI("updating cc"); for (size_t i = 0; i < cc.size(); i++) { + msg_struct_t tmpAddr; + if (nToCnt >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); + LoggerE("max number of recipient exceeded"); break; } - LogDebug("adding cc[" << i << "]=" << cc[i]); + LoggerD("adding cc[" << i << "]=" << cc[i]); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + msg_list_add_item(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr); - if (msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, + msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + + if (msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_CC) != MSG_SUCCESS) { - LogError("problem with adding cc address"); + LoggerE("problem with adding cc address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding cc address"); } - if(msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, + if(msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, const_cast(cc[i].c_str()), cc[i].size()) != MSG_SUCCESS) { - LogError("problem with adding cc address"); + LoggerE("problem with adding cc address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding cc address"); } nToCnt ++; } - addr_list->nCount = nToCnt; - LogError("nToCnt : " << nToCnt); - LogError("addr_list->nCount: " <nCount); + LoggerE("nToCnt : " << nToCnt); } - LogInfo("addr_list->nCount" << addr_list->nCount); if (bcc.size()) { - LogInfo("updating bcc"); + LoggerI("updating bcc"); for (size_t i = 0; i < bcc.size(); i++) { + msg_struct_t tmpAddr; + if (nToCnt >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); + LoggerE("max number of recipient exceeded"); break; } - LogDebug("adding bcc[" << i << "]=" << bcc[i]); + LoggerD("adding bcc[" << i << "]=" << bcc[i]); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + msg_list_add_item(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr); - if (msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, + msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + + if (msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_BCC) != MSG_SUCCESS) { - LogError("problem with adding bcc address"); + LoggerE("problem with adding bcc address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding bcc address"); } - if(msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, + if(msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, const_cast(bcc[i].c_str()), bcc[i].size()) != MSG_SUCCESS) { - LogError("problem with adding bcc address"); + LoggerE("problem with adding bcc address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding bcc address"); } nToCnt ++; } - addr_list->nCount = nToCnt; - LogError("nToCnt : " << nToCnt); - LogError("addr_list->nCount: " <nCount); + LoggerE("nToCnt : " << nToCnt); } - LogInfo("addr_list->nCount" << addr_list->nCount); setToValidity(true); setCcValidity(true); setBccValidity(true); @@ -743,12 +727,12 @@ void Mms::updateSubject() if (isSubjectValid()) { return; } - LogInfo("updating platform subject: " << getSubjectRef()); + LoggerI("updating platform subject: " << getSubjectRef()); if (MSG_SUCCESS != // msg_set_subject(m_messageData, getSubjectRef().c_str())) { msg_set_str_value(m_messageData, MSG_MESSAGE_SUBJECT_STR, const_cast(getSubjectRef().c_str()), MAX_SUBJECT_LEN)) { - LogError("problem with setting subject"); + LoggerE("problem with setting subject"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with setting subject"); } setSubjectValidity(true); @@ -766,7 +750,7 @@ void Mms::updateBodyAndAttachments() // msg_struct_t old_mms_struct = NULL;// THIS // int ret;// THIS - LogInfo("updating platform body and attachment"); + LoggerI("updating platform body and attachment"); Try { @@ -776,7 +760,7 @@ void Mms::updateBodyAndAttachments() msg_struct_t smil_text[1]; if (getMessageType() != MMS) { - LogError("Wrong msg type"); + LoggerE("Wrong msg type"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Wrong msg type"); } // mmsData = msg_mms_create_message(); @@ -784,12 +768,12 @@ void Mms::updateBodyAndAttachments() // old_mms_struct = msg_create_struct(MSG_STRUCT_MMS);// THIS // ret = msg_get_mms_struct(m_messageData, old_mms_struct);// THIS -// LogError("ret " << ret);// THIS +// LoggerE("ret " << ret);// THIS // ret = msg_release_struct(&old_mms_struct);// THIS -// LogError("ret " << ret);// THIS +// LoggerE("ret " << ret);// THIS if (!mms_struct) { - LogError("create message body failed"); + LoggerE("create message body failed"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "create message body failed"); } @@ -798,16 +782,16 @@ void Mms::updateBodyAndAttachments() FILE* f = NULL; f = fopen(m_bodyFilePath.c_str(), "w"); if (!f) { - LogError("cannot create file with body" << m_bodyFilePath); + LoggerE("cannot create file with body" << m_bodyFilePath); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "cannot create file with body"); } - LogDebug("body file: " << m_bodyFilePath); + LoggerD("body file: " << m_bodyFilePath); fwrite(getBodyRef().c_str(), strlen(getBodyRef().c_str()), 1, f); fclose(f); - LogDebug("getBodyRef(): " << getBodyRef()); + LoggerD("getBodyRef(): " << getBodyRef()); msg_set_int_value(mms_struct, MSG_MMS_ROOTLAYOUT_WIDTH_INT, ROOT_LAYOUT_WIDTH); msg_set_int_value(mms_struct, MSG_MMS_ROOTLAYOUT_HEIGHT_INT, ROOT_LAYOUT_HEIGHT); @@ -815,7 +799,7 @@ void Mms::updateBodyAndAttachments() msg_set_bool_value(mms_struct, MSG_MMS_ROOTLAYOUT_WIDTH_PERCENT_BOOL, true); msg_set_bool_value(mms_struct, MSG_MMS_ROOTLAYOUT_HEIGHT_PERCENT_BOOL, true); - msg_mms_add_item(mms_struct, MSG_STRUCT_MMS_REGION, ®ion[0]); + msg_list_add_item(mms_struct, MSG_STRUCT_MMS_REGION, ®ion[0]); msg_set_str_value(region[0], MSG_MMS_REGION_ID_STR, const_cast(TEXT_AREA), 4); msg_set_int_value(region[0], MSG_MMS_REGION_LENGTH_LEFT_INT, 0); msg_set_int_value(region[0], MSG_MMS_REGION_LENGTH_TOP_INT, 0); @@ -828,20 +812,20 @@ void Mms::updateBodyAndAttachments() msg_set_bool_value(region[0], MSG_MMS_REGION_LENGTH_WIDTH_PERCENT_BOOL, true); msg_set_bool_value(region[0], MSG_MMS_REGION_LENGTH_HEIGHT_PERCENT_BOOL, true); - msg_mms_add_item(mms_struct, MSG_STRUCT_MMS_PAGE, &page[0]); + msg_list_add_item(mms_struct, MSG_STRUCT_MMS_PAGE, &page[0]); msg_set_int_value(page[0], MSG_MMS_PAGE_PAGE_DURATION_INT, 0); - msg_mms_add_item(page[0], MSG_STRUCT_MMS_MEDIA, &media[0]); + msg_list_add_item(page[0], MSG_STRUCT_MMS_MEDIA, &media[0]); msg_set_int_value(media[0], MSG_MMS_MEDIA_TYPE_INT, MMS_SMIL_MEDIA_TEXT); msg_set_str_value(media[0], MSG_MMS_MEDIA_REGION_ID_STR, const_cast(TEXT_AREA), 4); int error; error = msg_set_str_value(media[0], MSG_MMS_MEDIA_FILEPATH_STR, const_cast(m_bodyFilePath.c_str()),MSG_FILEPATH_LEN_MAX); - LogDebug("bodyFile Path= " << m_bodyFilePath); - LogDebug("error= " << error); + LoggerD("bodyFile Path= " << m_bodyFilePath); + LoggerD("error= " << error); char szFilePath[MSG_FILEPATH_LEN_MAX] = {0,}; memset(szFilePath, 0, sizeof(szFilePath)); msg_get_str_value(media[0], MSG_MMS_MEDIA_FILEPATH_STR, szFilePath, sizeof(szFilePath)); - LogDebug("bodyFile Path= " << m_bodyFilePath); + LoggerD("bodyFile Path= " << m_bodyFilePath); msg_get_struct_handle(media[0], MSG_MMS_MEDIA_SMIL_TEXT_HND, &smil_text[0]); msg_set_int_value(smil_text[0], MSG_MMS_SMIL_TEXT_COLOR_INT, BLACK_COLOR); @@ -862,23 +846,23 @@ void Mms::updateBodyAndAttachments() continue; } - LogDebug("Add attachment=" << att->getFullPath()); + LoggerD("Add attachment=" << att->getFullPath()); //checking file errnum = stat(att->getFullPath().c_str(), &buffer); - LogDebug("errnum=" << errnum); + LoggerD("errnum=" << errnum); if (errnum != 0) { - LogError("Opening file: " << att->getFullPath().c_str()); + LoggerE("Opening file: " << att->getFullPath().c_str()); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "cannot open attachment file"); } //this function should return valid pointer - msg_mms_add_item(mms_struct, MSG_STRUCT_MMS_ATTACH, &attachment[i]); + msg_list_add_item(mms_struct, MSG_STRUCT_MMS_ATTACH, &attachment[i]); msg_set_str_value(attachment[i], MSG_MMS_ATTACH_FILEPATH_STR, const_cast(att->getFullPath().c_str()), MSG_FILEPATH_LEN_MAX); - LogDebug("Attachment added"); + LoggerD("Attachment added"); //reset errno errnum = 0; @@ -886,7 +870,7 @@ void Mms::updateBodyAndAttachments() if (MSG_SUCCESS !=msg_set_mms_struct(m_messageData, mms_struct)) { - LogError("set message body error"); + LoggerE("set message body error"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "set message body error"); } @@ -897,7 +881,7 @@ void Mms::updateBodyAndAttachments() } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("Platform error"); + LoggerE("Platform error"); msg_release_struct(&mms_struct); throw; } @@ -910,10 +894,10 @@ void Mms::updateReadStatus() return; } - LogInfo("updating platform read status: " << isRead()); + LoggerI("updating platform read status: " << isRead()); // if (MSG_SUCCESS != msg_set_read_status(m_messageData, isRead())) { if (MSG_SUCCESS != msg_set_bool_value(m_messageData, MSG_MESSAGE_READ_BOOL, isRead())) { - LogError("problem with setting subject"); + LoggerE("problem with setting subject"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with setting subject"); } @@ -922,11 +906,11 @@ void Mms::updateReadStatus() void Mms::updateIsRead() { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -939,7 +923,7 @@ void Mms::updateIsRead() Try { if (this->getIdRef().empty()) { - LogError("existing msgId is zero, remove msg not done"); + LoggerE("existing msgId is zero, remove msg not done"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "existing msgId is zero, remove msg not done"); } @@ -947,12 +931,12 @@ void Mms::updateIsRead() if (MSG_SUCCESS != msg_update_read_status(MsgGetCommonHandle(), convertId(getIdRef()), isReadChangeStatus())) { - LogError("Failed to update isRead"); + LoggerE("Failed to update isRead"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update isRead"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error occurs"); + LoggerE("platform error occurs"); } setisReadChangeStatusValidity(true); @@ -960,14 +944,14 @@ void Mms::updateIsRead() void Mms::updateMessage() { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); msg_error_t err = MSG_SUCCESS; msg_struct_t msg = NULL; msg_struct_t sendOpt = NULL; if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -981,12 +965,12 @@ void Mms::updateMessage() if (err != MSG_SUCCESS) { - LogError("Get Message Failed!"); + LoggerE("Get Message Failed!"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message"); } if (this->getIdRef().empty()) { - LogError("existing msgId is zero, update msg not done"); + LoggerE("existing msgId is zero, update msg not done"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "existing msgId is zero, update msg not done"); } @@ -995,7 +979,7 @@ void Mms::updateMessage() if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt)) { - LogError("Failed to update message"); + LoggerE("Failed to update message"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message"); } msg_release_struct(&msg); @@ -1004,25 +988,25 @@ void Mms::updateMessage() Catch(WrtDeviceApis::Commons::PlatformException) { msg_release_struct(&msg); msg_release_struct(&sendOpt); - LogError("platform error occurs"); + LoggerE("platform error occurs"); } } void Mms::createSendMessage() { - LogDebug("convert m_id= " << convertId(getIdRef())); + LoggerD("convert m_id= " << convertId(getIdRef())); //prepare for add sms to draft folder if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } //update all sms data if (getCurrentFolder() == DRAFTBOX) { - LogDebug("update all mms data"); + LoggerD("update all mms data"); updateSubject(); updateBodyAndAttachments(); updateRecipientList(); @@ -1051,7 +1035,7 @@ void Mms::createSendMessage() setMessageStatus(MESSAGE_STATUS_DRAFT); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (m_messageData) { //releasing platform message structure // msg_release_message(&m_messageData); @@ -1064,14 +1048,14 @@ void Mms::createSendMessage() void Mms::addMessageToDraft() { - LogDebug("convert m_id= " << convertId(getIdRef())); + LoggerD("convert m_id= " << convertId(getIdRef())); msg_struct_t sendOpt = NULL; //prepare for add sms to draft folder if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1089,10 +1073,10 @@ void Mms::addMessageToDraft() sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); // trying to add message - LogDebug("add message"); + LoggerD("add message"); int ret = msg_add_message(MsgGetCommonHandle(), m_messageData, sendOpt); if (ret < MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << ret); + LoggerE("msg_add_message failed, error code=" << ret); Throw(WrtDeviceApis::Commons::PlatformException); } else @@ -1100,10 +1084,10 @@ void Mms::addMessageToDraft() msgId = ret; } - LogDebug("Message ID : " << msgId); + LoggerD("Message ID : " << msgId); if (msgId < 0) { - LogDebug("Message ID is invailded "); + LoggerD("Message ID is invailded "); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -1117,7 +1101,7 @@ void Mms::addMessageToDraft() } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("add draft message error"); + LoggerE("add draft message error"); msg_release_struct(&sendOpt); throw; } @@ -1146,7 +1130,7 @@ void Mms::moveToFolder(const FolderType newFolder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); throw; } */ @@ -1164,13 +1148,13 @@ void Mms::moveToFolder(const string& newFolder) if (msg_move_msg_to_folder(MsgGetCommonHandle(), convertId(getId()), platfromFolderId) != MSG_SUCCESS) { - LogError("msg_move_msg_to_folder error"); + LoggerE("msg_move_msg_to_folder error"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "msg_move_msg_to_folder error"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); throw; } */ @@ -1197,7 +1181,7 @@ void Mms::copyToFolder(const FolderType newFolder) int error = msg_add_message(MsgGetCommonHandle(), msg, &option); if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); + LoggerE("msg_add_message failed, error code=" << error); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "msg_add_message failed"); } } @@ -1207,7 +1191,7 @@ void Mms::copyToFolder(const FolderType newFolder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (msg) { msg_release_message(&msg); } @@ -1237,7 +1221,7 @@ void Mms::copyToFolder(const string& newFolder) int error = msg_add_message(MsgGetCommonHandle(), msg, &option); if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); + LoggerE("msg_add_message failed, error code=" << error); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "msg_add_message failed"); } } @@ -1247,7 +1231,7 @@ void Mms::copyToFolder(const string& newFolder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (msg) { msg_release_message(&msg); } @@ -1258,12 +1242,12 @@ void Mms::copyToFolder(const string& newFolder) void Mms::remove() { - LogDebug("delete m_id=" << getIdRef()); + LoggerD("delete m_id=" << getIdRef()); Try { if (this->getIdRef().empty()) { - LogError("existing msgId is zero, remove msg not done"); + LoggerE("existing msgId is zero, remove msg not done"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "existing msgId is zero, remove msg not done"); } @@ -1271,42 +1255,42 @@ void Mms::remove() if (MSG_SUCCESS != msg_delete_message(MsgGetCommonHandle(), convertId(getIdRef()))) { - LogError("Failed to delete Message"); + LoggerE("Failed to delete Message"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to delete Message"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error occurs"); + LoggerE("platform error occurs"); } } int Mms::send() { - LogDebug("sending message, id=" << getIdRef()); + LoggerD("sending message, id=" << getIdRef()); Try { //prepare for sending sms/mms update(); - LogDebug("Start Sending Message..."); + LoggerD("Start Sending Message..."); - LogDebug("trying to send mms"); + LoggerD("trying to send mms"); msg_error_t err = CallbackMgrSingleton::Instance().registerAndSend(msg_mms_send_message, m_messageData, this); if (err != MSG_SUCCESS) { - LogError("Sending Message (submit request) failed!!! err=" << err); + LoggerE("Sending Message (submit request) failed!!! err=" << err); setMessageStatus(MESSAGE_STATUS_FAILED); goto ERROR; } setMessageStatus(MESSAGE_STATUS_SENDING); - LogDebug("Sending Message request is submitted!"); + LoggerD("Sending Message request is submitted!"); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("message is not send, manually run callback"); + LoggerE("message is not send, manually run callback"); goto ERROR; } @@ -1315,7 +1299,7 @@ int Mms::send() ERROR: ReqReceiverMessage *requestReceiver = getRequestReceiver(); if (requestReceiver) { - LogError("send Error"); + LoggerE("send Error"); EventMessagingServicePtr event = getMessagingServiceEvent(); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventMessagingService>::ManualAnswer(event); @@ -1325,7 +1309,7 @@ int Mms::send() void Mms::sendingCallback(msg_struct_t sent_status) { -// LogInfo("sendingCallback callback received. Req id = " << +// LoggerI("sendingCallback callback received. Req id = " << // sent_status->reqId << " Status = " << (int)sent_status->status); // msg_struct_t request_data = NULL; // msg_get_struct_handle(sent_status, MSG_STRUCT_REQUEST_INFO, (void **)request_data); @@ -1333,14 +1317,14 @@ void Mms::sendingCallback(msg_struct_t sent_status) int status = MSG_NETWORK_SEND_FAIL; msg_get_int_value(sent_status, MSG_SENT_STATUS_NETWORK_STATUS_INT, &status); - LogDebug("status : " << status); + LoggerD("status : " << status); if (MSG_NETWORK_SEND_SUCCESS == status) { - LogDebug("sending ok"); + LoggerD("sending ok"); setSendingStatusOk(); setMessageStatus(MESSAGE_STATUS_SENT); } else { - LogError("sending failed: " << static_cast(status)); + LoggerE("sending failed: " << static_cast(status)); setSendingStatusFailed(); setMessageStatus(MESSAGE_STATUS_FAILED); } @@ -1348,31 +1332,34 @@ void Mms::sendingCallback(msg_struct_t sent_status) void Mms::sendCancel(int handle) { - LogDebug("sending message, id=" << getIdRef()); + LoggerD("sending message, id=" << getIdRef()); //#warning "TODO" - LogDebug("handle =" << handle); + LoggerD("handle =" << handle); } void Mms::setSendingStatusOk() { //success callback should be executed here ReqReceiverMessage *requestReceiver = getRequestReceiver(); - msg_struct_list_s *addr_list = NULL; + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; + char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; int nToCnt; if (requestReceiver) { - LogInfo("calling JS success callback"); + LoggerI("calling JS success callback"); EventMessagingServicePtr event = getMessagingServiceEvent(); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None); - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); - nToCnt = addr_list->nCount; + nToCnt = msg_list_length(addr_list); for ( int index=0; index < nToCnt; index++) { - msg_get_str_value(addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, index); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); event->m_successRecipients.push_back(strNumber); } @@ -1384,7 +1371,9 @@ void Mms::setSendingStatusFailed() { //error callback should be executed here EventOnSendingFailedEmitterPtr emitter = getEmitter(); - msg_struct_list_s *addr_list = NULL; + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; + char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; int nToCnt; @@ -1400,16 +1389,18 @@ void Mms::setSendingStatusFailed() EventMessagingServicePtr event = getMessagingServiceEvent(); if (requestReceiver) { - LogError("calling JS error callback"); + LoggerE("calling JS error callback"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); - nToCnt = addr_list->nCount; - LogDebug("nToCnt : " << nToCnt); + msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); + nToCnt = msg_list_length(addr_list); + + LoggerD("nToCnt : " << nToCnt); for ( int index=0; index < nToCnt; index++) { - msg_get_str_value(addr_list->msg_struct_info[index], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, index); + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); event->m_failRecipients.push_back(strNumber); } diff --git a/src/Messaging/MsgServiceHandleMgr.h b/src/Messaging/MsgServiceHandleMgr.h index 4ee1c2a..51b13bb 100644 --- a/src/Messaging/MsgServiceHandleMgr.h +++ b/src/Messaging/MsgServiceHandleMgr.h @@ -19,10 +19,10 @@ #define MSGSERVICEHANDLEMGR_H #include -#include #include #include #include +#include extern "C" { #include @@ -39,10 +39,10 @@ class MsgServiceHandleMgr public: MsgServiceHandleMgr() : m_msgHandle(NULL) { - LogInfo("enter"); + LoggerI("enter"); // open one handle per all messaging if (MSG_SUCCESS != msg_open_msg_handle(&m_msgHandle)) { - LogError("Unable to open handle"); + LoggerE("Unable to open handle"); Throw(WrtDeviceApis::Commons::PlatformException); } } @@ -50,7 +50,7 @@ class MsgServiceHandleMgr public: ~MsgServiceHandleMgr() { - LogInfo("enter"); + LoggerI("enter"); if (!!m_msgHandle) { msg_close_msg_handle(&m_msgHandle); } @@ -59,7 +59,7 @@ class MsgServiceHandleMgr msg_handle_t getHandle() const { if (!m_msgHandle) { - LogError("Messaging handle not initialized"); + LoggerE("Messaging handle not initialized"); Throw(WrtDeviceApis::Commons::PlatformException); } return m_msgHandle; diff --git a/src/Messaging/Recipient.cpp b/src/Messaging/Recipient.cpp old mode 100755 new mode 100644 index 408c2f6..a51e072 --- a/src/Messaging/Recipient.cpp +++ b/src/Messaging/Recipient.cpp @@ -17,9 +17,9 @@ #include #include -#include #include #include "Recipient.h" +#include using namespace std; using namespace WrtDeviceApis::Commons; @@ -184,7 +184,7 @@ Recipients & Recipients::operator -=(const Recipients& val) sort(l_toDelete.begin(), l_toDelete.end()); if (!includes(l_recipients.begin(), l_recipients.end(), l_toDelete.begin(), l_toDelete.end())) { - LogError("lack of recipient to delete from main variable"); + LoggerE("lack of recipient to delete from main variable"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } //delete recipients diff --git a/src/Messaging/ReqReceiverMessage.cpp b/src/Messaging/ReqReceiverMessage.cpp old mode 100755 new mode 100644 index 854587a..dcddea7 --- a/src/Messaging/ReqReceiverMessage.cpp +++ b/src/Messaging/ReqReceiverMessage.cpp @@ -29,6 +29,7 @@ #include #include #include +#include IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::ReqReceiverMessage) @@ -55,7 +56,7 @@ ReqReceiverMessage::ReqReceiverMessage() : EventQueryFoldersReqReceiver(ThreadEnum::MESSAGING_THREAD), EventMessagingServiceReqReceiver(ThreadEnum::MESSAGING_THREAD) { - LogDebug("create receiver for messaging"); + LoggerD("create receiver for messaging"); } ReqReceiverMessage::~ReqReceiverMessage() @@ -64,100 +65,100 @@ ReqReceiverMessage::~ReqReceiverMessage() void ReqReceiverMessage::addDraftMessage(const EventAddDraftMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventAddDraftMessageReqReceiver::PostRequest(event); } /* void ReqReceiverMessage::sendMessage(const EventSendMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventSendMessageReqReceiver::PostRequest(event); } */ void ReqReceiverMessage::sendMessage(const EventMessagingServicePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventMessagingServiceReqReceiver::PostRequest(event); } void ReqReceiverMessage::updateMessage(const EventUpdateMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventUpdateMessageReqReceiver::PostRequest(event); } /* void ReqReceiverMessage::deleteMessage(const EventDeleteMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventDeleteMessageReqReceiver::PostRequest(event); } */ void ReqReceiverMessage::deleteMessages(const EventDeleteMessagesPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventDeleteMessagesReqReceiver::PostRequest(event); } void ReqReceiverMessage::updateMessages(const EventUpdateMessagesPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventUpdateMessagesReqReceiver::PostRequest(event); } void ReqReceiverMessage::queryMessages(const EventQueryMessagesPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventQueryMessagesReqReceiver::PostRequest(event); } void ReqReceiverMessage::getConversationId(const EventGetConversationIdPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventGetConversationIdReqReceiver::PostRequest(event); } void ReqReceiverMessage::queryConversations(const EventQueryConversationsPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventQueryConversationsReqReceiver::PostRequest(event); } void ReqReceiverMessage::deleteConversations(const EventDeleteConversationsPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventDeleteConversationsReqReceiver::PostRequest(event); } void ReqReceiverMessage::queryFolders(const EventQueryFoldersPtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventQueryFoldersReqReceiver::PostRequest(event); } void ReqReceiverMessage::loadMessageBody(const EventMessagingServicePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventMessagingServiceReqReceiver::PostRequest(event); } void ReqReceiverMessage::loadMessageAttachment(const EventMessagingServicePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventMessagingServiceReqReceiver::PostRequest(event); } void ReqReceiverMessage::sync(const EventMessagingServicePtr& event) { - LogDebug("enter"); + LoggerD("enter"); EventMessagingServiceReqReceiver::PostRequest(event); } void ReqReceiverMessage::syncFolder(const EventMessagingServicePtr& event) { - LogDebug("enter"); + LoggerD("enter"); if (event && event->m_messagingService && event->m_messagingService->getAccountID() > 0) { @@ -170,11 +171,11 @@ void ReqReceiverMessage::syncFolder(const EventMessagingServicePtr& event) ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't get accounts"); } - LogDebug("accounts[0].incoming_server_type = " << accounts[0].incoming_server_type); - LogDebug("m_folder_name = " << event->m_folder_name); + LoggerD("accounts[0].incoming_server_type = " << accounts[0].incoming_server_type); + LoggerD("m_folder_name = " << event->m_folder_name); if ( accounts[0].incoming_server_type == EMAIL_SERVER_TYPE_POP3 && event->m_folder_name != "INBOX" ) { - LogDebug("Can't Sync Folder because POP3 spec."); + LoggerD("Can't Sync Folder because POP3 spec."); ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Operation Type is mismatched"); } } @@ -189,7 +190,7 @@ void ReqReceiverMessage::syncFolder(const EventMessagingServicePtr& event) bool ReqReceiverMessage::validateFilter(const DeviceAPI::Tizen::FilterPtr& filter){ - LogDebug("<<<"); + LoggerD("<<<"); bool retBool = false; @@ -199,32 +200,32 @@ bool ReqReceiverMessage::validateFilter(const DeviceAPI::Tizen::FilterPtr& filte FilterValidatorPtr filterValidator = DPL::StaticPointerCast(validator); retBool = filter->validate(filterValidator); - LogDebug("retBool:" << retBool); + LoggerD("retBool:" << retBool); if(retBool == false){ - MsgLogError(">>> Validate FAIL InvalidArgumentException"); + MsgLoggerE(">>> Validate FAIL InvalidArgumentException"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } }else{ - LogDebug("filter is NULL"); + LoggerD("filter is NULL"); retBool = false; } - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } void ReqReceiverMessage::OnRequestReceived(const EventAddDraftMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { IMessagePtr msg = event->msg; if(event->getType() != msg->getMessageType()) { - LogDebug("msg type and serviceType is not match"); - LogDebug("service type : "<< event->getType()); - LogDebug("msg type : "<< msg->getMessageType()); + LoggerD("msg type and serviceType is not match"); + LoggerD("service type : "<< event->getType()); + LoggerD("msg type : "<< msg->getMessageType()); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } if (!event->checkCancelled()) @@ -257,7 +258,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventAddDraftMessagePtr& event) if (accounts != NULL) { email_free_account(&accounts, count); } - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); Throw(WrtDeviceApis::Commons::PlatformException); } } @@ -269,18 +270,18 @@ void ReqReceiverMessage::OnRequestReceived(const EventAddDraftMessagePtr& event) } } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } Catch(WrtDeviceApis::Commons::InvalidArgumentException){ - MsgLogError("InvalidArgumentException"); + MsgLoggerE("InvalidArgumentException"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } } void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { IMessagePtr msg = event->msg; @@ -292,21 +293,21 @@ void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagePtr& event) } } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } /* void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagePtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { IMessagePtr msg = event->msg; msg->remove(); } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } @@ -315,7 +316,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagePtr& event) void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagesPtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { /* @@ -330,30 +331,30 @@ void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagesPtr& event) } */ std::vector msg = event->msgArray; - LogDebug("msg.size()" << msg.size()); + LoggerD("msg.size()" << msg.size()); int vecSize = msg.size(); for(int i=0; i < vecSize; i++){ int type = msg[i]->getMessageType(); std::string id = msg[i]->getId(); - MsgLogError("type :"<getBody()); + MsgLoggerE("type :"<getBody()); msg[i]->remove(); }//for }Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagesPtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { std::vector msg = event->msgArray; - LogDebug("msg.size()" << msg.size()); + LoggerD("msg.size()" << msg.size()); int vecSize = msg.size(); for(int i=0; i < vecSize; i++) { @@ -364,14 +365,14 @@ void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagesPtr& event) } } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } void ReqReceiverMessage::OnRequestReceived(const EventQueryMessagesPtr& event) { - LogDebug("<<<"); + LoggerD("<<<"); Try { @@ -382,12 +383,12 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryMessagesPtr& event) DeviceAPI::Tizen::FilterPtr filter = event->getFilter(); bool isValidFilter = validateFilter(filter); if(isValidFilter == false){ - MsgLogError("[ERROR]this filter is invalid"); + MsgLoggerE("[ERROR]this filter is invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } // using filter - LogDebug("event->getType() = " << event->getType()); + LoggerD("event->getType() = " << event->getType()); if(event->getType() > UNKNOWN) { tmp = IMessaging::getInstance().findMessages(event->getFilter(), event->getSortMode(), event->getLimit(), event->getOffset(), event->getType()); @@ -401,21 +402,21 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryMessagesPtr& event) event->msgs = msgs; }Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); }Catch(WrtDeviceApis::Commons::InvalidArgumentException){ - MsgLogError("InvalidArgumentException"); + MsgLoggerE("InvalidArgumentException"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } Catch (exception) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } void ReqReceiverMessage::OnRequestReceived(const EventGetConversationIdPtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { IMessagePtr msg = event->getConversationMsgPtr(); @@ -434,18 +435,18 @@ void ReqReceiverMessage::OnRequestReceived(const EventGetConversationIdPtr& even } int conversationId = IMessaging::getInstance().getConversationId(msgId, msgType); - LogDebug("Cond Id:" << conversationId); + LoggerD("Cond Id:" << conversationId); event->setConversationId(conversationId); } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } } void ReqReceiverMessage::OnRequestReceived(const EventQueryConversationsPtr& event) { - LogDebug("<<<"); + LoggerD("<<<"); Try { @@ -459,18 +460,18 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryConversationsPtr& eve FilterValidatorPtr filterValidator = DPL::StaticPointerCast(validator); bool isValidFilter = filter->validate(filterValidator); if(isValidFilter == false){ - MsgLogError("[ERROR]Filter is Invalid"); + MsgLoggerE("[ERROR]Filter is Invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } } - LogDebug("event->getType() = "<getType()); + LoggerD("event->getType() = "<getType()); if(event->getType() > UNKNOWN) { tmp = IMessaging::getInstance().queryConversations(event->getFilter(), event->getSortMode(), event->getType(), event->getLimit(), event->getOffset()); } else { -// LogDebug("enter"); +// LoggerD("enter"); // tmp = IMessaging::getInstance().queryConversations(event->getSortMode(), event->getFilter(), event->getLimit(), event->getOffset()); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } @@ -480,22 +481,22 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryConversationsPtr& eve } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - MsgLogError("InvalidArgumentException"); + MsgLoggerE("InvalidArgumentException"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } } void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event) { - LogDebug("enter : EventMessagingServicePtr"); + LoggerD("enter : EventMessagingServicePtr"); Try { - LogDebug("event type :" << event->getEventType() ); + LoggerD("event type :" << event->getEventType() ); int MessagingServiceEventType = event->getEventType(); if (MessagingServiceEventType == MESSAGING_SERVICE_EVENT_TYPE_LOAD_MESSAGE_BODY) @@ -509,13 +510,13 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event msg->setMessagingServiceEvent(event); int type = msg->getMessageType(); - LogDebug("message type :" << type); + LoggerD("message type :" << type); if ( msg->getMessageType() == EMAIL ) { IEmailPtr email = MessageFactory::convertToEmail(msg); event->switchToManualAnswer(); //switch to manual answer; int handle = email->downloadBody(); - LogDebug("Load Message Body handle : " << handle); + LoggerD("Load Message Body handle : " << handle); if (event->opId && event->m_messagingService) { event->m_messagingService->setHandleToOpId(event->opId, handle); @@ -527,14 +528,14 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } } else { - LogDebug(" invaild message. "); + LoggerD(" invaild message. "); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } } else { - LogDebug(" Cancel "); + LoggerD(" Cancel "); event->setCancelAllowed(true); } } @@ -549,13 +550,13 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event msg->setMessagingServiceEvent(event); int type = msg->getMessageType(); - LogDebug("message type :" << type); + LoggerD("message type :" << type); if ( msg->getMessageType() == EMAIL ) { IEmailPtr email = MessageFactory::convertToEmail(msg); event->switchToManualAnswer(); //switch to manual answer; int handle = email->downloadAttachment(event->m_attachment); - LogDebug("Load Message Attachment handle : " << handle); + LoggerD("Load Message Attachment handle : " << handle); if (event->opId && event->m_messagingService) { event->m_messagingService->setHandleToOpId(event->opId, handle); @@ -567,14 +568,14 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } else { - LogDebug(" invaild message. "); + LoggerD(" invaild message. "); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } } } else { - LogDebug(" cancel. "); + LoggerD(" cancel. "); event->setCancelAllowed(true); } @@ -586,7 +587,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event { if (!event->checkCancelled()) { int type = event->m_messagingService->getType(); - LogDebug("messaging service type :" << type); + LoggerD("messaging service type :" << type); event->m_messagingService->setRequestReceiver(this); event->m_messagingService->setMessagingServiceEvent(event); // @@ -594,12 +595,12 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event if (type == EMAIL) { event->switchToManualAnswer(); //switch to manual answer; - LogDebug("privateData->getAccountId() :" << event->m_messagingService->getAccountID()); + LoggerD("privateData->getAccountId() :" << event->m_messagingService->getAccountID()); if ( event->m_messagingService->getAccountID() > 0) { int handle = event->m_messagingService->sync( event->m_messagingService, event->m_sync_limit ); - LogDebug("Sync handle : " << handle); + LoggerD("Sync handle : " << handle); if (event->opId && event->m_messagingService) { event->m_messagingService->setHandleToOpId(event->opId, handle); @@ -620,7 +621,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } else { - LogDebug(" cancel. "); + LoggerD(" cancel. "); event->setCancelAllowed(true); } } @@ -632,19 +633,19 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event { if (!event->checkCancelled()) { int type = event->m_messagingService->getType(); - LogDebug("messaging service type :" << type); + LoggerD("messaging service type :" << type); event->m_messagingService->setRequestReceiver(this); event->m_messagingService->setMessagingServiceEvent(event); if (type == EMAIL) { event->switchToManualAnswer(); //switch to manual answer; - LogDebug("privateData->getAccountId() :" << event->m_messagingService->getAccountID()); + LoggerD("privateData->getAccountId() :" << event->m_messagingService->getAccountID()); if ( event->m_messagingService->getAccountID() > 0) { int handle = event->m_messagingService->syncFolder( event->m_messagingService, event->m_sync_folder_id, event->m_sync_limit); - LogDebug("Sync Folder handle : " << handle); + LoggerD("Sync Folder handle : " << handle); if (event->opId && event->m_messagingService) { event->m_messagingService->setHandleToOpId(event->opId, handle); @@ -664,7 +665,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } else { - LogDebug(" cancel. "); + LoggerD(" cancel. "); event->setCancelAllowed(true); } } @@ -687,13 +688,13 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } msg->createSendMessage(); - LogDebug("Message Status = " << msg->getMessageStatus()); - LogDebug("Message ID = " << msg->getId()); + LoggerD("Message Status = " << msg->getMessageStatus()); + LoggerD("Message ID = " << msg->getId()); } event->switchToManualAnswer(); int handle = msg->send(); - LogDebug("handle : " << handle); + LoggerD("handle : " << handle); if (event->opId && event->m_messagingService) { event->m_messagingService->setHandleToOpId(event->opId, handle); @@ -709,17 +710,17 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event } else { - LogDebug(" Cancel "); + LoggerD(" Cancel "); event->setCancelAllowed(true); } } Catch (WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } Catch (WrtDeviceApis::Commons::ConversionException) { - MsgLogError("conversion exception"); + MsgLoggerE("conversion exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::ConversionException); } @@ -727,13 +728,13 @@ void ReqReceiverMessage::OnRequestReceived(const EventMessagingServicePtr& event void ReqReceiverMessage::OnRequestReceived(const EventDeleteConversationsPtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try {/* if (event->isFilterUsing()) { - LogDebug("filter use"); + LoggerD("filter use"); //check filter validation FilterPtr filter = event->getFilter(); @@ -760,7 +761,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventDeleteConversationsPtr& ev } else*/ { - LogDebug("no filter"); + LoggerD("no filter"); if (IMessaging::getInstance().deleteConversations(event->getConversations()) == false) { @@ -770,19 +771,19 @@ void ReqReceiverMessage::OnRequestReceived(const EventDeleteConversationsPtr& ev } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - MsgLogError("InvalidArgumentException"); + MsgLoggerE("InvalidArgumentException"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } } void ReqReceiverMessage::OnRequestReceived(const EventQueryFoldersPtr& event) { - LogDebug("enter"); + LoggerD("enter"); Try { @@ -797,7 +798,7 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryFoldersPtr& event) bool isValidFilter = filter->validate(filterValidator); if(isValidFilter == false){ - MsgLogError("[ERROR]Filter is Invalid"); + MsgLoggerE("[ERROR]Filter is Invalid"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } @@ -808,12 +809,12 @@ void ReqReceiverMessage::OnRequestReceived(const EventQueryFoldersPtr& event) } Catch(WrtDeviceApis::Commons::PlatformException) { - MsgLogError("platform exception"); + MsgLoggerE("platform exception"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - MsgLogError("InvalidArgumentException"); + MsgLoggerE("InvalidArgumentException"); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException); } diff --git a/src/Messaging/ScopedMail.h b/src/Messaging/ScopedMail.h index 591a201..c8d2595 100644 --- a/src/Messaging/ScopedMail.h +++ b/src/Messaging/ScopedMail.h @@ -18,10 +18,10 @@ #ifndef TIZEN_MESSAGING_SCOPEDMAIL_H_ #define TIZEN_MESSAGING_SCOPEDMAIL_H_ -#include #include #include #include +#include namespace DeviceAPI { namespace Messaging { @@ -32,18 +32,18 @@ struct ScopedMailPolicy static Type NullValue() { - LogDebug("NullValue"); + LoggerD("NullValue"); return NULL; } static void Destroy(Type mail) { - LogDebug("Destroy"); + LoggerD("Destroy"); if (NullValue() != mail) { - LogDebug("email_free_mail_data"); + LoggerD("email_free_mail_data"); int error = email_free_mail_data(&mail, 1); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mail: " << error); + LoggerE("Failed to destroy mail: " << error); } } } diff --git a/src/Messaging/ScopedMailAttachment.h b/src/Messaging/ScopedMailAttachment.h index 22d5d86..622fbdd 100644 --- a/src/Messaging/ScopedMailAttachment.h +++ b/src/Messaging/ScopedMailAttachment.h @@ -18,10 +18,10 @@ #ifndef TIZEN_MESSAGING_SCOPEDMAILATTACHMENT_H_ #define TIZEN_MESSAGING_SCOPEDMAILATTACHMENT_H_ -#include #include #include #include +#include namespace DeviceAPI { namespace Messaging { @@ -32,18 +32,18 @@ struct ScopedMailAttachmentPolicy static Type NullValue() { - LogDebug("NullValue"); + LoggerD("NullValue"); return NULL; } static void Destroy(Type attachment) { - LogDebug("Destroy"); + LoggerD("Destroy"); if (NullValue() != attachment) { - LogDebug("email_free_attachment_info"); + LoggerD("email_free_attachment_info"); int error = email_free_attachment_info(&attachment); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mail Attachment: " << error); + LoggerE("Failed to destroy mail Attachment: " << error); } } } diff --git a/src/Messaging/ScopedMailbox.h b/src/Messaging/ScopedMailbox.h index 34b6527..58f883c 100644 --- a/src/Messaging/ScopedMailbox.h +++ b/src/Messaging/ScopedMailbox.h @@ -18,11 +18,11 @@ #ifndef TIZEN_MESSAGING_SCOPEDMAILBOX_H_ #define TIZEN_MESSAGING_SCOPEDMAILBOX_H_ -#include #include #include #include #include +#include namespace DeviceAPI { namespace Messaging { @@ -33,18 +33,18 @@ struct ScopedMailboxPolicy static Type NullValue() { - LogDebug("NullValue"); + LoggerD("NullValue"); return NULL; } static void Destroy(Type mailbox) { - LogDebug("Destroy"); + LoggerD("Destroy"); if (NullValue() != mailbox) { - LogDebug("email_free_mailbox"); + LoggerD("email_free_mailbox"); int error = email_free_mailbox(&mailbox, 1); if (EMAIL_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); + LoggerE("Failed to destroy mailbox: " << error); } } } diff --git a/src/Messaging/Sms.cpp b/src/Messaging/Sms.cpp index d71f8e1..fd817c4 100644 --- a/src/Messaging/Sms.cpp +++ b/src/Messaging/Sms.cpp @@ -16,12 +16,12 @@ // #include "Sms.h" -#include #include #include "ReqReceiverMessage.h" #include "Messaging.h" #include "CallbackMgr.h" #include "MsgServiceHandleMgr.h" +#include extern "C" { #include @@ -40,9 +40,9 @@ Sms::Sms(const string& id) : IMessage(SMS, id), m_messageData(NULL) { - LogDebug("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("enter"); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); if (getIdRef().empty()) { createNewMessage(); @@ -57,13 +57,13 @@ Sms::Sms(const std::string& id, const msg_struct_t msg_data) : IMessage(SMS, id), m_messageData(NULL) { - LogDebug("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); + LoggerD("enter"); + LoggerD("m_id=" << getIdRef()); + LoggerD("m_msgType=" << getMessageType()); - LogDebug("created msg_data : " << msg_data); + LoggerD("created msg_data : " << msg_data); m_messageData = createNewCopyOfPLatformMsgWithAddressList(msg_data); - LogDebug("created m_messageData : " << m_messageData); + LoggerD("created m_messageData : " << m_messageData); readConversationId(m_messageData); readRecipientList(m_messageData); @@ -79,22 +79,22 @@ Sms::Sms(const std::string& id, const msg_struct_t msg_data) : Sms::~Sms() { - LogDebug("enter"); + LoggerD("enter"); if (m_messageData) { // release platform message structure - LogDebug("release m_messageData : " << m_messageData); + LoggerD("release m_messageData : " << m_messageData); msg_release_struct(&m_messageData); } } void Sms::update(bool draftsOnly) { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -131,7 +131,7 @@ void Sms::moveToFolder(const FolderType newFolder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); throw; } */ @@ -167,7 +167,7 @@ void Sms::copyToFolder(const FolderType newFolder) // trying to add message int error = msg_add_message(MsgGetCommonHandle(), msg, &option); if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); + LoggerE("msg_add_message failed, error code=" << error); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -177,7 +177,7 @@ void Sms::copyToFolder(const FolderType newFolder) } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (msg) { //releasing platform message structure msg_release_message(&msg); @@ -195,7 +195,7 @@ void Sms::copyToFolder(const std::string& newFolder) int Sms::send() { - LogDebug("sending message, id=" << getIdRef()); + LoggerD("sending message, id=" << getIdRef()); Try{ if(m_messageData == NULL) { @@ -206,45 +206,47 @@ int Sms::send() } Catch(WrtDeviceApis::Commons::PlatformException) { - LogDebug("getHandle failed"); + LoggerD("getHandle failed"); Throw(WrtDeviceApis::Commons::PlatformException); } // split the message SendRequest req; - msg_struct_list_s *addr_list = NULL; - msg_struct_list_s *new_addr_list = NULL; + msg_list_handle_t addr_list = NULL; + msg_struct_t addr_info = NULL; + char strNumber[MAX_ADDRESS_VAL_LEN] = {0,}; int nToCnt; int tempInt; int tempIdInt; - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); msg_get_int_value(m_messageData, MSG_MESSAGE_ID_INT, &tempIdInt); - nToCnt = addr_list->nCount; - LogDebug("nToCnt : " << nToCnt); + nToCnt = msg_list_length(addr_list); + LoggerD("nToCnt : " << nToCnt); for (int i = 0; i < nToCnt; ++i) { + msg_struct_t tmpAddr; msg_struct_t new_msg = createNewCopyOfPLatformMsg(m_messageData); msg_set_int_value(new_msg, MSG_MESSAGE_ID_INT, tempIdInt); - msg_get_list_handle(new_msg, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&new_addr_list); - - msg_get_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt); - LogDebug("RECIPIENT_TYPE : " << tempInt); + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); + msg_get_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt); + LoggerD("RECIPIENT_TYPE : " << tempInt); if(MSG_RECIPIENTS_TYPE_TO != tempInt) { - LogDebug("skip"); + LoggerD("skip"); continue; } + msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + + msg_list_add_item(new_msg, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr); - msg_get_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); - msg_set_str_value(new_addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); - msg_set_int_value(new_addr_list->msg_struct_info[0], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO); - new_addr_list->nCount = 1; + msg_set_str_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); + msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO); setMessageStatus(MESSAGE_STATUS_SENDING); @@ -258,14 +260,14 @@ int Sms::send() // schedule sending PostEvent(0); - LogDebug("sending method finished"); + LoggerD("sending method finished"); return 0; //sms handle is -1; } void Sms::sendingCallback(msg_struct_t sent_status) { -// LogInfo( +// LoggerI( // "sendingCallback callback received. Req id = " << // sent_status->reqId << " Status = " << (int)sent_status->status << // ", Recipient=" << getRecipient()); @@ -294,7 +296,7 @@ void Sms::sendingCallback(msg_struct_t sent_status) void Sms::OnEventReceived(const int&) { - LogDebug("enter"); + LoggerD("enter"); // send another one sendSubMessage(); } @@ -315,7 +317,7 @@ FolderType Sms::toFolder(const std::string &folder) void Sms::sendSubMessage() { - LogDebug("enter"); + LoggerD("enter"); DPL::Mutex::ScopedLock lock(&m_mutex); @@ -329,9 +331,9 @@ void Sms::sendSubMessage() msg_sms_send_message, currentQueue().front(), this); - LogInfo("Sending Message (submit request) result:" << err); + LoggerI("Sending Message (submit request) result:" << err); if (err != MSG_SUCCESS) { - LogError("Sending Message (submit request) failed!!! err=" << err); + LoggerE("Sending Message (submit request) failed!!! err=" << err); msg_release_struct(¤tQueue().front()); currentQueue().pop(); m_sendRequests.front().failed = true; @@ -359,7 +361,7 @@ void Sms::sendSubMessage() void Sms::setSendingStatusOk(const string &recipient) { - LogDebug("enter, success number is : " << recipient); + LoggerD("enter, success number is : " << recipient); //success callback should be executed here ReqReceiverMessage *requestReceiver = getRequestReceiver(); if (requestReceiver) { @@ -367,10 +369,11 @@ void Sms::setSendingStatusOk(const string &recipient) event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None); event->m_successRecipients.push_back(recipient); - msg_struct_list_s *addr_list = NULL; - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); + msg_list_handle_t addr_list = NULL; - if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)addr_list->nCount) + msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); + + if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_list_length(addr_list)) { requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventMessagingService >::ManualAnswer(event); } @@ -379,7 +382,7 @@ void Sms::setSendingStatusOk(const string &recipient) EventSendMessagePtr event = getSendMessageEvent(); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::None); event->m_successRecipients.push_back(recipient); - //LogDebug("total address size : " << msg_get_address_count(m_messageData) << " Status size : " << event->m_successRecipients.size() + event->m_failRecipients.size()); + //LoggerD("total address size : " << msg_get_address_count(m_messageData) << " Status size : " << event->m_successRecipients.size() + event->m_failRecipients.size()); if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_get_address_count(m_messageData)) { requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventSendMessage >::ManualAnswer(event); @@ -391,7 +394,7 @@ void Sms::setSendingStatusOk(const string &recipient) void Sms::setSendingStatusFailed(const string &recipient) { - LogDebug("enter, fail number is : " << recipient); + LoggerD("enter, fail number is : " << recipient); //error callback should be executed here EventOnSendingFailedEmitterPtr emitter = getEmitter(); if (emitter) { @@ -401,14 +404,16 @@ void Sms::setSendingStatusFailed(const string &recipient) } else { ReqReceiverMessage *requestReceiver = getRequestReceiver(); if (requestReceiver) { - LogError("calling JS error callback"); + LoggerE("calling JS error callback"); EventMessagingServicePtr event = getMessagingServiceEvent(); event->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::UnknownException); event->m_successRecipients.push_back(recipient); - msg_struct_list_s *addr_list = NULL; - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); - if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)addr_list->nCount) + msg_list_handle_t addr_list = NULL; + + msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, (void **)&addr_list); + + if ( event->m_successRecipients.size() + event->m_failRecipients.size() == (unsigned int)msg_list_length(addr_list)) { requestReceiver->WrtDeviceApis::Commons::EventRequestReceiver< EventMessagingService >::ManualAnswer(event); } @@ -424,31 +429,31 @@ void Sms::remove() // delete message from platform if (msg_delete_message(MsgGetCommonHandle(), convertId(getId())) != MSG_SUCCESS) { - LogError("delete message failed"); + LoggerE("delete message failed"); Throw(WrtDeviceApis::Commons::PlatformException); } else { - LogDebug("message deleted succesfully"); + LoggerD("message deleted succesfully"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); throw; } } void Sms::createNewMessage() { - LogDebug("enter"); + LoggerD("enter"); if (m_messageData) { // release platform message if it was created previously msg_release_struct(&m_messageData); m_messageData = NULL; } // create new platform message - LogDebug("create messeage instance"); + LoggerD("create messeage instance"); m_messageData = msg_create_struct(MSG_STRUCT_MESSAGE_INFO); - LogDebug("created message : " << m_messageData); + LoggerD("created message : " << m_messageData); Try { @@ -463,12 +468,12 @@ void Sms::createNewMessage() msg_set_int_value(m_messageData, MSG_MESSAGE_DISPLAY_TIME_INT, (int)mktime(&dateT)); setMessageStatus(MESSAGE_STATUS_CREATED); - LogDebug("Message created successfully, msgId=" << getId()); + LoggerD("Message created successfully, msgId=" << getId()); } Catch(WrtDeviceApis::Commons::PlatformException) { msg_release_struct(&m_messageData); m_messageData = NULL; - LogError("Problem with message creation, cleaning"); + LoggerE("Problem with message creation, cleaning"); } } @@ -492,11 +497,11 @@ void Sms::readExistingMessage() sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT); msg_message_id_t l_id = convertId(getIdRef()); - LogDebug("reading message id=" << l_id); + LoggerD("reading message id=" << l_id); // trying to get message from platform if (MSG_SUCCESS == msg_get_message(MsgGetCommonHandle(), l_id, m_messageData, sendOpt)) { - LogDebug("message found with msgId=" << getIdRef()); + LoggerD("message found with msgId=" << getIdRef()); // read all mms dat to abstraction layer readConversationId(m_messageData); @@ -509,7 +514,7 @@ void Sms::readExistingMessage() readMessageStatus(m_messageData); } else { - LogError("message not found with msgId=" << getIdRef()); + LoggerE("message not found with msgId=" << getIdRef()); setId(""); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -517,7 +522,7 @@ void Sms::readExistingMessage() msg_release_struct(&sendOpt); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("exception"); + LoggerE("exception"); // nothing to do msg_release_struct(&sendOpt); } @@ -529,7 +534,7 @@ void Sms::updateBody() if (isBodyValid()) { return; } - LogInfo("updating platfoprm body"); + LoggerI("updating platfoprm body"); // change body value in platform structure if ( getBodyRef().length() > 0) @@ -537,7 +542,7 @@ void Sms::updateBody() if (msg_set_str_value(m_messageData, MSG_MESSAGE_SMS_DATA_STR, const_cast(getBodyRef().c_str()), getBodyRef().length()) != MSG_SUCCESS) { - LogError("problem with update Body"); + LoggerE("problem with update Body"); Throw(WrtDeviceApis::Commons::PlatformException); } // set flag as true - platform synchronized with abstraction @@ -553,33 +558,16 @@ void Sms::updateTo() return; } - LogInfo("SMS updating platform recipients"); - - msg_struct_list_s *addr_list = NULL; - msg_get_list_handle(m_messageData, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list); - int nToCnt = addr_list->nCount; + LoggerI("SMS updating platform recipients"); - LogInfo("nToCnt size " << nToCnt); - - if (nToCnt > 0) - { - for (int i = 0; i < nToCnt; i++) { - msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, (char *)"", 0); - msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_DISPLAYNAME_STR, (char *)"", 0); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_UNKNOWN); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_CONTACT_ID_INT, 0); - } - nToCnt = 0; - addr_list->nCount = nToCnt; - } + msg_list_clear(m_messageData, MSG_MESSAGE_ADDR_LIST_HND); vector to = getToRecipients().getRecipients(); // update addresses in platform structure if (to.size()) { - LogInfo("updating to"); + LoggerI("updating to"); for (size_t i = 0; i < to.size(); i++) { string tmpAddr = to[i]; @@ -587,33 +575,36 @@ void Sms::updateTo() { if (i >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); + LoggerE("max number of recipient exceeded"); break; } - LogDebug("adding to[" << i << "]=" << to[i]); + LoggerD("adding to[" << i << "]=" << to[i]); - msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + msg_struct_t newAddr = NULL; + msg_list_add_item(m_messageData, MSG_MESSAGE_ADDR_LIST_HND, &newAddr); - if (msg_set_int_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, + msg_set_int_value(newAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MSG_ADDRESS_TYPE_PLMN); + + if (msg_set_int_value(newAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO) != MSG_SUCCESS) { - LogError("problem with adding to address"); + LoggerE("problem with adding to address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address"); } - if(msg_set_str_value(addr_list->msg_struct_info[i], MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, + if(msg_set_str_value(newAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, const_cast(to[i].c_str()), to[i].size()) != MSG_SUCCESS) { - LogError("problem with adding to address"); + LoggerE("problem with adding to address"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with adding to address"); } - addr_list->nCount ++; - LogDebug("addr_list->nCount =" << addr_list->nCount); +// addr_list->nCount ++; +// LoggerD("addr_list->nCount =" << addr_list->nCount); } else { - LogError("wrong phone number format"); + LoggerE("wrong phone number format"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "wrong phone number format"); } } @@ -630,7 +621,7 @@ void Sms::updateFrom() // do not update if not changed return; } - LogInfo("updating platform from"); + LoggerI("updating platform from"); //TODO @@ -645,7 +636,7 @@ void Sms::updateSourceAddress() // do not update if not changed return; } - LogInfo("updating platform source address"); + LoggerI("updating platform source address"); //TODO @@ -655,13 +646,13 @@ void Sms::updateSourceAddress() void Sms::updateReadStatus() { - LogInfo("updating platform read status: " << isRead()); + LoggerI("updating platform read status: " << isRead()); if (isReadStatusValid()) { // do not update if not changed return; } if (MSG_SUCCESS != msg_set_bool_value(m_messageData, MSG_MESSAGE_READ_BOOL, isRead())) { - LogError("problem with setting subject"); + LoggerE("problem with setting subject"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Problem with setting subject"); } setReadStatusValidity(true); @@ -669,11 +660,11 @@ void Sms::updateReadStatus() void Sms::updateIsRead() { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -686,7 +677,7 @@ void Sms::updateIsRead() Try { if (this->getIdRef().empty()) { - LogError("existing msgId is zero, remove msg not done"); + LoggerE("existing msgId is zero, remove msg not done"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "existing msgId is zero, remove msg not done"); } @@ -694,12 +685,12 @@ void Sms::updateIsRead() if (MSG_SUCCESS != msg_update_read_status(MsgGetCommonHandle(), convertId(getIdRef()), isReadChangeStatus())) { - LogError("Failed to update isRead"); + LoggerE("Failed to update isRead"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update isRead"); } } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("platform error occurs"); + LoggerE("platform error occurs"); } setisReadChangeStatusValidity(true); @@ -707,7 +698,7 @@ void Sms::updateIsRead() void Sms::updateMessage() { - LogDebug("updating m_id=" << getIdRef()); + LoggerD("updating m_id=" << getIdRef()); msg_error_t err = MSG_SUCCESS; msg_struct_t msg = NULL; @@ -715,7 +706,7 @@ void Sms::updateMessage() if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -729,12 +720,12 @@ void Sms::updateMessage() if (err != MSG_SUCCESS) { - LogError("Get Message Failed!"); + LoggerE("Get Message Failed!"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message"); } if (this->getIdRef().empty()) { - LogError("existing msgId is zero, update msg not done"); + LoggerE("existing msgId is zero, update msg not done"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "existing msgId is zero, update msg not done"); } @@ -743,7 +734,7 @@ void Sms::updateMessage() if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt)) { - LogError("Failed to update message"); + LoggerE("Failed to update message"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message"); } msg_release_struct(&msg); @@ -752,24 +743,24 @@ void Sms::updateMessage() Catch(WrtDeviceApis::Commons::PlatformException) { msg_release_struct(&msg); msg_release_struct(&sendOpt); - LogError("platform error occurs"); + LoggerE("platform error occurs"); } } void Sms::createSendMessage() { - LogDebug("convert m_id= " << convertId(getIdRef())); + LoggerD("convert m_id= " << convertId(getIdRef())); //prepare for add sms to draft folder if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } //update all sms data if (getCurrentFolder() == DRAFTBOX) { - LogDebug("update all sms data"); + LoggerD("update all sms data"); updateBody(); updateFrom(); updateTo(); @@ -794,7 +785,7 @@ void Sms::createSendMessage() setMessageStatus(MESSAGE_STATUS_DRAFT); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (m_messageData) { //releasing platform message structure msg_release_struct(&m_messageData); @@ -809,19 +800,19 @@ void Sms::createSendMessage() void Sms::addMessageToDraft() { - LogDebug("convert m_id= " << convertId(getIdRef())); + LoggerD("convert m_id= " << convertId(getIdRef())); msg_struct_t sendOpt = NULL; //prepare for add sms to draft folder if (!m_messageData) { //error if platform message not exists - LogError("message can not be updated"); + LoggerE("message can not be updated"); Throw(WrtDeviceApis::Commons::PlatformException); } //update all sms data if (getCurrentFolder() == DRAFTBOX) { - LogDebug("update all sms data"); + LoggerD("update all sms data"); updateBody(); updateFrom(); updateTo(); @@ -846,7 +837,7 @@ void Sms::addMessageToDraft() // trying to add message int ret = msg_add_message(MsgGetCommonHandle(), m_messageData, sendOpt); if (ret < MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << ret); + LoggerE("msg_add_message failed, error code=" << ret); Throw(WrtDeviceApis::Commons::PlatformException); } else @@ -854,10 +845,10 @@ void Sms::addMessageToDraft() msgId = ret; } - LogDebug("Message ID : " << msgId); + LoggerD("Message ID : " << msgId); if (msgId < 0) { - LogDebug("Message ID is invailded "); + LoggerD("Message ID is invailded "); Throw(WrtDeviceApis::Commons::PlatformException); } @@ -866,7 +857,7 @@ void Sms::addMessageToDraft() setId(convertId(msgId)); setFolderType(DRAFTBOX); setMessageStatus(MESSAGE_STATUS_DRAFT); - LogDebug("Message Status " << getMessageStatus()); + LoggerD("Message Status " << getMessageStatus()); #if 0 if ( folder_list_view.nCount ) @@ -876,7 +867,7 @@ void Sms::addMessageToDraft() } Catch(WrtDeviceApis::Commons::PlatformException) { - LogError("remove message error"); + LoggerE("remove message error"); if (m_messageData) { //releasing platform message structure msg_release_struct(&m_messageData); @@ -892,7 +883,7 @@ void Sms::readConversationId(msg_struct_t& messageData) { int tempInt = 0; msg_get_int_value(messageData, MSG_MESSAGE_THREAD_ID_INT, &tempInt); - LogDebug("conversationID : " <nCount; - LogDebug("Recipient count " << recipientCount); + int recipientCount = msg_list_length(addr_list); + LoggerD("Recipient count " << recipientCount); for (int i = 0; i < recipientCount; ++i) @@ -919,7 +912,7 @@ void Sms::readRecipientList(msg_struct_t& messageData) if (MSG_DIRECTION_TYPE_MT == type) { - msg_struct_t addr_info = addr_list->msg_struct_info[i]; + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); phoneNumber = strNumber; @@ -928,18 +921,18 @@ void Sms::readRecipientList(msg_struct_t& messageData) setSourceAddress(phoneNumber); setFrom(phoneNumber); } - LogDebug("MT number: " << phoneNumber); + LoggerD("MT number: " << phoneNumber); } else if (MSG_DIRECTION_TYPE_MO == type) { - msg_struct_t addr_info = addr_list->msg_struct_info[i]; + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, strNumber, MAX_ADDRESS_VAL_LEN); - LogDebug("MO number: " << strNumber); + LoggerD("MO number: " << strNumber); appendToRecipients(strNumber); } else { - LogError("Wrong type of recipient"); + LoggerE("Wrong type of recipient"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Wrong type of recipient"); } } @@ -950,12 +943,12 @@ void Sms::readBody(msg_struct_t& messageData) //set abstraction body value int tempInt; msg_get_int_value(messageData, MSG_MESSAGE_DATA_SIZE_INT, &tempInt); - LogError("body Size : " <nCount = addr_list->nCount; + nCount = msg_list_length(addr_list); - for(int i=0; inCount; i++) + for(int i=0; imsg_struct_info[i]; + addr_info = (msg_struct_t)msg_list_nth_data(addr_list, i); msg_get_str_value(addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr_value, MAX_ADDRESS_VAL_LEN); msg_get_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, &tempInt); //copy original address - new_addr_info = new_addr_list->msg_struct_info[i]; + msg_list_add_item(msg, MSG_MESSAGE_ADDR_LIST_HND, &new_addr_info); msg_set_str_value(new_addr_info, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr_value, MAX_ADDRESS_VAL_LEN); msg_set_int_value(new_addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, tempInt); } diff --git a/src/Messaging/SourceAddress.cpp b/src/Messaging/SourceAddress.cpp old mode 100755 new mode 100644 index 1c6ac51..a0c748c --- a/src/Messaging/SourceAddress.cpp +++ b/src/Messaging/SourceAddress.cpp @@ -15,9 +15,9 @@ // limitations under the License. // -#include #include "Commons/Exception.h" #include "SourceAddress.h" +#include using namespace std; using namespace WrtDeviceApis::Commons; @@ -52,7 +52,7 @@ std::string SourceAddress::getSourceAddress() const void SourceAddress::setSourceAddress(const Recipients& value) { if (value.getRecipientSize() != 1) { - LogError("wrong source address value"); + LoggerE("wrong source address value"); Throw(WrtDeviceApis::Commons::InvalidArgumentException); } m_sourceAddress = value.getRecipient(0); diff --git a/src/Messaging/StorageChangesConversationFilterValidator.cpp b/src/Messaging/StorageChangesConversationFilterValidator.cpp old mode 100755 new mode 100644 index c70eda2..7e96b90 --- a/src/Messaging/StorageChangesConversationFilterValidator.cpp +++ b/src/Messaging/StorageChangesConversationFilterValidator.cpp @@ -17,8 +17,7 @@ #include "StorageChangesConversationFilterValidator.h" #include "StorageChangesConversationFilterValidatorFactory.h" - -#include +#include using namespace DeviceAPI::Tizen; @@ -41,7 +40,7 @@ namespace DeviceAPI { bool retVal = false; if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)!=0){ - LogError(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); + LoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); return false; } @@ -58,7 +57,7 @@ namespace DeviceAPI { bool retBool = false; retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue, depth); - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } diff --git a/src/Messaging/StorageChangesConversationGenerator.cpp b/src/Messaging/StorageChangesConversationGenerator.cpp old mode 100755 new mode 100644 index 3620e3f..bcfa3ae --- a/src/Messaging/StorageChangesConversationGenerator.cpp +++ b/src/Messaging/StorageChangesConversationGenerator.cpp @@ -18,13 +18,10 @@ #include "StorageChangesConversationGenerator.h" #include "StorageChangesConversationFilterValidatorFactory.h" #include "ConversationFilterValidatorFactory.h" - #include "IMessagingTypes.h" - #include - -#include #include +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -61,72 +58,72 @@ namespace Messaging { void StorageChangesConversationGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); m_operand.push_back(leftblank); - LogDebug("Left_blank"); - LogDebug(">>>"); + LoggerD("Left_blank"); + LoggerD(">>>"); } void StorageChangesConversationGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(type == UNION_FILTER ){ - LogDebug("UNION_FILTER"); + LoggerD("UNION_FILTER"); m_operand.push_back(operandUnion); }else if(type == INTERSECTION_FILTER){ - LogDebug("INTERSECTION_FILTER"); + LoggerD("INTERSECTION_FILTER"); m_operand.push_back(operandIntersection); }else{ - LogError("[ERROR] invalid Filter type:" << type); + LoggerE("[ERROR] invalid Filter type:" << type); } - LogDebug(">>>"); + LoggerD(">>>"); } void StorageChangesConversationGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); bool data1, data2; do { - LogDebug("m_result size =" << m_result.size()); + LoggerD("m_result size =" << m_result.size()); data1 = m_result.back(); m_result.pop_back(); data2 = m_result.back(); m_result.pop_back(); - LogDebug("m_result size =" << m_result.size()); - LogDebug("m_operand.back() =" << m_operand.back()); - LogDebug("m_operand size =" << m_operand.size()); + LoggerD("m_result size =" << m_result.size()); + LoggerD("m_operand.back() =" << m_operand.back()); + LoggerD("m_operand size =" << m_operand.size()); if(m_operand.back() == operandUnion) { - LogDebug("Union"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 || data2 = " << (data1 || data2)); + LoggerD("Union"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 || data2 = " << (data1 || data2)); m_operand.pop_back(); m_result.push_back(data1 || data2); - LogDebug("result" << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result" << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } else if(m_operand.back() == operandIntersection) { - LogDebug("Intersection"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 && data2 = " << (data1 && data2)); + LoggerD("Intersection"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 && data2 = " << (data1 && data2)); m_operand.pop_back(); m_result.push_back(data1 && data2); - LogDebug("result " << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result " << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } }while(m_operand.back() != leftblank); m_operand.pop_back(); - LogDebug("elase leftblank from m_operand"); - LogDebug("m_operand size =" << m_operand.size()); - LogDebug(">>>"); + LoggerD("elase leftblank from m_operand"); + LoggerD("m_operand size =" << m_operand.size()); + LoggerD(">>>"); } struct tm StorageChangesConversationGenerator::convertToTimeFormat(const std::string& timeString){ - LogDebug("<<< timeString:[" << timeString << "]"); + LoggerD("<<< timeString:[" << timeString << "]"); struct tm tm_Time; memset(&tm_Time, 0, sizeof(tm_Time)); @@ -136,31 +133,31 @@ namespace Messaging { int yearLength = 4; tm_Time.tm_year = atoi(timeString.substr(0, yearLength).c_str())-1900; nextStart = nextStart + yearLength; - LogDebug("<<< tm_Time.tm_year:[" << tm_Time.tm_year << "]"); + LoggerD("<<< tm_Time.tm_year:[" << tm_Time.tm_year << "]"); int monthLength = 2; tm_Time.tm_mon = atoi(timeString.substr(nextStart, monthLength).c_str()); nextStart = nextStart + monthLength; - LogDebug("<<< initTime.tm_mon:[" << tm_Time.tm_mon << "]"); + LoggerD("<<< initTime.tm_mon:[" << tm_Time.tm_mon << "]"); int dateLength = 2; tm_Time.tm_mday = atoi(timeString.substr(nextStart, dateLength).c_str()); nextStart = nextStart + dateLength; - LogDebug("<<< initTime.tm_mday:[" << tm_Time.tm_mday << "]"); + LoggerD("<<< initTime.tm_mday:[" << tm_Time.tm_mday << "]"); int hourLength = 2; tm_Time.tm_hour = atoi(timeString.substr(nextStart, hourLength).c_str()); nextStart = nextStart + hourLength; - LogDebug("<<< initTime.tm_hour:[" << tm_Time.tm_hour << "]"); + LoggerD("<<< initTime.tm_hour:[" << tm_Time.tm_hour << "]"); int minuteLength = 2; tm_Time.tm_min = atoi(timeString.substr(nextStart, minuteLength).c_str()); nextStart = nextStart + minuteLength; - LogDebug("<<< initTime.tm_min:[" << tm_Time.tm_min << "]"); + LoggerD("<<< initTime.tm_min:[" << tm_Time.tm_min << "]"); int secondLength = 2; tm_Time.tm_sec = atoi(timeString.substr(nextStart, secondLength).c_str()); - LogDebug("<<< initTime.tm_sec:[" << tm_Time.tm_sec << "]"); + LoggerD("<<< initTime.tm_sec:[" << tm_Time.tm_sec << "]"); return tm_Time; } @@ -169,17 +166,17 @@ namespace Messaging { bool StorageChangesConversationGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value) { std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); - LogDebug("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); + LoggerD("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); if(attrName.compare(valueString) == 0) { - LogDebug("<<< getMatchExactlyClause SAME >>>"); + LoggerD("<<< getMatchExactlyClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchExactlyClause DIFF >>>"); + LoggerD("<<< getMatchExactlyClause DIFF >>>"); return FALSE; } } @@ -190,8 +187,8 @@ namespace Messaging { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -199,16 +196,16 @@ namespace Messaging { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.compare(tempString2) == 0) { - LogDebug("<<< getMatchFullstringClause SAME >>>"); + LoggerD("<<< getMatchFullstringClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchFullstringClause DIFF >>>"); + LoggerD("<<< getMatchFullstringClause DIFF >>>"); return FALSE; } } @@ -219,8 +216,8 @@ namespace Messaging { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -228,14 +225,14 @@ namespace Messaging { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName.find(valueString) : " << tempString1.find(tempString2)); + LoggerD("<<< attrName.find(valueString) : " << tempString1.find(tempString2)); if(tempString1.find(tempString2) != std::string::npos) { - LogDebug("<<< getMatchContainsClause CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause CONTAINS >>>"); return TRUE; }else{ - LogDebug("<<< getMatchContainsClause NOT CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause NOT CONTAINS >>>"); return FALSE; } } @@ -246,8 +243,8 @@ namespace Messaging { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -260,11 +257,11 @@ namespace Messaging { if(tempString1.compare(0,tempString2.size(), tempString2) == 0) { - LogDebug("<<< getMatchStartwithClause START WITH >>>"); + LoggerD("<<< getMatchStartwithClause START WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchStartwithClause NOT START WITH >>>"); + LoggerD("<<< getMatchStartwithClause NOT START WITH >>>"); return FALSE; } } @@ -276,8 +273,8 @@ namespace Messaging { std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -285,7 +282,7 @@ namespace Messaging { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) : " << attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString)); + LoggerD("<<< attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) : " << attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString)); if(tempString1.size() < tempString2.size()) @@ -293,18 +290,18 @@ namespace Messaging { if(tempString1.compare(tempString1.size()-tempString2.size(),tempString2.size(), tempString2) == 0 ) { - LogDebug("<<< getMatchEndwithClause END WITH >>>"); + LoggerD("<<< getMatchEndwithClause END WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchEndwithClause NOT END WITH >>>"); + LoggerD("<<< getMatchEndwithClause NOT END WITH >>>"); return FALSE; } } bool StorageChangesConversationGenerator::getMatchExistClause(std::string& attrName) { - LogDebug("<<< attrName : " << attrName); + LoggerD("<<< attrName : " << attrName); if(attrName.size()> 0) return TRUE; else @@ -314,90 +311,90 @@ namespace Messaging { void StorageChangesConversationGenerator::visitAttribute(std::string& attrName, MatchFlag& matchFlag, AnyPtr& matchValue, int depth){ - LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); + LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); if(matchFlag != DeviceAPI::Tizen::MATCH_EXISTS){ if(matchValue == NULL) { return; } } - LogDebug("matchValue:" << matchValue->toString()); + LoggerD("matchValue:" << matchValue->toString()); visitAttributeEach(attrName, matchFlag, matchValue, depth); - LogDebug(">>>"); + LoggerD(">>>"); } void StorageChangesConversationGenerator::visitAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); std::string valueString; // Check msg_type and filter_type if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_id == nType) { m_result.push_back(TRUE); - LogDebug("<<< id is same"); + LoggerD("<<< id is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< id is different"); + LoggerD("<<< id is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_TYPE)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string convertType = value->toString(); int nType = convertMessageType(convertType); if((int)m_type == nType) { m_result.push_back(TRUE); - LogDebug("<<< type is same"); + LoggerD("<<< type is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< type is different"); + LoggerD("<<< type is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_MESSAGE_COUNT)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_messageCount == nType) { m_result.push_back(TRUE); - LogDebug("<<< messageCount is same"); + LoggerD("<<< messageCount is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< messageCount is different"); + LoggerD("<<< messageCount is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_UNREAD_MESSAGES)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_unreadMessages == nType) { m_result.push_back(TRUE); - LogDebug("<<< unreadMessages is same"); + LoggerD("<<< unreadMessages is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< unreadMessages is different"); + LoggerD("<<< unreadMessages is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_IS_READ)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string lowerString; lowerString.assign(value->toString()); StrLowChange(lowerString); @@ -406,90 +403,90 @@ namespace Messaging { if((int)m_read != nType) { m_result.push_back(TRUE); - LogDebug("<<< read is same"); + LoggerD("<<< read is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< read is different"); + LoggerD("<<< read is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_LAST_MESSAGE_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_lastMessageId == nType) { m_result.push_back(TRUE); - LogDebug("<<< lastMessageId is same"); + LoggerD("<<< lastMessageId is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< lastMessageId is different"); + LoggerD("<<< lastMessageId is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_PREVIEW)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_body:[" << m_preview << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_body:[" << m_preview << "]"); valueString = m_preview; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< preview is same"); + LoggerD("<<< preview is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< preview is different"); + LoggerD("<<< preview is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_FROM)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_from:[" << m_from << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_from:[" << m_from << "]"); valueString = m_from; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< from is same"); + LoggerD("<<< from is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< from is different"); + LoggerD("<<< from is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_SUBJECT)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_subject:[" << m_subject << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_subject:[" << m_subject << "]"); valueString = m_subject; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< subject is same"); + LoggerD("<<< subject is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< subject is different"); + LoggerD("<<< subject is different"); } return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_TO)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_to.size :[" << m_to.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_to.size :[" << m_to.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_to.size(); i++) @@ -497,15 +494,15 @@ namespace Messaging { valueString = m_to[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< to compare result is :" << result); + LoggerD("<<< to compare result is :" << result); m_result.push_back(result); return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_CC)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_cc.size :[" << m_cc.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_cc.size :[" << m_cc.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_cc.size(); i++) @@ -513,15 +510,15 @@ namespace Messaging { valueString = m_cc[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< cc compare result is : " << result); + LoggerD("<<< cc compare result is : " << result); m_result.push_back(result); return; } if(attrName.compare(StorageChangesConversationFilterValidatorFactory::ATTRIBUTE_BCC)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_cc.size :[" << m_bcc.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_cc.size :[" << m_bcc.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_bcc.size(); i++) @@ -529,16 +526,16 @@ namespace Messaging { valueString = m_bcc[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< bcc compare result is : " << result); + LoggerD("<<< bcc compare result is : " << result); m_result.push_back(result); return; } - LogDebug(">>>"); + LoggerD(">>>"); } int StorageChangesConversationGenerator::convertMessageType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -549,11 +546,11 @@ namespace Messaging { }else if(stringType.compare("messaging.email") ==0){ retMessageType = EMAIL; }else{ - LogError("invalid type:[" << stringType << "]"); + LoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } @@ -565,7 +562,7 @@ namespace Messaging { }else if(booleanString.compare("false") == 0){ retString = "0"; }else{ - LogError("invalid booleanString:[" << booleanString << "]"); + LoggerE("invalid booleanString:[" << booleanString << "]"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "invalid booleanString :[" + booleanString + "]"); } return retString; @@ -590,23 +587,23 @@ namespace Messaging { if (!initialValue->isNullOrUndefined()) { if( initialValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); startTime = *initialValue->getDateTm(); - LogDebug("<<getType()"); + LoggerE("initialValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid initialValue Type"); } } if (!endValue->isNullOrUndefined()) { if( endValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); endTime= *endValue->getDateTm(); - LogDebug("<<getType()"); + LoggerE("endValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid endValue Type"); } } @@ -620,20 +617,20 @@ namespace Messaging { // retValue = convertToTimeFormat(endValueStr); end_time = mktime(&endTime); - LogDebug("<<< mktime(initialValue):[" << init_time << "]"); - LogDebug("<<< mktime(m_dateTime):[" << mid_time << "]"); - LogDebug("<<< mktime(endValue):[" << end_time << "]"); - LogDebug("<<< mid_time - init_time:[" << mid_time - init_time << "]"); - LogDebug("<<< end_time - mid_time:[" << end_time - mid_time << "]"); + LoggerD("<<< mktime(initialValue):[" << init_time << "]"); + LoggerD("<<< mktime(m_dateTime):[" << mid_time << "]"); + LoggerD("<<< mktime(endValue):[" << end_time << "]"); + LoggerD("<<< mid_time - init_time:[" << mid_time - init_time << "]"); + LoggerD("<<< end_time - mid_time:[" << end_time - mid_time << "]"); if(((mid_time - init_time) >= 0 ) && ((end_time - mid_time) >= 0 )) { - LogDebug("<<< timestamp is in range"); + LoggerD("<<< timestamp is in range"); m_result.push_back(TRUE); } else { - LogDebug("<<< timestamp is out of range"); + LoggerD("<<< timestamp is out of range"); m_result.push_back(FALSE); } } @@ -644,25 +641,25 @@ namespace Messaging { std::vector::iterator iter; bool result = FALSE; if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){ - LogDebug("STRING_MATCH_EXACTLY"); + LoggerD("STRING_MATCH_EXACTLY"); result = result || getMatchExactlyClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_FULLSTRING){ - LogDebug("STRING_MATCH_FULLSTRING"); + LoggerD("STRING_MATCH_FULLSTRING"); result = result || getMatchFullstringClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){ - LogDebug("STRING_MATCH_CONTAINS"); + LoggerD("STRING_MATCH_CONTAINS"); result = result || getMatchContainsClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_STARTSWITH){ - LogDebug("STRING_MATCH_STARTSWITH"); + LoggerD("STRING_MATCH_STARTSWITH"); result = result || getMatchStartwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){ - LogDebug("STRING_MATCH_ENDSWITH"); + LoggerD("STRING_MATCH_ENDSWITH"); result = result || getMatchEndwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_EXISTS){ - LogDebug("STRING_MATCH_EXIST"); + LoggerD("STRING_MATCH_EXIST"); result = result || getMatchExistClause(valueString); }else{ - LogDebug("[ERROR]invalid match flag : iter:" << *iter); + LoggerD("[ERROR]invalid match flag : iter:" << *iter); } return result; } @@ -670,10 +667,10 @@ namespace Messaging { bool StorageChangesConversationGenerator::getCompareResult() { bool result; - LogDebug("m_result.size() " << m_result.size()); + LoggerD("m_result.size() " << m_result.size()); result = m_result.back(); m_result.pop_back(); - LogDebug("result = " << result); + LoggerD("result = " << result); return result; } diff --git a/src/Messaging/StorageChangesFolderFilterValidator.cpp b/src/Messaging/StorageChangesFolderFilterValidator.cpp old mode 100755 new mode 100644 index 9741abd..e9ce642 --- a/src/Messaging/StorageChangesFolderFilterValidator.cpp +++ b/src/Messaging/StorageChangesFolderFilterValidator.cpp @@ -17,8 +17,7 @@ #include "StorageChangesFolderFilterValidator.h" #include "StorageChangesFolderFilterValidatorFactory.h" - -#include +#include using namespace DeviceAPI::Tizen; @@ -34,7 +33,7 @@ namespace DeviceAPI { bool StorageChangesFolderFilterValidator::validateAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth){ bool retVal = false; - LogError(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); + LoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); return retVal; } @@ -47,7 +46,7 @@ namespace DeviceAPI { return false; retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue, depth); - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } diff --git a/src/Messaging/StorageChangesFolderGenerator.cpp b/src/Messaging/StorageChangesFolderGenerator.cpp old mode 100755 new mode 100644 index fc02480..6ce9ecd --- a/src/Messaging/StorageChangesFolderGenerator.cpp +++ b/src/Messaging/StorageChangesFolderGenerator.cpp @@ -17,12 +17,9 @@ #include "StorageChangesFolderGenerator.h" #include "StorageChangesFolderFilterValidatorFactory.h" - #include "IMessagingTypes.h" - #include - -#include +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -44,7 +41,7 @@ namespace DeviceAPI { m_type = (unsigned short)folder->getType(); m_synchronizable = folder->getSynchronizable(); - LogDebug("m_type:" << m_type ); + LoggerD("m_type:" << m_type ); } @@ -53,84 +50,84 @@ namespace DeviceAPI { void StorageChangesFolderGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); m_operand.push_back(leftblank); - LogDebug("Left_blank"); - LogDebug(">>>"); + LoggerD("Left_blank"); + LoggerD(">>>"); } void StorageChangesFolderGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(type == UNION_FILTER ){ - LogDebug("UNION_FILTER"); + LoggerD("UNION_FILTER"); m_operand.push_back(operandUnion); }else if(type == INTERSECTION_FILTER){ - LogDebug("INTERSECTION_FILTER"); + LoggerD("INTERSECTION_FILTER"); m_operand.push_back(operandIntersection); }else{ - LogError("[ERROR] invalid Filter type:" << type); + LoggerE("[ERROR] invalid Filter type:" << type); } - LogDebug(">>>"); + LoggerD(">>>"); } void StorageChangesFolderGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); bool data1, data2; do { - LogDebug("m_result size =" << m_result.size()); + LoggerD("m_result size =" << m_result.size()); data1 = m_result.back(); m_result.pop_back(); data2 = m_result.back(); m_result.pop_back(); - LogDebug("m_result size =" << m_result.size()); - LogDebug("m_operand.back() =" << m_operand.back()); - LogDebug("m_operand size =" << m_operand.size()); + LoggerD("m_result size =" << m_result.size()); + LoggerD("m_operand.back() =" << m_operand.back()); + LoggerD("m_operand size =" << m_operand.size()); if(m_operand.back() == operandUnion) { - LogDebug("Union"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 || data2 = " << (data1 || data2)); + LoggerD("Union"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 || data2 = " << (data1 || data2)); m_operand.pop_back(); m_result.push_back(data1 || data2); - LogDebug("result" << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result" << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } else if(m_operand.back() == operandIntersection) { - LogDebug("Intersection"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 && data2 = " << (data1 && data2)); + LoggerD("Intersection"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 && data2 = " << (data1 && data2)); m_operand.pop_back(); m_result.push_back(data1 && data2); - LogDebug("result " << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result " << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } }while(m_operand.back() != leftblank); m_operand.pop_back(); - LogDebug("elase leftblank from m_operand"); - LogDebug("m_operand size =" << m_operand.size()); - LogDebug(">>>"); + LoggerD("elase leftblank from m_operand"); + LoggerD("m_operand size =" << m_operand.size()); + LoggerD(">>>"); } bool StorageChangesFolderGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value) { std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); - LogDebug("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); + LoggerD("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); if(attrName.compare(valueString) == 0) { - LogDebug("<<< getMatchExactlyClause SAME >>>"); + LoggerD("<<< getMatchExactlyClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchExactlyClause DIFF >>>"); + LoggerD("<<< getMatchExactlyClause DIFF >>>"); return FALSE; } } @@ -141,8 +138,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -150,16 +147,16 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.compare(tempString2) == 0) { - LogDebug("<<< getMatchFullstringClause SAME >>>"); + LoggerD("<<< getMatchFullstringClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchFullstringClause DIFF >>>"); + LoggerD("<<< getMatchFullstringClause DIFF >>>"); return FALSE; } } @@ -170,8 +167,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -179,15 +176,15 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.find(tempString2) != std::string::npos) { - LogDebug("<<< getMatchContainsClause CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause CONTAINS >>>"); return TRUE; }else{ - LogDebug("<<< getMatchContainsClause NOT CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause NOT CONTAINS >>>"); return FALSE; } } @@ -198,8 +195,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -207,19 +204,19 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.size() < tempString2.size()) return FALSE; if(tempString1.compare(0,tempString2.size(), tempString2) == 0) { - LogDebug("<<< getMatchStartwithClause START WITH >>>"); + LoggerD("<<< getMatchStartwithClause START WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchStartwithClause NOT START WITH >>>"); + LoggerD("<<< getMatchStartwithClause NOT START WITH >>>"); return FALSE; } } @@ -230,8 +227,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -239,19 +236,19 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.size() < tempString2.size()) return FALSE; if(tempString1.compare(tempString1.size()-tempString2.size(),tempString2.size(), tempString2) == 0 ) { - LogDebug("<<< getMatchEndwithClause END WITH >>>"); + LoggerD("<<< getMatchEndwithClause END WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchEndwithClause NOT END WITH >>>"); + LoggerD("<<< getMatchEndwithClause NOT END WITH >>>"); return FALSE; } } @@ -259,7 +256,7 @@ namespace DeviceAPI { bool StorageChangesFolderGenerator::getMatchExistClause(std::string& attrName) { - LogDebug("<<< attrName : " << attrName); + LoggerD("<<< attrName : " << attrName); if(attrName.size()> 0) return TRUE; else @@ -268,7 +265,7 @@ namespace DeviceAPI { void StorageChangesFolderGenerator::visitAttribute(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth){ - LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); + LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); if(matchFlag != DeviceAPI::Tizen::MATCH_EXISTS){ if(matchValue == NULL) { @@ -276,65 +273,65 @@ namespace DeviceAPI { } } - LogDebug("matchValue:" << matchValue->toString()); + LoggerD("matchValue:" << matchValue->toString()); visitAttributeEach(attrName, matchFlag, matchValue, depth); } void StorageChangesFolderGenerator::visitAttributeEach(std::string& attrName, DeviceAPI::Tizen::MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); std::string valueString; // Check Folder_type and filter_type if(attrName.compare( StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_ACCOUNT_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_accountid == nType) { m_result.push_back(TRUE); - LogDebug("<<< accountid is same"); + LoggerD("<<< accountid is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< accountid is different"); + LoggerD("<<< accountid is different"); } return; } if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_CONTENT_TYPE)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string convertType = value->toString(); int nType = convertMessageType(convertType); if((int)m_contestType == nType) { m_result.push_back(TRUE); - LogDebug("<<< contestType is same"); + LoggerD("<<< contestType is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< contestType is different"); + LoggerD("<<< contestType is different"); } return; } if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_TYPE )==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string convertType = value->toString(); int nType = convertFolderType(convertType); if((int)m_type == nType) { m_result.push_back(TRUE); - LogDebug("<<< type is same"); + LoggerD("<<< type is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< type is different"); + LoggerD("<<< type is different"); } return; } if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_SYNCHRONIZABLE)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string lowerString; lowerString.assign(value->toString()); StrLowChange(lowerString); @@ -342,59 +339,59 @@ namespace DeviceAPI { if((int)m_synchronizable != nType) { m_result.push_back(TRUE); - LogDebug("<<< synchronizable is same"); + LoggerD("<<< synchronizable is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< synchronizable is different"); + LoggerD("<<< synchronizable is different"); } return; } if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_NAME)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_name:[" << m_name << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_name:[" << m_name << "]"); valueString = m_name; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< name is same"); + LoggerD("<<< name is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< name is different"); + LoggerD("<<< name is different"); } return; } if(attrName.compare(StorageChangesFolderFilterValidatorFactory::ATTRIBUTE_PATH)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_path:[" << m_path << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_path:[" << m_path << "]"); valueString = m_path; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< path is same"); + LoggerD("<<< path is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< path is different"); + LoggerD("<<< path is different"); } return; } - LogDebug(">>>"); + LoggerD(">>>"); } int StorageChangesFolderGenerator::convertMessageType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -405,16 +402,16 @@ namespace DeviceAPI { }else if(stringType.compare("messaging.email") ==0){ retMessageType = EMAIL; }else{ - LogError("invalid type:[" << stringType << "]"); + LoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } int StorageChangesFolderGenerator::convertFolderType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -427,18 +424,18 @@ namespace DeviceAPI { }else if(stringType.compare("SENTBOX") ==0){ retMessageType = SENTBOX; }else{ - LogError("invalid type:[" << stringType << "]"); + LoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } void StorageChangesFolderGenerator::visitAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth) { - LogDebug("<<< NOT SUPPROTED"); - LogDebug(">>>"); + LoggerD("<<< NOT SUPPROTED"); + LoggerD(">>>"); m_result.push_back(FALSE); } @@ -447,25 +444,25 @@ namespace DeviceAPI { std::vector::iterator iter; bool result = FALSE; if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){ - LogDebug("STRING_MATCH_EXACTLY"); + LoggerD("STRING_MATCH_EXACTLY"); result = result || getMatchExactlyClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_FULLSTRING){ - LogDebug("STRING_MATCH_FULLSTRING"); + LoggerD("STRING_MATCH_FULLSTRING"); result = result || getMatchFullstringClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){ - LogDebug("STRING_MATCH_CONTAINS"); + LoggerD("STRING_MATCH_CONTAINS"); result = result || getMatchContainsClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_STARTSWITH){ - LogDebug("STRING_MATCH_STARTSWITH"); + LoggerD("STRING_MATCH_STARTSWITH"); result = result || getMatchStartwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){ - LogDebug("STRING_MATCH_ENDSWITH"); + LoggerD("STRING_MATCH_ENDSWITH"); result = result || getMatchEndwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_EXISTS){ - LogDebug("STRING_MATCH_EXIST"); + LoggerD("STRING_MATCH_EXIST"); result = result || getMatchExistClause(valueString); }else{ - LogDebug("[ERROR]invalid match flag : iter:" << *iter); + LoggerD("[ERROR]invalid match flag : iter:" << *iter); } return result; } @@ -473,10 +470,10 @@ namespace DeviceAPI { bool StorageChangesFolderGenerator::getCompareResult() { bool result; - LogDebug("m_result.size() " << m_result.size()); + LoggerD("m_result.size() " << m_result.size()); result = m_result.back(); m_result.pop_back(); - LogDebug("result = " << result); + LoggerD("result = " << result); return result; } diff --git a/src/Messaging/StorageChangesMessageFilterValidator.cpp b/src/Messaging/StorageChangesMessageFilterValidator.cpp old mode 100755 new mode 100644 index 64c76d3..48d7c90 --- a/src/Messaging/StorageChangesMessageFilterValidator.cpp +++ b/src/Messaging/StorageChangesMessageFilterValidator.cpp @@ -17,8 +17,7 @@ #include "StorageChangesMessageFilterValidator.h" #include "StorageChangesMessageFilterValidatorFactory.h" - -#include +#include using namespace DeviceAPI::Tizen; @@ -35,7 +34,7 @@ namespace DeviceAPI { bool StorageChangesMessageFilterValidator::validateAttributeRange(std::string& attrName, DeviceAPI::Tizen::AnyPtr& initialValue, DeviceAPI::Tizen::AnyPtr& endValue, int depth){ bool retVal = false; if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_TIMESTAMP)!=0){ - LogError(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); + LoggerE(">>> [ERROR] Not Supported attribute :[" << attrName << "]"); return false; } @@ -52,7 +51,7 @@ namespace DeviceAPI { bool retBool = false; retBool = FilterValidator::validateAttribute(attrName, matchFlag, matchValue, depth); - LogDebug(">>> retBool:" << retBool); + LoggerD(">>> retBool:" << retBool); return retBool; } } diff --git a/src/Messaging/StorageChangesMessageGenerator.cpp b/src/Messaging/StorageChangesMessageGenerator.cpp old mode 100755 new mode 100644 index 18fba7a..90985f9 --- a/src/Messaging/StorageChangesMessageGenerator.cpp +++ b/src/Messaging/StorageChangesMessageGenerator.cpp @@ -23,8 +23,8 @@ #include -#include #include +#include using namespace std; using namespace DeviceAPI::Tizen; @@ -48,27 +48,27 @@ namespace DeviceAPI { if(m_type == SMS) { - LogDebug("size :" << Recipents->getRecipientSize()); + LoggerD("size :" << Recipents->getRecipientSize()); if(Recipents->getRecipientSize()>0) { m_to = Recipents->getRecipientsRef(); - LogDebug("m_to :" << m_to[0]); + LoggerD("m_to :" << m_to[0]); } } else if(m_type == MMS) { - LogDebug("to size :" << Recipents->getRecipientSize()); + LoggerD("to size :" << Recipents->getRecipientSize()); IMmsPtr mms = DPL::DynamicPointerCast(msg); if(Recipents->getRecipientSize() > 0) { m_to = Recipents->getRecipientsRef(); - LogDebug("m_to :" << m_to[0]); + LoggerD("m_to :" << m_to[0]); } Recipents = mms->getCcRecipientsPtr(); - LogDebug("cc size :" << Recipents->getRecipientSize()); + LoggerD("cc size :" << Recipents->getRecipientSize()); if(Recipents->getRecipientSize() > 0) { @@ -76,7 +76,7 @@ namespace DeviceAPI { } Recipents = mms->getBccRecipientsPtr(); - LogDebug("bcc size :" << Recipents->getRecipientSize()); + LoggerD("bcc size :" << Recipents->getRecipientSize()); if(Recipents->getRecipientSize() > 0) { @@ -88,17 +88,17 @@ namespace DeviceAPI { } else if(m_type == EMAIL) { - LogDebug("to size :" << Recipents->getRecipientSize()); + LoggerD("to size :" << Recipents->getRecipientSize()); IEmailPtr email = DPL::DynamicPointerCast(msg); if(Recipents->getRecipientSize() > 0) { m_to = Recipents->getRecipientsRef(); - LogDebug("m_to :" << m_to[0]); + LoggerD("m_to :" << m_to[0]); } Recipents = email->getCcRecipientsPtr(); - LogDebug("cc size :" << Recipents->getRecipientSize()); + LoggerD("cc size :" << Recipents->getRecipientSize()); if(Recipents->getRecipientSize() > 0) { @@ -106,7 +106,7 @@ namespace DeviceAPI { } Recipents = email->getBccRecipientsPtr(); - LogDebug("bcc size :" << Recipents->getRecipientSize()); + LoggerD("bcc size :" << Recipents->getRecipientSize()); if(Recipents->getRecipientSize() > 0) { @@ -136,19 +136,19 @@ namespace DeviceAPI { m_messageStatus = msg->getMessageStatus(); - LogDebug("m_type:" << m_type ); - LogDebug("m_folder:" << m_folder ); - LogDebug("m_dateTime year:" << m_dateTime.tm_year + 1900 ); - LogDebug("m_dateTime mon:" << m_dateTime.tm_mon ); - LogDebug("m_dateTime day:" << m_dateTime.tm_mday ); - LogDebug("m_dateTime hour:" << m_dateTime.tm_hour ); - LogDebug("m_dateTime min:" << m_dateTime.tm_min ); - LogDebug("m_dateTime sec:" << m_dateTime.tm_sec ); - LogDebug("m_from:" << m_from ); - LogDebug("m_body:" << m_body ); - LogDebug("m_isRead:" << m_isRead ); - LogDebug("m_priority:" << m_priority ); - LogDebug("m_subject:" << m_subject ); + LoggerD("m_type:" << m_type ); + LoggerD("m_folder:" << m_folder ); + LoggerD("m_dateTime year:" << m_dateTime.tm_year + 1900 ); + LoggerD("m_dateTime mon:" << m_dateTime.tm_mon ); + LoggerD("m_dateTime day:" << m_dateTime.tm_mday ); + LoggerD("m_dateTime hour:" << m_dateTime.tm_hour ); + LoggerD("m_dateTime min:" << m_dateTime.tm_min ); + LoggerD("m_dateTime sec:" << m_dateTime.tm_sec ); + LoggerD("m_from:" << m_from ); + LoggerD("m_body:" << m_body ); + LoggerD("m_isRead:" << m_isRead ); + LoggerD("m_priority:" << m_priority ); + LoggerD("m_subject:" << m_subject ); } @@ -156,72 +156,72 @@ namespace DeviceAPI { } void StorageChangesMessageGenerator::visitPreComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); m_operand.push_back(leftblank); - LogDebug("Left_blank"); - LogDebug(">>>"); + LoggerD("Left_blank"); + LoggerD(">>>"); } void StorageChangesMessageGenerator::visitInComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); if(type == UNION_FILTER ){ - LogDebug("UNION_FILTER"); + LoggerD("UNION_FILTER"); m_operand.push_back(operandUnion); }else if(type == INTERSECTION_FILTER){ - LogDebug("INTERSECTION_FILTER"); + LoggerD("INTERSECTION_FILTER"); m_operand.push_back(operandIntersection); }else{ - LogError("[ERROR] invalid Filter type:" << type); + LoggerE("[ERROR] invalid Filter type:" << type); } - LogDebug(">>>"); + LoggerD(">>>"); } void StorageChangesMessageGenerator::visitPostComposite(DeviceAPI::Tizen::FilterType& type, int depth){ - LogDebug("<<<"); + LoggerD("<<<"); bool data1, data2; do { - LogDebug("m_result size =" << m_result.size()); + LoggerD("m_result size =" << m_result.size()); data1 = m_result.back(); m_result.pop_back(); data2 = m_result.back(); m_result.pop_back(); - LogDebug("m_result size =" << m_result.size()); - LogDebug("m_operand.back() =" << m_operand.back()); - LogDebug("m_operand size =" << m_operand.size()); + LoggerD("m_result size =" << m_result.size()); + LoggerD("m_operand.back() =" << m_operand.back()); + LoggerD("m_operand size =" << m_operand.size()); if(m_operand.back() == operandUnion) { - LogDebug("Union"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 || data2 = " << (data1 || data2)); + LoggerD("Union"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 || data2 = " << (data1 || data2)); m_operand.pop_back(); m_result.push_back(data1 || data2); - LogDebug("result" << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result" << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } else if(m_operand.back() == operandIntersection) { - LogDebug("Intersection"); - LogDebug("data1 = " << data1); - LogDebug("data2 = " << data2); - LogDebug("data1 && data2 = " << (data1 && data2)); + LoggerD("Intersection"); + LoggerD("data1 = " << data1); + LoggerD("data2 = " << data2); + LoggerD("data1 && data2 = " << (data1 && data2)); m_operand.pop_back(); m_result.push_back(data1 && data2); - LogDebug("result" << m_result.back()); - LogDebug("m_result size =" << m_result.size()); + LoggerD("result" << m_result.back()); + LoggerD("m_result size =" << m_result.size()); } }while(m_operand.back() != leftblank); m_operand.pop_back(); - LogDebug("elase leftblank from m_operand"); - LogDebug("m_operand size =" << m_operand.size()); - LogDebug(">>>"); + LoggerD("elase leftblank from m_operand"); + LoggerD("m_operand size =" << m_operand.size()); + LoggerD(">>>"); } struct tm StorageChangesMessageGenerator::convertToTimeFormat(const std::string& timeString){ - LogDebug("<<< timeString:[" << timeString << "]"); + LoggerD("<<< timeString:[" << timeString << "]"); struct tm tm_Time; memset(&tm_Time, 0, sizeof(tm_Time)); @@ -231,31 +231,31 @@ namespace DeviceAPI { int yearLength = 4; tm_Time.tm_year = atoi(timeString.substr(0, yearLength).c_str())-1900; nextStart = nextStart + yearLength; - LogDebug("<<< tm_Time.tm_year:[" << tm_Time.tm_year << "]"); + LoggerD("<<< tm_Time.tm_year:[" << tm_Time.tm_year << "]"); int monthLength = 2; tm_Time.tm_mon = atoi(timeString.substr(nextStart, monthLength).c_str()); nextStart = nextStart + monthLength; - LogDebug("<<< initTime.tm_mon:[" << tm_Time.tm_mon << "]"); + LoggerD("<<< initTime.tm_mon:[" << tm_Time.tm_mon << "]"); int dateLength = 2; tm_Time.tm_mday = atoi(timeString.substr(nextStart, dateLength).c_str()); nextStart = nextStart + dateLength; - LogDebug("<<< initTime.tm_mday:[" << tm_Time.tm_mday << "]"); + LoggerD("<<< initTime.tm_mday:[" << tm_Time.tm_mday << "]"); int hourLength = 2; tm_Time.tm_hour = atoi(timeString.substr(nextStart, hourLength).c_str()); nextStart = nextStart + hourLength; - LogDebug("<<< initTime.tm_hour:[" << tm_Time.tm_hour << "]"); + LoggerD("<<< initTime.tm_hour:[" << tm_Time.tm_hour << "]"); int minuteLength = 2; tm_Time.tm_min = atoi(timeString.substr(nextStart, minuteLength).c_str()); nextStart = nextStart + minuteLength; - LogDebug("<<< initTime.tm_min:[" << tm_Time.tm_min << "]"); + LoggerD("<<< initTime.tm_min:[" << tm_Time.tm_min << "]"); int secondLength = 2; tm_Time.tm_sec = atoi(timeString.substr(nextStart, secondLength).c_str()); - LogDebug("<<< initTime.tm_sec:[" << tm_Time.tm_sec << "]"); + LoggerD("<<< initTime.tm_sec:[" << tm_Time.tm_sec << "]"); return tm_Time; } @@ -263,17 +263,17 @@ namespace DeviceAPI { bool StorageChangesMessageGenerator::getMatchExactlyClause(std::string& attrName, DeviceAPI::Tizen::AnyPtr& value) { std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); - LogDebug("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); + LoggerD("<<< attrName.compare(valueString) : " << attrName.compare(valueString)); if(attrName.compare(valueString) == 0) { - LogDebug("<<< getMatchExactlyClause SAME >>>"); + LoggerD("<<< getMatchExactlyClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchExactlyClause DIFF >>>"); + LoggerD("<<< getMatchExactlyClause DIFF >>>"); return FALSE; } } @@ -284,8 +284,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -293,16 +293,16 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.compare(tempString2) == 0) { - LogDebug("<<< getMatchFullstringClause SAME >>>"); + LoggerD("<<< getMatchFullstringClause SAME >>>"); return TRUE; } else{ - LogDebug("<<< getMatchFullstringClause DIFF >>>"); + LoggerD("<<< getMatchFullstringClause DIFF >>>"); return FALSE; } } @@ -314,8 +314,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -323,15 +323,15 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.find(tempString2) != std::string::npos) { - LogDebug("<<< getMatchContainsClause CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause CONTAINS >>>"); return TRUE; }else{ - LogDebug("<<< getMatchContainsClause NOT CONTAINS >>>"); + LoggerD("<<< getMatchContainsClause NOT CONTAINS >>>"); return FALSE; } } @@ -342,8 +342,8 @@ namespace DeviceAPI { std::string tempString2; std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -351,8 +351,8 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName : " << tempString1); - LogDebug("<<< valueString : " << tempString2); + LoggerD("<<< attrName : " << tempString1); + LoggerD("<<< valueString : " << tempString2); if(tempString1.size() < tempString2.size()) @@ -360,11 +360,11 @@ namespace DeviceAPI { if(tempString1.compare(0,tempString2.size(), tempString2) == 0) { - LogDebug("<<< getMatchStartwithClause START WITH >>>"); + LoggerD("<<< getMatchStartwithClause START WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchStartwithClause NOT START WITH >>>"); + LoggerD("<<< getMatchStartwithClause NOT START WITH >>>"); return FALSE; } } @@ -376,8 +376,8 @@ namespace DeviceAPI { std::string valueString = value->toString(); - LogDebug("<<< attrName : " << attrName); - LogDebug("<<< valueString : " << valueString); + LoggerD("<<< attrName : " << attrName); + LoggerD("<<< valueString : " << valueString); tempString1.assign(attrName); tempString2.assign(valueString); @@ -385,7 +385,7 @@ namespace DeviceAPI { StrLowChange(tempString1); StrLowChange(tempString2); - LogDebug("<<< attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) : " << attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString)); + LoggerD("<<< attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString) : " << attrName.compare(attrName.size()-valueString.size(),valueString.size(), valueString)); if(tempString1.size() < tempString2.size()) @@ -393,11 +393,11 @@ namespace DeviceAPI { if(tempString1.compare(tempString1.size()-tempString2.size(),tempString2.size(), tempString2) == 0 ) { - LogDebug("<<< getMatchEndwithClause END WITH >>>"); + LoggerD("<<< getMatchEndwithClause END WITH >>>"); return TRUE; } else{ - LogDebug("<<< getMatchEndwithClause NOT END WITH >>>"); + LoggerD("<<< getMatchEndwithClause NOT END WITH >>>"); return FALSE; } } @@ -408,11 +408,11 @@ namespace DeviceAPI { init_time = mktime(&initialValue); mid_time = mktime(&m_dateTime); end_time = mktime(&endValue); - LogDebug("<<< mktime(initialValue):[" << init_time << "]"); - LogDebug("<<< mktime(m_dateTime):[" << mid_time << "]"); - LogDebug("<<< mktime(endValue):[" << end_time << "]"); - LogDebug("<<< mid_time - init_time:[" << mid_time - init_time << "]"); - LogDebug("<<< end_time - mid_time:[" << end_time - mid_time << "]"); + LoggerD("<<< mktime(initialValue):[" << init_time << "]"); + LoggerD("<<< mktime(m_dateTime):[" << mid_time << "]"); + LoggerD("<<< mktime(endValue):[" << end_time << "]"); + LoggerD("<<< mid_time - init_time:[" << mid_time - init_time << "]"); + LoggerD("<<< end_time - mid_time:[" << end_time - mid_time << "]"); if(((mid_time - init_time) >= 0 ) && ((end_time - mid_time) >= 0 )) return TRUE; @@ -423,7 +423,7 @@ namespace DeviceAPI { bool StorageChangesMessageGenerator::getMatchExistClause(std::string& attrName) { - LogDebug("<<< attrName : " << attrName); + LoggerD("<<< attrName : " << attrName); if(attrName.size()> 0) return TRUE; else @@ -432,88 +432,88 @@ namespace DeviceAPI { void StorageChangesMessageGenerator::visitAttribute(std::string& attrName, MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& matchValue, int depth){ - LogDebug("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); + LoggerD("<<< attrName:[" << attrName << "], matchFlag:[" << matchFlag << "]"); if(matchFlag != DeviceAPI::Tizen::MATCH_EXISTS){ if(matchValue == NULL) { return; } } - LogDebug("matchValue:" << matchValue->toString()); + LoggerD("matchValue:" << matchValue->toString()); visitAttributeEach(attrName, matchFlag, matchValue, depth); - LogDebug(">>>"); + LoggerD(">>>"); } void StorageChangesMessageGenerator::visitAttributeEach(std::string& attrName, MatchFlag& matchFlag, DeviceAPI::Tizen::AnyPtr& value, int depth){ - LogDebug("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); + LoggerD("<<< attrName:[" << attrName << "], value:[" << value->toString() << "]"); std::string valueString; // Check msg_type and filter_type if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_SERVICE_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if(m_serviceId == nType) { m_result.push_back(TRUE); - LogDebug("<<< Type is same"); + LoggerD("<<< Type is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< Type is different"); + LoggerD("<<< Type is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_CONVERSATION_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if(m_conversationId == nType) { m_result.push_back(TRUE); - LogDebug("<<< conversationID is same"); + LoggerD("<<< conversationID is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< conversationID is different"); + LoggerD("<<< conversationID is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_TYPE)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); m_currentType = value->toString(); m_messageType = convertMessageType(m_currentType); if((int)m_type == m_messageType) { m_result.push_back(TRUE); - LogDebug("<<< Type is same"); + LoggerD("<<< Type is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< Type is different"); + LoggerD("<<< Type is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_FOLDER_ID)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if((int)m_folder == nType) { m_result.push_back(TRUE); - LogDebug("<<< folder is same"); + LoggerD("<<< folder is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< folder is different"); + LoggerD("<<< folder is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_IS_READ)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string lowerString; lowerString.assign(value->toString()); StrLowChange(lowerString); @@ -521,17 +521,17 @@ namespace DeviceAPI { if((int)m_isRead != nType) { m_result.push_back(TRUE); - LogDebug("<<< isRead is same"); + LoggerD("<<< isRead is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< isRead is different"); + LoggerD("<<< isRead is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_HAS_ATTACHMENT)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); std::string lowerString; lowerString.assign(value->toString()); StrLowChange(lowerString); @@ -539,33 +539,33 @@ namespace DeviceAPI { if((int)m_hasAttachment != nType) { m_result.push_back(TRUE); - LogDebug("<<< isRead is same"); + LoggerD("<<< isRead is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< isRead is different"); + LoggerD("<<< isRead is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_MESSAGE_STATUS)==0){ - LogDebug("<<< value:[" << value->toString() << "]"); + LoggerD("<<< value:[" << value->toString() << "]"); std::string convertStatus = value->toString(); int nStatus = convertMessageStatus(convertStatus); if((int)m_messageStatus == nStatus) { m_result.push_back(TRUE); - LogDebug("<<< folder is same"); + LoggerD("<<< folder is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< folder is different"); + LoggerD("<<< folder is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_PRIORITY)==0){ - LogDebug("<<< value:[" << value->toString() << "]"); + LoggerD("<<< value:[" << value->toString() << "]"); std::string lowerString; lowerString.assign(value->toString()); StrLowChange(lowerString); @@ -574,12 +574,12 @@ namespace DeviceAPI { if((int)m_priority == MessagePriority::Priority::HIGH) { m_result.push_back(TRUE); - LogDebug("<<< priority is HIGH"); + LoggerD("<<< priority is HIGH"); } else { m_result.push_back(FALSE); - LogDebug("<<< priority is LOW OR NORMAL"); + LoggerD("<<< priority is LOW OR NORMAL"); } } else if(lowerString.compare("false") == 0) @@ -587,77 +587,77 @@ namespace DeviceAPI { if((int)m_priority == MessagePriority::Priority::NORMAL) { m_result.push_back(FALSE); - LogDebug("<<< priority is HIGH"); + LoggerD("<<< priority is HIGH"); } else { m_result.push_back(TRUE); - LogDebug("<<< priority is LOW OR NORMAL"); + LoggerD("<<< priority is LOW OR NORMAL"); } } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_BODY)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_body:[" << m_body << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_body:[" << m_body << "]"); valueString = m_body; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< body is same"); + LoggerD("<<< body is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< body is different"); + LoggerD("<<< body is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_SUBJECT)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_subject:[" << m_subject << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_subject:[" << m_subject << "]"); valueString = m_subject; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< subject is same"); + LoggerD("<<< subject is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< subject is different"); + LoggerD("<<< subject is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_FROM)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_from:[" << m_from << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_from:[" << m_from << "]"); valueString = m_from; if(getMatchFlagResult(value, valueString, matchFlag)) { m_result.push_back(TRUE); - LogDebug("<<< from is same"); + LoggerD("<<< from is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< from is different"); + LoggerD("<<< from is different"); } return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_TO)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_to.size :[" << m_to.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_to.size :[" << m_to.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_to.size(); i++) @@ -665,15 +665,15 @@ namespace DeviceAPI { valueString = m_to[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< to compare result is :" << result); + LoggerD("<<< to compare result is :" << result); m_result.push_back(result); return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_CC)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_cc.size :[" << m_cc.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_cc.size :[" << m_cc.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_cc.size(); i++) @@ -681,15 +681,15 @@ namespace DeviceAPI { valueString = m_cc[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< cc compare result is : " << result); + LoggerD("<<< cc compare result is : " << result); m_result.push_back(result); return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_BCC)==0){ - LogDebug("<<< value:[" << value << "]"); - LogDebug("<<< value->toString():[" << value->toString() << "]"); - LogDebug("<<< m_cc.size :[" << m_bcc.size() << "]"); + LoggerD("<<< value:[" << value << "]"); + LoggerD("<<< value->toString():[" << value->toString() << "]"); + LoggerD("<<< m_cc.size :[" << m_bcc.size() << "]"); bool result = FALSE; for(unsigned int i=0; i < m_bcc.size(); i++) @@ -697,31 +697,31 @@ namespace DeviceAPI { valueString = m_bcc[i]; result = result || getMatchFlagResult(value, valueString, matchFlag); } - LogDebug("<<< bcc compare result is : " << result); + LoggerD("<<< bcc compare result is : " << result); m_result.push_back(result); return; } if(attrName.compare(StorageChangesMessageFilterValidatorFactory::ATTRIBUTE_IS_RESPONSE_TO)==0){ - LogDebug("<<< value:[" << value << "]"); + LoggerD("<<< value:[" << value << "]"); int nType = atoi(value->toString().c_str()); if(m_isResponseTo == nType) { m_result.push_back(TRUE); - LogDebug("<<< conversationID is same"); + LoggerD("<<< conversationID is same"); } else { m_result.push_back(FALSE); - LogDebug("<<< conversationID is different"); + LoggerD("<<< conversationID is different"); } return; } - LogDebug(">>>"); + LoggerD(">>>"); } int StorageChangesMessageGenerator::convertMessageType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -732,16 +732,16 @@ namespace DeviceAPI { }else if(stringType.compare("messaging.email") ==0){ retMessageType = EMAIL; }else{ - LogError("invalid type:[" << stringType << "]"); + LoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } int StorageChangesMessageGenerator::convertFolderType(std::string& stringType){ - LogDebug("<<< stringType:[" << stringType << "]"); + LoggerD("<<< stringType:[" << stringType << "]"); int retMessageType = -1; @@ -754,16 +754,16 @@ namespace DeviceAPI { }else if(stringType.compare("SENTBOX") ==0){ retMessageType = SENTBOX; }else{ - LogError("invalid type:[" << stringType << "]"); + LoggerE("invalid type:[" << stringType << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageType); + LoggerD(">>> retMessageType:" << retMessageType); return retMessageType; } int StorageChangesMessageGenerator::convertMessageStatus(std::string& stringStatus){ - LogDebug("<<< stringType:[" << stringStatus << "]"); + LoggerD("<<< stringType:[" << stringStatus << "]"); int retMessageStatus = -1; @@ -776,11 +776,11 @@ namespace DeviceAPI { }else if(stringStatus.compare("DRAFT") ==0){ retMessageStatus = MESSAGE_STATUS_DRAFT; }else{ - LogError("invalid type:[" << stringStatus << "]"); + LoggerE("invalid type:[" << stringStatus << "]"); return -1; } - LogDebug(">>> retMessageType:" << retMessageStatus); + LoggerD(">>> retMessageType:" << retMessageStatus); return retMessageStatus; } @@ -801,22 +801,22 @@ namespace DeviceAPI { if (!initialValue->isNullOrUndefined()) { if( initialValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); startTime = *initialValue->getDateTm(); } else { - LogError("initialValue->getType()"); + LoggerE("initialValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid initialValue Type"); } } if (!endValue->isNullOrUndefined()) { if( endValue->isType(DeviceAPI::Tizen::PrimitiveType_Time) ) { - LogDebug("<<getType()[PrimitiveType_Time]"); + LoggerD("<<getType()[PrimitiveType_Time]"); endTime = *endValue->getDateTm(); - LogDebug("<<getType()"); + LoggerE("endValue->getType()"); ThrowMsg(WrtDeviceApis::Commons::InvalidArgumentException, "invalid endValue Type"); } } @@ -824,10 +824,10 @@ namespace DeviceAPI { result = getBetweenRangeClause(startTime, endTime); if(result == TRUE) { - LogDebug("<<< timestamp is in range"); + LoggerD("<<< timestamp is in range"); m_result.push_back(TRUE); }else{ - LogDebug("<<< timestamp is out of range"); + LoggerD("<<< timestamp is out of range"); m_result.push_back(FALSE); } } @@ -838,25 +838,25 @@ namespace DeviceAPI { std::vector::iterator iter; bool result = FALSE; if(matchFlag == DeviceAPI::Tizen::MATCH_EXACTLY){ - LogDebug("STRING_MATCH_EXACTLY"); + LoggerD("STRING_MATCH_EXACTLY"); result = result || getMatchExactlyClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_FULLSTRING){ - LogDebug("STRING_MATCH_FULLSTRING"); + LoggerD("STRING_MATCH_FULLSTRING"); result = result || getMatchFullstringClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_CONTAINS){ - LogDebug("STRING_MATCH_CONTAINS"); + LoggerD("STRING_MATCH_CONTAINS"); result = result || getMatchContainsClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_STARTSWITH){ - LogDebug("STRING_MATCH_STARTSWITH"); + LoggerD("STRING_MATCH_STARTSWITH"); result = result || getMatchStartwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_ENDSWITH){ - LogDebug("STRING_MATCH_ENDSWITH"); + LoggerD("STRING_MATCH_ENDSWITH"); result = result || getMatchEndwithClause(valueString, value); }else if(matchFlag == DeviceAPI::Tizen::MATCH_EXISTS){ - LogDebug("STRING_MATCH_EXIST"); + LoggerD("STRING_MATCH_EXIST"); result = result || getMatchExistClause(valueString); }else{ - LogDebug("[ERROR]invalid match flag : iter:" << *iter); + LoggerD("[ERROR]invalid match flag : iter:" << *iter); } return result; } @@ -864,10 +864,10 @@ namespace DeviceAPI { bool StorageChangesMessageGenerator::getCompareResult() { bool result; - LogDebug("m_result.size() " << m_result.size()); + LoggerD("m_result.size() " << m_result.size()); result = m_result.back(); m_result.pop_back(); - LogDebug("result = " << result); + LoggerD("result = " << result); return result; } diff --git a/src/Messaging/SyncNetworkStatus.cpp b/src/Messaging/SyncNetworkStatus.cpp old mode 100755 new mode 100644 index a7bc5ef..0974ddc --- a/src/Messaging/SyncNetworkStatus.cpp +++ b/src/Messaging/SyncNetworkStatus.cpp @@ -18,7 +18,7 @@ #include #include #include "SyncNetworkStatus.h" -#include +#include namespace { const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus"; @@ -30,7 +30,7 @@ namespace Messaging { SyncNetworkStatus::SyncNetworkStatus(const DBus::MessagePtr& message) { - LogDebug("enter : " << message->getInterface()); + LoggerD("enter : " << message->getInterface()); Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS); initialize(message); } @@ -70,19 +70,19 @@ void SyncNetworkStatus::initialize(const DBus::MessagePtr& message) switch (i) { case 0: m_status = it->getInt(); - LogDebug("status :" << m_status); + LoggerD("status :" << m_status); break; case 1: m_mailId = it->getInt(); - LogDebug("mail ID :" << m_mailId); + LoggerD("mail ID :" << m_mailId); break; case 2: m_source = it->getString(); - LogDebug("source :" << m_source); + LoggerD("source :" << m_source); break; case 3: m_handle = it->getInt(); - LogDebug("handle :" << m_handle); + LoggerD("handle :" << m_handle); break; case 4: m_errorCode = it->getInt(); - LogDebug("error Code :" << m_errorCode); + LoggerD("error Code :" << m_errorCode); break; } } diff --git a/src/Messaging/ToRecipient.cpp b/src/Messaging/ToRecipient.cpp old mode 100755 new mode 100644 index ba04016..4c1e3fc --- a/src/Messaging/ToRecipient.cpp +++ b/src/Messaging/ToRecipient.cpp @@ -15,8 +15,8 @@ // limitations under the License. // -#include #include "ToRecipient.h" +#include using namespace std; @@ -59,7 +59,7 @@ void ToRecipient::appendToRecipients(const string & value) void ToRecipient::appendToRecipients(const Recipients& value) { - LogDebug("enter, recipientCount=" << value.getRecipientSize()); + LoggerD("enter, recipientCount=" << value.getRecipientSize()); *m_toRecipients += value; } diff --git a/src/Messaging/VirtualMessage.cpp b/src/Messaging/VirtualMessage.cpp index 12f8934..0d9aa84 100755 --- a/src/Messaging/VirtualMessage.cpp +++ b/src/Messaging/VirtualMessage.cpp @@ -23,10 +23,10 @@ * @version 0.1 * @brief */ -#include #include "Commons/Exception.h" #include "IMessage.h" #include "VirtualMessage.h" +#include using namespace std; diff --git a/src/Messaging/log.h b/src/Messaging/log.h old mode 100755 new mode 100644 index b46c4a6..45cddce --- a/src/Messaging/log.h +++ b/src/Messaging/log.h @@ -18,7 +18,7 @@ #ifndef LOG_H_ #define LOG_H_ -#define MsgLogError(ARG) LogError("\u001B[0;31m" << ARG << "\u001B[0;39m") -#define MsgLogWanning(ARG) LogError("\u001B[1;33m" << ARG << "\u001B[0;39m") +#define MsgLoggerE(ARG) LoggerE("\u001B[0;31m" << ARG << "\u001B[0;39m") +#define MsgLogWanning(ARG) LoggerE("\u001B[1;33m" << ARG << "\u001B[0;39m") #endif /* LOG_H_ */ diff --git a/src/Messaging/messageDB/MessageStorageReader.cpp b/src/Messaging/messageDB/MessageStorageReader.cpp index b52e4bb..c778fea 100644 --- a/src/Messaging/messageDB/MessageStorageReader.cpp +++ b/src/Messaging/messageDB/MessageStorageReader.cpp @@ -17,8 +17,8 @@ #include "MessageStorageReader.h" #include "MsgSqliteWrapper.h" - -#include +#include +#include #define MAX_THREAD_ADDR_LEN 40 #define MAX_THREAD_NAME_LEN 195 @@ -50,9 +50,11 @@ namespace{ MSG_CLASS_TYPE_T classType; /**< Message class type. See enum _MSG_CLASS_TYPE_E */ msg_storage_id_t storageId; /**< Indicates where the message is saved. see enum _MSG_FOLDER_TYPE_E*/ msg_struct_list_s *addr_list; + GList *addressList; char replyAddress[MAX_PHONE_NUMBER_LEN+1]; /**< Indicates the reply address. */ char subject[MAX_SUBJECT_LEN+1]; /**< Indicates the message subject. */ time_t displayTime; /**< Indicates the display time related to the specific operation. */ + time_t scheduledTime; /**< Indicates the time to send scheduled message. */ msg_network_status_t networkStatus; /**< Indicates the network status of the message. */ msg_encode_type_t encodeType; /**< Indicates the string encoding type. */ bool bRead; /**< Indicates whether the message is read or not. */ @@ -123,6 +125,7 @@ enum _MSG_SUB_TYPE_E MSG_STATUS_REPORT_SMS, /**< SMS-STATUS-REPORT */ MSG_SYNCML_CP, /**< SyncML Message CP */ MSG_LBS_SMS, /**< LBS Message */ + MSG_SOS_SMS, /**< SOS Message */ MSG_REJECT_SMS, /**< Reject Message */ MSG_CONCAT_SIM_SMS, /**< Concatenated Message in SIM */ @@ -165,11 +168,11 @@ msg_error_t MessageStorageReader::MsgStoConnectDB(){ msg_error_t MessageStorageReader::MsgStoDisconnectDB(){ if (dbHandle.disconnect() != MSG_SUCCESS){ - LogError(">>>[ERROR] DB Disconnect Fail"); + LoggerE(">>>[ERROR] DB Disconnect Fail"); return MSG_ERR_DB_DISCONNECT; } - LogDebug(">>>"); + LoggerD(">>>"); return MSG_SUCCESS; } @@ -177,7 +180,7 @@ msg_error_t MessageStorageReader::MsgStoDisconnectDB(){ // MsgStoSearchMessage(const MSG_SEARCH_CONDITION_S *pSearchCon, int offset, int limit, msg_struct_list_s *pMsgList) int MessageStorageReader::queryMessage(const std::string& whereClause, const std::string& orderLimit, /*out*/msg_struct_list_s *pMsgList){ - LogDebug("<<< whereClause:[" << whereClause << "]"); + LoggerD("<<< whereClause:[" << whereClause << "]"); // Clear Out Parameter pMsgList->nCount = 0; @@ -216,29 +219,29 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B if(orderLimit.length() == 0) { - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); } else { tmpWhereClause.append(orderLimit); - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); } - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); oStream << tmpWhereClause; stringSqlQuery = oStream.str(); - LogDebug("stringSqlQuery:[" << stringSqlQuery << "]"); + LoggerD("stringSqlQuery:[" << stringSqlQuery << "]"); msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt); if (err == MSG_ERR_DB_NORECORD) { - LogDebug("MSG_ERR_DB_NORECORD"); + LoggerD("MSG_ERR_DB_NORECORD"); dbHandle.freeTable(); return MSG_SUCCESS; } else if (err != MSG_SUCCESS) { - LogDebug("Get table fail. "<< stringSqlQuery); + LoggerD("Get table fail. "<< stringSqlQuery); dbHandle.freeTable(); @@ -247,7 +250,7 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B pMsgList->nCount = rowCnt; - LogDebug("pMsgList->nCount ="<< pMsgList->nCount); + LoggerD("pMsgList->nCount ="<< pMsgList->nCount); pMsgList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t) * rowCnt]; @@ -283,7 +286,9 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B pTmp->bBackup = dbHandle.getColumnToInt(index++); pTmp->priority = dbHandle.getColumnToInt(index++); pTmp->direction= dbHandle.getColumnToInt(index++); - index++; // This field is reserved. + pTmp->addressList = NULL; + + pTmp->scheduledTime = (time_t)dbHandle.getColumnToInt(index++); dbHandle.getColumnToString(index++, MAX_SUBJECT_LEN, pTmp->subject); @@ -292,7 +297,7 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B pTmp->pData = NULL; index++; } else { - LogDebug("pTmp->dataSize = "<< pTmp->dataSize); + LoggerD("pTmp->dataSize = "<< pTmp->dataSize); pTmp->pData = (void *)new char[pTmp->dataSize + 2]; memset(pTmp->pData, 0x00, pTmp->dataSize + 2); @@ -364,6 +369,28 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B pTmp->addr_list = addr_list; + // For GList *addressList + msg_struct_s *addrStruct = NULL; + MSG_ADDRESS_INFO_S *addrInfo = NULL; + + addrStruct = new msg_struct_s; + memset(addrStruct, 0x00, sizeof(msg_struct_s)); + + addrStruct->type = MSG_STRUCT_ADDRESS_INFO; + addrStruct->data = new MSG_ADDRESS_INFO_S; + memset(addrStruct->data, 0x00, sizeof(MSG_ADDRESS_INFO_S)); + + addrInfo = (MSG_ADDRESS_INFO_S *)addrStruct->data; + + addrInfo->addressType = address->addressType; + addrInfo->recipientType = address->recipientType; + addrInfo->contactId = address->contactId; + strncpy(addrInfo->addressVal, address->addressVal, MAX_ADDRESS_VAL_LEN); + strncpy(addrInfo->displayName, address->displayName, MAX_DISPLAY_NAME_LEN); + addrInfo->displayName[MAX_DISPLAY_NAME_LEN] = '\0'; + + pTmp->addressList = g_list_append(pTmp->addressList, addrStruct); + pTmp->attachCount = dbHandle.getColumnToInt(index++); dbHandle.getColumnToString(index++, MSG_FILEPATH_LEN_MAX, pTmp->thumbPath); @@ -371,7 +398,7 @@ FROM " << MSGFW_MESSAGE_TABLE_NAME << " A, " << MSGFW_ADDRESS_TABLE_NAME << " B } dbHandle.freeTable(); - LogDebug(">>>"); + LoggerD(">>>"); return MSG_SUCCESS; } @@ -389,25 +416,25 @@ int MessageStorageReader::queryConversation(const std::string& whereClause, cons std::string stringSqlQuery; std::string tmpWhereClause; - LogDebug("<<< whereClause:[" << whereClause << "]"); + LoggerD("<<< whereClause:[" << whereClause << "]"); if(whereClause.length()==0){ - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); tmpWhereClause.append("WHERE (B.SMS_CNT > 0 OR B.MMS_CNT > 0) AND A.CONV_ID = B.CONV_ID "); - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); }else{ - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); tmpWhereClause.append(whereClause); - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); } if(orderLimit.length() == 0) { - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); } else { tmpWhereClause.append(orderLimit); - LogDebug("<<< tmpWhereClause:[" << tmpWhereClause << "]"); + LoggerD("<<< tmpWhereClause:[" << tmpWhereClause << "]"); } oStream << "SELECT B.CONV_ID, B.UNREAD_CNT, B.SMS_CNT, B.MMS_CNT, \ @@ -416,7 +443,7 @@ FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, " << MSGFW_CONVERSATION_TABLE_NAME oStream << tmpWhereClause; stringSqlQuery = oStream.str(); - LogDebug("stringSqlQuery:[" << stringSqlQuery << "]"); + LoggerD("stringSqlQuery:[" << stringSqlQuery << "]"); msg_error_t err = dbHandle.getTable(stringSqlQuery.c_str(), &rowCnt); @@ -424,20 +451,20 @@ FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, " << MSGFW_CONVERSATION_TABLE_NAME dbHandle.freeTable(); return MSG_SUCCESS; } else if (err != MSG_SUCCESS) { - LogDebug("stringSqlQuery:[" << stringSqlQuery << "]"); + LoggerD("stringSqlQuery:[" << stringSqlQuery << "]"); dbHandle.freeTable(); return err; } if (rowCnt < 1) { - LogDebug("rowCnt is %d"<< rowCnt); + LoggerD("rowCnt is %d"<< rowCnt); dbHandle.freeTable(); return err; } pThreadViewList->nCount = rowCnt; - LogDebug("pThreadViewList->nCount [" << pThreadViewList->nCount << "]"); + LoggerD("pThreadViewList->nCount [" << pThreadViewList->nCount << "]"); pThreadViewList->msg_struct_info = (msg_struct_t *)new char[sizeof(msg_struct_t)*rowCnt]; @@ -481,7 +508,7 @@ FROM " << MSGFW_ADDRESS_TABLE_NAME << " A, " << MSGFW_CONVERSATION_TABLE_NAME //int msg_release_list_struct(msg_struct_list_s *msg_struct_list) int MessageStorageReader::msg_release_list_struct_private(msg_struct_list_s *msg_struct_list) { - LogDebug("enter"); + LoggerD("enter"); msg_error_t err = MSG_SUCCESS; if (msg_struct_list == NULL) @@ -505,18 +532,18 @@ int MessageStorageReader::msg_release_list_struct_private(msg_struct_list_s *msg msg_struct_list->msg_struct_info = NULL; // for private only start -// msg_struct_list->nCount = 0; -// malloc_trim(0); -// MsgReleaseMemoryDB(); + msg_struct_list->nCount = 0; + malloc_trim(0); + MsgReleaseMemoryDB(); // for private only end - LogDebug("end"); + LoggerD("end"); return err; } int MessageStorageReader::release_msg_struct_private(msg_struct_t *msg_struct_handle) { - LogDebug("enter"); + LoggerD("enter"); msg_error_t err = MSG_SUCCESS; @@ -547,14 +574,14 @@ int MessageStorageReader::release_msg_struct_private(msg_struct_t *msg_struct_ha err = MSG_ERR_INVALID_PARAMETER; break; } - LogDebug("end"); + LoggerD("end"); return err; } int MessageStorageReader::msg_message_release_private(msg_struct_s **msg_struct) { - LogDebug("enter"); + LoggerD("enter"); MSG_MESSAGE_HIDDEN_S_M *msg = (MSG_MESSAGE_HIDDEN_S_M *)(*msg_struct)->data; @@ -588,10 +615,10 @@ int MessageStorageReader::msg_message_release_private(msg_struct_s **msg_struct) // for private only start // Free GList *addressList -// if (msg->addressList) { -// g_list_free_full(msg->addressList, __msg_message_release_address_struct_private); -// msg->addressList = NULL; -// } + if (msg->addressList) { + g_list_free_full(msg->addressList, __msg_message_release_address_struct_private); + msg->addressList = NULL; + } // for private only end delete msg; @@ -600,14 +627,14 @@ int MessageStorageReader::msg_message_release_private(msg_struct_s **msg_struct) delete (msg_struct_s *)*msg_struct; *msg_struct = NULL; - LogDebug("end"); + LoggerD("end"); return MSG_SUCCESS; } void MessageStorageReader::__msg_message_release_address_struct_private(gpointer data) { - LogDebug("enter"); + LoggerD("enter"); if (data == NULL) return; @@ -619,7 +646,7 @@ void MessageStorageReader::__msg_message_release_address_struct_private(gpointer addr_struct->data = NULL; delete addr_struct; - LogDebug("end"); + LoggerD("end"); } diff --git a/src/Messaging/messageDB/MsgSqliteWrapper.cpp b/src/Messaging/messageDB/MsgSqliteWrapper.cpp index 7a6b004..fdfbb2b 100644 --- a/src/Messaging/messageDB/MsgSqliteWrapper.cpp +++ b/src/Messaging/messageDB/MsgSqliteWrapper.cpp @@ -21,9 +21,9 @@ #include #include -#include //#include "MsgDebug.h" #include "MsgSqliteWrapper.h" +#include extern "C" { @@ -79,18 +79,18 @@ msg_error_t MsgDbHandler::connect() if (ret == SQLITE_OK) { - LogDebug("DB Connect Success : [" << handle << "]"); + LoggerD("DB Connect Success : [" << handle << "]"); return MSG_SUCCESS; } else { - LogDebug("DB Connect Fail [" << ret << "]"); + LoggerD("DB Connect Fail [" << ret << "]"); return MSG_ERR_DB_CONNECT; } } else { - LogDebug("DB Connect exist : [" << handle << "]"); + LoggerD("DB Connect exist : [" << handle << "]"); } return MSG_SUCCESS; @@ -108,12 +108,12 @@ msg_error_t MsgDbHandler::disconnect() if (ret == SQLITE_OK) { handle = NULL; - LogDebug("DB Disconnect Success"); + LoggerD("DB Disconnect Success"); return MSG_SUCCESS; } else { - LogDebug("DB Disconnect Fail [" << ret << "]"); + LoggerD("DB Disconnect Fail [" << ret << "]"); return MSG_ERR_DB_DISCONNECT; } } @@ -138,7 +138,7 @@ bool MsgDbHandler::checkTableExist(const char *pTableName) } nResult = getColumnToInt(1); - LogDebug("Result [" << nResult << "]"); + LoggerD("Result [" << nResult << "]"); freeTable(); @@ -163,12 +163,12 @@ msg_error_t MsgDbHandler::execQuery(const char *pQuery) if (ret == SQLITE_OK) { - LogDebug("Execute Query Success"); + LoggerD("Execute Query Success"); return MSG_SUCCESS; } else { - LogDebug("Execute Query Fail [" << ret << "]"); + LoggerD("Execute Query Fail [" << ret << "]"); return MSG_ERR_DB_EXEC; } @@ -193,16 +193,16 @@ msg_error_t MsgDbHandler::getTable(const char *pQuery, int *pRowCnt) { if (*pRowCnt == 0) // when the no record return 'MSG_ERR_DB_NORECORD' { - LogDebug("No Query Result"); + LoggerD("No Query Result"); return MSG_ERR_DB_NORECORD; } - LogDebug("Get Table Success"); + LoggerD("Get Table Success"); return MSG_SUCCESS; } else { - LogDebug("Get Table Fail [" << ret << "]"); + LoggerD("Get Table Fail [" << ret << "]"); return MSG_ERR_DB_GETTABLE; } @@ -253,12 +253,12 @@ msg_error_t MsgDbHandler::prepareQuery(const char *pQuery) if ((ret = sqlite3_prepare_v2(handle, pQuery, strlen(pQuery), &stmt, NULL)) == SQLITE_OK) { - LogDebug("Prepare Query Success"); + LoggerD("Prepare Query Success"); return MSG_SUCCESS; } else { - LogDebug("Prepare Query Fail [" << ret << "]"); + LoggerD("Prepare Query Fail [" << ret << "]"); return MSG_ERR_DB_PREPARE; } @@ -274,17 +274,17 @@ msg_error_t MsgDbHandler::stepQuery() if (ret == SQLITE_ROW) { - LogDebug("MsgStepQuery() SQLITE_ROW"); + LoggerD("MsgStepQuery() SQLITE_ROW"); return MSG_ERR_DB_ROW; } else if (ret == SQLITE_DONE) { - LogDebug("MsgStepQuery() SQLITE_DONE"); + LoggerD("MsgStepQuery() SQLITE_DONE"); return MSG_ERR_DB_DONE; } else { - LogDebug("MsgStepQuery() Fail [" << ret << "]"); + LoggerD("MsgStepQuery() Fail [" << ret << "]"); return MSG_ERR_DB_STEP; } @@ -330,12 +330,12 @@ msg_error_t MsgDbHandler::beginTrans() if (ret == SQLITE_OK) { - LogDebug("Begin Transaction Success"); + LoggerD("Begin Transaction Success"); return MSG_SUCCESS; } else { - LogDebug("Begin Transaction Fail [" << ret << "]"); + LoggerD("Begin Transaction Fail [" << ret << "]"); return MSG_ERR_DB_EXEC; } @@ -363,12 +363,12 @@ msg_error_t MsgDbHandler::endTrans(bool Success) if (ret == SQLITE_OK) { - LogDebug("End Transaction Success"); + LoggerD("End Transaction Success"); return MSG_SUCCESS; } else { - LogDebug("End Transaction Fail [" << ret << "]"); + LoggerD("End Transaction Fail [" << ret << "]"); return MSG_ERR_DB_EXEC; } @@ -384,7 +384,7 @@ int MsgDbHandler::getColumnToInt(int RowIndex) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return nTemp; } @@ -402,7 +402,7 @@ char MsgDbHandler::getColumnToChar(int RowIndex) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return '\0'; } @@ -416,7 +416,7 @@ void MsgDbHandler::getColumnToString(int RowIndex, int Length, char *pString) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return; } @@ -432,7 +432,7 @@ msg_error_t MsgDbHandler::getRowId(const char *pTableName, unsigned int *pRowId) if (pTableName == NULL || pRowId == NULL) return MSG_ERR_INVALID_PARAMETER; - LogDebug("Table Name [" << pTableName << "]"); + LoggerD("Table Name [" << pTableName << "]"); memset(strQuery, 0x00, sizeof(strQuery)); snprintf(strQuery, sizeof(strQuery), "select max(rowid) from %s", pTableName); @@ -450,7 +450,7 @@ msg_error_t MsgDbHandler::getRowId(const char *pTableName, unsigned int *pRowId) } else { - LogDebug("MsgGetRowId failed"); + LoggerD("MsgGetRowId failed"); *pRowId = 0; freeTable(); return MSG_ERR_DB_GETTABLE; @@ -458,7 +458,7 @@ msg_error_t MsgDbHandler::getRowId(const char *pTableName, unsigned int *pRowId) freeTable(); - LogDebug("Row ID [" << *pRowId << "]"); + LoggerD("Row ID [" << *pRowId << "]"); return MSG_SUCCESS; } @@ -488,12 +488,12 @@ msg_error_t MsgConnectDB() if (ret == SQLITE_OK) { - LogDebug("DB Connect Success"); + LoggerD("DB Connect Success"); return MSG_SUCCESS; } else { - LogDebug("DB Connect Fail [" << ret "]"); + LoggerD("DB Connect Fail [" << ret "]"); return MSG_ERR_DB_CONNECT; } } @@ -518,12 +518,12 @@ msg_error_t MsgDisconnectDB() if (ret == SQLITE_OK) { gDBHandle = NULL; - LogDebug("DB Disconnect Success"); + LoggerD("DB Disconnect Success"); return MSG_SUCCESS; } else { - LogDebug("DB Disconnect Fail [" << ret << "]"); + LoggerD("DB Disconnect Fail [" << ret << "]"); return MSG_ERR_DB_DISCONNECT; } } @@ -548,7 +548,7 @@ bool MsgIsTableExist(const char *pTableName) } nResult = MsgGetColumnToInt(1); - LogDebug("Result [" << nResult << "]"); + LoggerD("Result [" << nResult << "]"); MsgFreeTable(); @@ -570,12 +570,12 @@ msg_error_t MsgExecQuery(const char *pQuery) if (ret == SQLITE_OK) { - LogDebug("Execute Query Success"); + LoggerD("Execute Query Success"); return MSG_SUCCESS; } else { - LogDebug("Execute Query Fail [" << ret << "]"); + LoggerD("Execute Query Fail [" << ret << "]"); return MSG_ERR_DB_EXEC; } @@ -595,16 +595,16 @@ msg_error_t MsgGetTable(const char *pQuery, int *pRowCnt) { if (*pRowCnt == 0) // when the no record return 'MSG_ERR_DB_NORECORD' { - LogDebug("No Query Result"); + LoggerD("No Query Result"); return MSG_ERR_DB_NORECORD; } - LogDebug("Get Table Success"); + LoggerD("Get Table Success"); return MSG_SUCCESS; } else { - LogDebug("Get Table Fail [" << ret << "]"); + LoggerD("Get Table Fail [" << ret << "]"); return MSG_ERR_DB_GETTABLE; } @@ -652,12 +652,12 @@ msg_error_t MsgPrepareQuery(const char *pQuery) if ((ret = sqlite3_prepare_v2(gDBHandle, pQuery, strlen(pQuery), &gStmt, NULL)) == SQLITE_OK) { - LogDebug("Prepare Query Success"); + LoggerD("Prepare Query Success"); return MSG_SUCCESS; } else { - LogDebug("Prepare Query Fail [" << ret "]"); + LoggerD("Prepare Query Fail [" << ret "]"); return MSG_ERR_DB_PREPARE; } @@ -673,17 +673,17 @@ msg_error_t MsgStepQuery() if (ret == SQLITE_ROW) { - LogDebug("MsgStepQuery() SQLITE_ROW"); + LoggerD("MsgStepQuery() SQLITE_ROW"); return MSG_ERR_DB_ROW; } else if (ret == SQLITE_DONE) { - LogDebug("MsgStepQuery() SQLITE_DONE"); + LoggerD("MsgStepQuery() SQLITE_DONE"); return MSG_ERR_DB_DONE; } else { - LogDebug("MsgStepQuery() Fail [" << ret << "]"); + LoggerD("MsgStepQuery() Fail [" << ret << "]"); return MSG_ERR_DB_STEP; } @@ -724,12 +724,12 @@ msg_error_t MsgBeginTrans() if (ret == SQLITE_OK) { - LogDebug("Begin Transaction Success"); + LoggerD("Begin Transaction Success"); return MSG_SUCCESS; } else { - LogDebug("Begin Transaction Fail [" << ret "]"); + LoggerD("Begin Transaction Fail [" << ret "]"); return MSG_ERR_DB_EXEC; } @@ -753,12 +753,12 @@ msg_error_t MsgEndTrans(bool Success) if (ret == SQLITE_OK) { - LogDebug("End Transaction Success"); + LoggerD("End Transaction Success"); return MSG_SUCCESS; } else { - LogDebug("End Transaction Fail [" << ret << "]"); + LoggerD("End Transaction Fail [" << ret << "]"); return MSG_ERR_DB_EXEC; } @@ -774,7 +774,7 @@ int MsgGetColumnToInt(int RowIndex) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return nTemp; } @@ -792,7 +792,7 @@ char MsgGetColumnToChar(int RowIndex) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return NULL; } @@ -806,7 +806,7 @@ void MsgGetColumnToString(int RowIndex, int Length, char *pString) if (pTemp == NULL) { - LogDebug("NULL"); + LoggerD("NULL"); return; } @@ -822,7 +822,7 @@ msg_error_t MsgGetRowId(const char *pTableName, unsigned int *pRowId) if (pTableName == NULL || pRowId == NULL) return MSG_ERR_INVALID_PARAMETER; - LogDebug("Table Name [" << pTableName << "]"); + LoggerD("Table Name [" << pTableName << "]"); memset(strQuery, 0x00, sizeof(strQuery)); snprintf(strQuery, sizeof(strQuery), "select max(rowid) from %s", pTableName); @@ -840,7 +840,7 @@ msg_error_t MsgGetRowId(const char *pTableName, unsigned int *pRowId) } else { - LogDebug("MsgGetRowId failed"); + LoggerD("MsgGetRowId failed"); *pRowId = 0; MsgFreeTable(); return MSG_ERR_DB_GETTABLE; @@ -848,7 +848,7 @@ msg_error_t MsgGetRowId(const char *pTableName, unsigned int *pRowId) MsgFreeTable(); - LogDebug("Row ID [" << *pRowId << "]"); + LoggerD("Row ID [" << *pRowId << "]"); return MSG_SUCCESS; } @@ -860,5 +860,5 @@ void MsgReleaseMemoryDB() freeSize = sqlite3_release_memory(-1); - LogDebug("freed memory size (bytes) : [" << freeSize << "]"); + LoggerD("freed memory size (bytes) : [" << freeSize << "]"); } diff --git a/src/Messaging/plugin_initializer.cpp b/src/Messaging/plugin_initializer.cpp old mode 100755 new mode 100644 index 213b932..38607e2 --- a/src/Messaging/plugin_initializer.cpp +++ b/src/Messaging/plugin_initializer.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include "JSMessagingServiceManager.h" @@ -26,6 +25,7 @@ #include "MessageListenerManager.h" #include +#include #define WRT_JS_EXTENSION_OBJECT_TIZEN "tizen" @@ -60,32 +60,32 @@ using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\MessagingServiceManager] on_widget_start_callback ("<addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); DeviceAPI::Common::GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); DeviceAPI::Messaging::MessageAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/NFC/JSNFCAdapter.cpp b/src/NFC/JSNFCAdapter.cpp old mode 100755 new mode 100644 index 27265b9..9765f38 --- a/src/NFC/JSNFCAdapter.cpp +++ b/src/NFC/JSNFCAdapter.cpp @@ -15,8 +15,6 @@ // limitations under the License. // -#include - #include #include #include @@ -45,6 +43,7 @@ #include "NFCFactory.h" #include "EventNFCChanged.h" #include "plugin_config.h" +#include using namespace std; using namespace DPL; @@ -100,7 +99,7 @@ JSClassRef JSNFCAdapter::m_jsClassRef = JSClassCreate(JSNFCAdapter::getClassInfo void JSNFCAdapter::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered. Nothing to do"); + LoggerD("entered. Nothing to do"); } void JSNFCAdapter::finalize(JSObjectRef object) @@ -112,7 +111,7 @@ void JSNFCAdapter::finalize(JSObjectRef object) } JSObjectRef JSNFCAdapter::createJSObject(JSContextRef context) { - LogDebug("entered"); + LoggerD("entered"); INFCAdapterPtr nfcAdapter(NFCFactory::getInstance().createNFCAdapterObject()); NFCAdapterPrivObject *priv = new NFCAdapterPrivObject(context, nfcAdapter); @@ -140,7 +139,7 @@ const JSClassDefinition* JSNFCAdapter::getClassInfo() JSValueRef JSNFCAdapter::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NFCConverter convert(context); @@ -148,24 +147,24 @@ JSValueRef JSNFCAdapter::getProperty(JSContextRef context, JSObjectRef object, if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCADAPTER_POWERED)) { NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); ThrowMsg(NullPointerException, "Private object not initialized"); } INFCAdapterPtr nfcAdapter(privateObject->getObject()); return convert.toJSValueRef(nfcAdapter->getPowerState()); } } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -174,7 +173,7 @@ JSValueRef JSNFCAdapter::getProperty(JSContextRef context, JSObjectRef object, JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSNFCAdapter::setTagListener Enter"); + LoggerD("JSNFCAdapter::setTagListener Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -195,12 +194,12 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec nfcTagType filter = nfcConverter.toNfcTagType(filterValue.at(i)); tagFilter->addTagTypeValue(filter); - LogDebug("tag_types.at(i): " << filterValue.at(i)); + LoggerD("tag_types.at(i): " << filterValue.at(i)); } NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -223,18 +222,18 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("JSNFCAdapter::setTagListener : ConversionException"); + LoggerE("JSNFCAdapter::setTagListener : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -242,7 +241,7 @@ JSValueRef JSNFCAdapter::setTagListener (JSContextRef context, JSObjectRef objec JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSNFCAdapter::setPeerListener Enter"); + LoggerD("JSNFCAdapter::setPeerListener Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -263,7 +262,7 @@ JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef obje NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -287,31 +286,31 @@ JSValueRef JSNFCAdapter::setPeerListener (JSContextRef context, JSObjectRef obje return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("JSNFCAdapter::setPeerListener : ConversionException"); + LoggerE("JSNFCAdapter::setPeerListener : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSNFCAdapter::unsetTagListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSNFCAdapter::unsetNFCTagListener Enter"); + LoggerD("JSNFCAdapter::unsetNFCTagListener Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -328,24 +327,24 @@ JSValueRef JSNFCAdapter::unsetTagListener(JSContextRef context, JSObjectRef obje } Catch (NullPointerException) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("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()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSNFCAdapter::unsetPeerListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSNFCAdapter::unsetPeerListener Enter"); + LoggerD("JSNFCAdapter::unsetPeerListener Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -362,10 +361,10 @@ JSValueRef JSNFCAdapter::unsetPeerListener(JSContextRef context, JSObjectRef obj } Catch (NullPointerException) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("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()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -373,14 +372,14 @@ JSValueRef JSNFCAdapter::unsetPeerListener(JSContextRef context, JSObjectRef obj JSValueRef JSNFCAdapter::getCachedMessage (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("JSNFCAdapter::getCachedMessage Enter"); + LoggerD("JSNFCAdapter::getCachedMessage Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -392,15 +391,15 @@ JSValueRef JSNFCAdapter::getCachedMessage (JSContextRef context, JSObjectRef obj return JSNdefMessage::createJSObject(global_context, cachedMessage); return JSValueMakeNull(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -408,7 +407,7 @@ JSValueRef JSNFCAdapter::getCachedMessage (JSContextRef context, JSObjectRef obj JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_ADMIN_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -417,7 +416,7 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object, NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -445,22 +444,22 @@ JSValueRef JSNFCAdapter::setPowered (JSContextRef context, JSObjectRef object, NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available")); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); return JSValueMakeUndefined(context); diff --git a/src/NFC/JSNFCManager.cpp b/src/NFC/JSNFCManager.cpp index 7867efb..3c1ddcc 100644 --- a/src/NFC/JSNFCManager.cpp +++ b/src/NFC/JSNFCManager.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -34,6 +31,7 @@ #include "NFCFactory.h" #include "plugin_config.h" #include "NFCDefaultAdapter.h" +#include using namespace std; using namespace DPL; @@ -98,34 +96,34 @@ JSClassRef JSNFCManager::m_jsClassRef = JSClassCreate(JSNFCManager::getClassInfo void JSNFCManager::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); NFCManagerPrivObject* priv = static_cast(JSObjectGetPrivate(object)); if (!priv) { Try { priv = new NFCManagerPrivObject(context); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } } } void JSNFCManager::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); NFCManagerPrivObject *priv = static_cast(JSObjectGetPrivate(object)); if (priv) { JSObjectSetPrivate(object, NULL); - LogDebug("Deleting NFC Manager object"); + LoggerD("Deleting NFC Manager object"); delete priv; } } @@ -147,7 +145,7 @@ const JSClassDefinition* JSNFCManager::getClassInfo() JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { Converter convert(context); @@ -168,15 +166,15 @@ JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(NFC_TNF_UNCHANGED); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); @@ -185,7 +183,7 @@ JSValueRef JSNFCManager::getProperty(JSContextRef context, JSObjectRef object, JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS); @@ -193,29 +191,29 @@ JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef ob NFCManagerPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); ThrowMsg(UnsupportedException, "private object is null"); } return JSNFCAdapter::createJSObject(GlobalContextManager::getInstance()->getGlobalContext(context)); } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not Supported"); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -223,7 +221,7 @@ JSValueRef JSNFCManager::getDefaultAdapter (JSContextRef context, JSObjectRef ob JSValueRef JSNFCManager::setExclusiveMode (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_COMMON_FUNCS); @@ -232,27 +230,27 @@ JSValueRef JSNFCManager::setExclusiveMode (JSContextRef context, JSObjectRef obj ArgumentValidator validator(context, argumentCount, arguments); // mode bool mode = validator.toBool(0); - LogDebug("mode : " << mode); + LoggerD("mode : " << mode); NFCManagerPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); ThrowMsg(UnsupportedException, "private object is null"); } NFCDefaultAdapterSingleton::Instance().setExclusiveMode(mode); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } diff --git a/src/NFC/JSNFCTag.cpp b/src/NFC/JSNFCTag.cpp index e0ef66f..d75b445 100644 --- a/src/NFC/JSNFCTag.cpp +++ b/src/NFC/JSNFCTag.cpp @@ -14,9 +14,6 @@ * limitations under the License. */ - -#include - #include #include #include @@ -40,7 +37,7 @@ #include "EventTagAction.h" #include "NFCAsyncCallbackManager.h" #include "plugin_config.h" - +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -105,7 +102,7 @@ JSStaticFunction JSNFCTag::m_function[] = { JSClassRef JSNFCTag::m_jsClassRef = JSClassCreate(JSNFCTag::getClassInfo()); JSObjectRef JSNFCTag::createJSObject(JSContextRef context, void *tagHandle) { - LogDebug("entered"); + LoggerD("entered"); INFCTagPtr nfcTag = NFCFactory::getInstance().createNFCTagObject(tagHandle); @@ -124,10 +121,10 @@ void JSNFCTag::initialize(JSContextRef context, JSObjectRef object) void JSNFCTag::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); NFCTagPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting NFCTag object"); + LoggerD("Deleting NFCTag object"); delete priv; } @@ -148,19 +145,19 @@ const JSClassDefinition* JSNFCTag::getClassInfo() JSValueRef JSNFCTag::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NFCTagPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } INFCTagPtr nfcTag(privateObject->getObject()); NFCConverter convert(context); - LogDebug("propertyName : " << convert.toString(propertyName)); + LoggerD("propertyName : " << convert.toString(propertyName)); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTAG_TYPE)) { return convert.toJSValueRef(convert.toNfcTagTypeString(nfcTag->getTagType())); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTAG_ISSUPPORTEDNDEF)) { @@ -168,21 +165,21 @@ JSValueRef JSNFCTag::getProperty(JSContextRef context, JSObjectRef object, } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTAG_NDEFSIZE)) { return convert.toJSValueRefLong(nfcTag->getNdefSize()); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTAG_PROPERTIES)) { - LogDebug("get Properties"); + LoggerD("get Properties"); return convert.toJSValueRef(nfcTag->getProperties()); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTAG_ISCONNECTED)) { return convert.toJSValueRef(nfcTag->isConnected()); } } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -202,7 +199,7 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -211,7 +208,7 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context, NFCTagPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -236,26 +233,26 @@ JSValueRef JSNFCTag::readNDEF(JSContextRef context, NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("readNDEF : ConversionException"); + LoggerE("readNDEF : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not Support NDEF"); } Catch (InvalidArgumentException) { - LogError("readNDEF InvalidArgumentException"); + LoggerE("readNDEF InvalidArgumentException"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values")); return JSValueMakeUndefined(context); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available")); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); @@ -269,7 +266,7 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -278,7 +275,7 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context, NFCTagPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -306,26 +303,26 @@ JSValueRef JSNFCTag::writeNDEF(JSContextRef context, NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("writeNDEF : ConversionException"); + LoggerE("writeNDEF : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not Support NDEF"); } Catch (InvalidArgumentException) { - LogError("writeNDEF InvalidArgumentException"); + LoggerE("writeNDEF InvalidArgumentException"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values")); return JSValueMakeUndefined(context); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available")); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); @@ -339,7 +336,7 @@ JSValueRef JSNFCTag::transceive(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_TAG_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -348,7 +345,7 @@ JSValueRef JSNFCTag::transceive(JSContextRef context, NFCTagPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -379,23 +376,23 @@ JSValueRef JSNFCTag::transceive(JSContextRef context, NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("transceive : ConversionException"); + LoggerE("transceive : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("transceive InvalidArgumentException"); + LoggerE("transceive InvalidArgumentException"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values")); return JSValueMakeUndefined(context); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available")); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); diff --git a/src/NFC/JSNFCTarget.cpp b/src/NFC/JSNFCTarget.cpp index 8e3e86d..addb719 100644 --- a/src/NFC/JSNFCTarget.cpp +++ b/src/NFC/JSNFCTarget.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -42,6 +39,7 @@ #include "NFCFactory.h" #include "EventTargetAction.h" #include "plugin_config.h" +#include using namespace DeviceAPI::Common; @@ -95,7 +93,7 @@ JSStaticFunction JSNFCTarget::m_function[] = { JSClassRef JSNFCTarget::m_jsClassRef = JSClassCreate(JSNFCTarget::getClassInfo()); JSObjectRef JSNFCTarget::createJSObject(JSContextRef context, void *tagHandle) { - LogDebug("entered"); + LoggerD("entered"); INFCTargetPtr nfcTarget = NFCFactory::getInstance().createNFCTargetObject(tagHandle); @@ -114,10 +112,10 @@ void JSNFCTarget::initialize(JSContextRef context, JSObjectRef object) void JSNFCTarget::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); NFCTargetPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting timezone object"); + LoggerD("Deleting timezone object"); delete priv; } @@ -138,13 +136,13 @@ const JSClassDefinition* JSNFCTarget::getClassInfo() JSValueRef JSNFCTarget::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NFCTARGET_ISCONNECTED)) { NFCTargetPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -153,15 +151,15 @@ JSValueRef JSNFCTarget::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(nfcTarget->isConnected()); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -181,7 +179,7 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -190,7 +188,7 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context, NFCTargetPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -216,18 +214,18 @@ JSValueRef JSNFCTarget::setReceiveNDEFListener(JSContextRef context, return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("setReceiveNDEFListener : ConversionException"); + LoggerE("setReceiveNDEFListener : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -240,7 +238,7 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); Try { AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -249,7 +247,7 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context, NFCTargetPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -262,15 +260,15 @@ JSValueRef JSNFCTarget::unsetReceiveNDEFListener(JSContextRef context, return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("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()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -283,7 +281,7 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = NFC_CHECK_ACCESS(NFC_FUNCTION_API_P2P_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -294,7 +292,7 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context, NFCTargetPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -320,23 +318,23 @@ JSValueRef JSNFCTarget::sendNDEF(JSContextRef context, NFCAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, global_context); return JSValueMakeUndefined(context); } Catch (BasePlatformException) { - LogError(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); + LoggerE(_rethrown_exception.getName() << ": " << _rethrown_exception.getMessage()); return JSWebAPIException::throwException(context, exception, _rethrown_exception); } Catch (ConversionException) { - LogError("sendNDEF : ConversionException"); + LoggerE("sendNDEF : ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("sendNDEF InvalidArgumentException"); + LoggerE("sendNDEF InvalidArgumentException"); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values")); return JSValueMakeUndefined(context); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available")); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); diff --git a/src/NFC/JSNdefMessage.cpp b/src/NFC/JSNdefMessage.cpp index 0f13e45..784d55c 100644 --- a/src/NFC/JSNdefMessage.cpp +++ b/src/NFC/JSNdefMessage.cpp @@ -15,7 +15,6 @@ // limitations under the License. // - #include "JSNdefMessage.h" #include "JSNdefRecord.h" #include "JSNdefRecordText.h" @@ -23,7 +22,6 @@ #include "JSNdefRecordMedia.h" #include "NFCConverter.h" #include -#include #include #include #include @@ -36,6 +34,7 @@ #include "NFCFactory.h" #include "plugin_config.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -87,21 +86,21 @@ JSStaticFunction JSNdefMessage::m_function[] = { JSClassRef JSNdefMessage::m_jsClassRef = JSClassCreate(JSNdefMessage::getClassInfo()); JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, void *messageHandle) { - LogDebug("entered"); + LoggerD("entered"); INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(messageHandle); return createJSObject(context, ndefMessage); } JSObjectRef JSNdefMessage::createJSObject(JSContextRef context) { - LogDebug("entered"); + LoggerD("entered"); INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(); return createJSObject(context, ndefMessage); } JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, INdefMessagePtr message) { - LogDebug("entered"); + LoggerD("entered"); NFCConverter convert(context); JSValueRef records = convert.toJSNdefRecordArray(message); @@ -118,33 +117,33 @@ JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, INdefMessagePtr } JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, std::vector ndefRcords) { - LogDebug("entered"); + LoggerD("entered"); INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(ndefRcords); return createJSObject(context, ndefMessage); } JSObjectRef JSNdefMessage::createJSObject(JSContextRef context, std::vector rawdata) { - LogDebug("entered"); + LoggerD("entered"); INdefMessagePtr ndefMessage = NFCFactory::getInstance().createNDEFMessageObject(rawdata); return createJSObject(context, ndefMessage); } void JSNdefMessage::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); } void JSNdefMessage::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); NdefMessagePrivObject *priv = static_cast(JSObjectGetPrivate(object)); if (priv) { INdefMessagePtr ndefMessage(priv->getObject()); - LogDebug("getRecordesPtr:"<getRecordesPtr()); + LoggerD("getRecordesPtr:"<getRecordesPtr()); JSValueUnprotect(priv->getContext(), (JSValueRef)(ndefMessage->getRecordesPtr())); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting NdefMessage object"); + LoggerD("Deleting NdefMessage object"); delete priv; } } @@ -165,7 +164,7 @@ const JSClassDefinition* JSNdefMessage::getClassInfo() JSObjectRef JSNdefMessage::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { ArgumentValidator validator(ctx, argumentCount, arguments); @@ -184,7 +183,7 @@ JSObjectRef JSNdefMessage::constructor(JSContextRef ctx, JSObjectRef constructor for (std::size_t i = 0; i < JSGetArrayLength(ctx, objArg); ++i) { JSValueRef element = JSGetArrayElement(ctx, objArg, i); bool bNdefRecord = convert.isNdefRecord(element); - LogDebug("isNdefRecord : " << bNdefRecord); + LoggerD("isNdefRecord : " << bNdefRecord); if (bNdefRecord) isRecordArray = true; else @@ -227,9 +226,9 @@ JSObjectRef JSNdefMessage::constructor(JSContextRef ctx, JSObjectRef constructor *exception = error; return error; } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -239,19 +238,19 @@ JSObjectRef JSNdefMessage::constructor(JSContextRef ctx, JSObjectRef constructor JSValueRef JSNdefMessage::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NdefMessagePrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } INdefMessagePtr ndefMessage(privateObject->getObject()); NFCConverter convert(context); - LogDebug("propertyName : " << convert.toString(propertyName)); + LoggerD("propertyName : " << convert.toString(propertyName)); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFMESSAGE_RECORDCOUNT)) { std::vector records = convert.toVectorOfRecordHandles(static_cast(ndefMessage->getRecordesPtr())); return convert.toJSValueRefLong(records.size()); @@ -259,15 +258,15 @@ JSValueRef JSNdefMessage::getProperty(JSContextRef context, JSObjectRef object, return static_cast(ndefMessage->getRecordesPtr()); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -275,13 +274,13 @@ JSValueRef JSNdefMessage::getProperty(JSContextRef context, JSObjectRef object, bool JSNdefMessage::setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFMESSAGE_RECORDS)) { NdefMessagePrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -289,7 +288,7 @@ bool JSNdefMessage::setProperty(JSContextRef context, JSObjectRef object, if (JSValueIsNull(context, value) || JSValueIsUndefined(context, value) || !JSIsArrayValue(context, value)) { - LogError("value is invald."); + LoggerE("value is invald."); ThrowMsg(ConversionException, "value is invald."); } INdefMessagePtr ndefMessage(privateObject->getObject()); @@ -300,17 +299,17 @@ bool JSNdefMessage::setProperty(JSContextRef context, JSObjectRef object, return true; } } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return false; @@ -323,11 +322,11 @@ JSValueRef JSNdefMessage::toByte(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); Try { NdefMessagePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -338,18 +337,18 @@ JSValueRef JSNdefMessage::toByte(JSContextRef context, INdefMessagePtr newMessage = NFCFactory::getInstance().createNDEFMessageObject(records); return convert.toJSValueRef(newMessage->toByte()); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); diff --git a/src/NFC/JSNdefRecord.cpp b/src/NFC/JSNdefRecord.cpp index 827a915..ac50e77 100644 --- a/src/NFC/JSNdefRecord.cpp +++ b/src/NFC/JSNdefRecord.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -33,6 +32,7 @@ #include "JSNdefRecord.h" #include "plugin_config.h" #include "NFCConverter.h" +#include namespace DeviceAPI { namespace NFC { @@ -90,7 +90,7 @@ const JSClassDefinition* JSNdefRecord::getClassInfo() { JSClassRef JSNdefRecord::m_jsClassRef = JSClassCreate(JSNdefRecord::getClassInfo()); JSObjectRef JSNdefRecord::createJSObject(JSContextRef context, const NdefRecordData &ndefRecordData) { - LogDebug("Entered"); + LoggerD("Entered"); return createJSObject(context, ndefRecordData.properties, ndefRecordData.payload); } @@ -114,24 +114,24 @@ JSObjectRef JSNdefRecord::createJSObject(JSContextRef context, INdefRecordPtr nd } void JSNdefRecord::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); } void JSNdefRecord::finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); NdefRecordPrivObject* priv = static_cast(JSObjectGetPrivate(object)); if (priv) { INdefRecordPtr ndefRecord = priv->getObject(); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting ndefrecord object"); + LoggerD("Deleting ndefrecord object"); delete priv; } else - LogDebug("priv null"); + LoggerD("priv null"); } JSObjectRef JSNdefRecord::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { ArgumentValidator validator(ctx, argumentCount, arguments); @@ -167,24 +167,24 @@ JSObjectRef JSNdefRecord::constructor(JSContextRef ctx, JSObjectRef constructor, *exception = error; return error; } Catch(ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); *exception = error; return error; } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -193,7 +193,7 @@ JSObjectRef JSNdefRecord::constructor(JSContextRef ctx, JSObjectRef constructor, JSValueRef JSNdefRecord::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NFCConverter convert(context); @@ -203,7 +203,7 @@ JSValueRef JSNdefRecord::getProperty(JSContextRef context, JSObjectRef object, } INdefRecordPtr ndefRecord = priv->getObject(); - LogDebug("propertyName : " << convert.toString(propertyName)); + LoggerD("propertyName : " << convert.toString(propertyName)); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_TNF)) return convert.toJSValueRef(ndefRecord->getTNF()); else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_TYPE)) @@ -213,15 +213,15 @@ JSValueRef JSNdefRecord::getProperty(JSContextRef context, JSObjectRef object, else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_PAYLOAD)) return convert.toJSValueRef(ndefRecord->getPayload()); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/NFC/JSNdefRecordMedia.cpp b/src/NFC/JSNdefRecordMedia.cpp index c5bf8f9..d7f4d28 100644 --- a/src/NFC/JSNdefRecordMedia.cpp +++ b/src/NFC/JSNdefRecordMedia.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include @@ -30,9 +28,9 @@ #include #include "NFCFactory.h" - #include "JSNdefRecordMedia.h" #include "NFCConverter.h" +#include namespace DeviceAPI { namespace NFC { @@ -103,16 +101,16 @@ JSObjectRef JSNdefRecordMedia::createJSObject(JSContextRef context, INdefRecordP } void JSNdefRecordMedia::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); } void JSNdefRecordMedia::finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); } JSObjectRef JSNdefRecordMedia::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { ArgumentValidator validator(ctx, argumentCount, arguments); @@ -136,24 +134,24 @@ JSObjectRef JSNdefRecordMedia::constructor(JSContextRef ctx, JSObjectRef constru *exception = error; return error; } Catch(ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); *exception = error; return error; } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -162,7 +160,7 @@ JSObjectRef JSNdefRecordMedia::constructor(JSContextRef ctx, JSObjectRef constru JSValueRef JSNdefRecordMedia::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NFCConverter convert(context); @@ -176,22 +174,22 @@ JSValueRef JSNdefRecordMedia::getProperty(JSContextRef context, JSObjectRef obje if (ndefRecord->getMimeType(&mimeType)) { std::string result(mimeType); free(mimeType); - LogDebug("mimeType : " << result); + LoggerD("mimeType : " << result); return convert.toJSValueRef(result); } - LogDebug("This record is not MEDIA Type"); + LoggerD("This record is not MEDIA Type"); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/NFC/JSNdefRecordText.cpp b/src/NFC/JSNdefRecordText.cpp index 9212ade..341f7de 100644 --- a/src/NFC/JSNdefRecordText.cpp +++ b/src/NFC/JSNdefRecordText.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -30,9 +29,9 @@ #include #include "NFCFactory.h" - #include "JSNdefRecordText.h" #include "NFCConverter.h" +#include namespace DeviceAPI { namespace NFC { @@ -107,16 +106,16 @@ JSObjectRef JSNdefRecordText::createJSObject(JSContextRef context, INdefRecordPt } void JSNdefRecordText::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); } void JSNdefRecordText::finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); } JSObjectRef JSNdefRecordText::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { ArgumentValidator validator(ctx, argumentCount, arguments); @@ -143,24 +142,24 @@ JSObjectRef JSNdefRecordText::constructor(JSContextRef ctx, JSObjectRef construc *exception = error; return error; } Catch(ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); *exception = error; return error; } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -168,7 +167,7 @@ JSObjectRef JSNdefRecordText::constructor(JSContextRef ctx, JSObjectRef construc } JSValueRef JSNdefRecordText::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { NFCConverter convert(context); @@ -183,38 +182,38 @@ JSValueRef JSNdefRecordText::getProperty(JSContextRef context, JSObjectRef objec if (ndefRecord->getText(&text)) { std::string result(text); free(text); - LogDebug("text : " << result); + LoggerD("text : " << result); return convert.toJSValueRef(result); } - LogDebug("This record is not Text Type"); + LoggerD("This record is not Text Type"); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_TEXT_LANGCODE)) { char * langCode = NULL; if (ndefRecord->getLangCode(&langCode)) { std::string result(langCode); free(langCode); - LogDebug("langCode : " << result); + LoggerD("langCode : " << result); return convert.toJSValueRef(result); } - LogDebug("This record is not Text Type"); + LoggerD("This record is not Text Type"); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_TEXT_ENCODING)) { nfcTextEncodeUTF encodeType = NFC_TEXT_ENCODE_UTF_16; if (ndefRecord->getEncodeType(&encodeType)) { - LogDebug("encodeType : " << encodeType); + LoggerD("encodeType : " << encodeType); return convert.toJSValueRef(convert.toNfcTextEncodeUTFString(encodeType)); } - LogDebug("This record is not Text Type"); + LoggerD("This record is not Text Type"); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/NFC/JSNdefRecordURI.cpp b/src/NFC/JSNdefRecordURI.cpp index b67ba88..489c13c 100644 --- a/src/NFC/JSNdefRecordURI.cpp +++ b/src/NFC/JSNdefRecordURI.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -32,6 +31,7 @@ #include "NFCFactory.h" #include "JSNdefRecordURI.h" +#include namespace DeviceAPI { namespace NFC { @@ -83,11 +83,11 @@ const JSClassDefinition* JSNdefRecordURI::getClassInfo() { JSClassRef JSNdefRecordURI::m_jsClassRef = JSClassCreate(JSNdefRecordURI::getClassInfo()); void JSNdefRecordURI::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); } void JSNdefRecordURI::finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); } JSObjectRef JSNdefRecordURI::createJSObject(JSContextRef context, const NdefRecordProperties &ndefRecordProperties, std::vector payload) { @@ -111,7 +111,7 @@ JSObjectRef JSNdefRecordURI::createJSObject(JSContextRef context, INdefRecordPtr JSObjectRef JSNdefRecordURI::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { ArgumentValidator validator(ctx, argumentCount, arguments); @@ -129,24 +129,24 @@ JSObjectRef JSNdefRecordURI::constructor(JSContextRef ctx, JSObjectRef construct *exception = error; return error; } Catch(ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::SERVICE_NOT_AVAILABLE, "Service Not Available"); *exception = error; return error; } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -154,7 +154,7 @@ JSObjectRef JSNdefRecordURI::constructor(JSContextRef ctx, JSObjectRef construct } JSValueRef JSNdefRecordURI::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_NDEFRECORD_URI_URI)) { @@ -168,21 +168,21 @@ JSValueRef JSNdefRecordURI::getProperty(JSContextRef context, JSObjectRef object Converter convert(context); std::string result(uri); free(uri); - LogDebug("uri : " << result); + LoggerD("uri : " << result); return convert.toJSValueRef(result); } - LogDebug("This record is not URI Type"); + LoggerD("This record is not URI Type"); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/NFC/NFCAdapter.cpp b/src/NFC/NFCAdapter.cpp old mode 100755 new mode 100644 index a7aadcd..e8c0db5 --- a/src/NFC/NFCAdapter.cpp +++ b/src/NFC/NFCAdapter.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -23,13 +22,14 @@ #include "NFCDefaultAdapter.h" #include "NFCAdapter.h" #include "NFCUtil.h" +#include using namespace DPL; namespace DeviceAPI { namespace NFC { NFCAdapter::NFCAdapter() { - LogDebug("NFCAdapter"); + LoggerD("NFCAdapter"); if (!NFCDefaultAdapterSingleton::Instance().isSupported()) ThrowMsg(UnsupportedException, "Not Support"); @@ -40,14 +40,14 @@ NFCAdapter::NFCAdapter() { } NFCAdapter::~NFCAdapter() { - LogDebug("Enter"); + LoggerD("Enter"); unsetTagListener(); unsetPeerListener(); m_EventNFCChangedSetPoweredPtr.Reset(); } int NFCAdapter::setTagListener(const EventNFCChangedEmitterPtr& emitter, const TagFilterPtr& filter) { - LogDebug(" NFCAdapter::setTagListener Entered"); + LoggerD(" NFCAdapter::setTagListener Entered"); if (m_NFCTagEmitterPtr.Get() != NULL) ThrowMsg(PlatformException, "It has already set Tag Listener"); @@ -58,7 +58,7 @@ int NFCAdapter::setTagListener(const EventNFCChangedEmitterPtr& emitter, const T } int NFCAdapter::setPeerListener(const EventNFCChangedEmitterPtr& emitter) { - LogDebug(" NFCAdapter::setPeerListener Entered"); + LoggerD(" NFCAdapter::setPeerListener Entered"); if (m_NFCTargetEmitterPtr.Get() != NULL) ThrowMsg(PlatformException, "It has already set Peer Listener"); @@ -67,14 +67,14 @@ int NFCAdapter::setPeerListener(const EventNFCChangedEmitterPtr& emitter) { return NFCDefaultAdapterSingleton::Instance().setPeerListener(this); } void NFCAdapter::unsetTagListener() { - LogDebug(" NFCAdapter::unsetTagListener Entered"); + LoggerD(" NFCAdapter::unsetTagListener Entered"); m_NFCTagEmitterPtr.Reset(); m_tagFilter.Reset(); NFCDefaultAdapterSingleton::Instance().unsetTagListener(this); } void NFCAdapter::unsetPeerListener() { - LogDebug(" NFCAdapter::unsetPeerListener Entered"); + LoggerD(" NFCAdapter::unsetPeerListener Entered"); m_NFCTargetEmitterPtr.Reset(); NFCDefaultAdapterSingleton::Instance().unsetPeerListener(this); } @@ -86,7 +86,7 @@ void NFCAdapter::NFCTagHasDetected(void *props) nfc_tag_type_e tagType; if (nfc_tag_get_type((nfc_tag_h)props, &tagType) == NFC_ERROR_NONE) { - LogDebug("NFCAdapter::NFCTagHasDetected Tag real type : " << tagType); + LoggerD("NFCAdapter::NFCTagHasDetected Tag real type : " << tagType); int cnt; for (cnt = 0; cnt < m_tagFilter->getFilterSize(); cnt++) { NFCUtil util; @@ -94,11 +94,11 @@ void NFCAdapter::NFCTagHasDetected(void *props) break; } if (cnt == m_tagFilter->getFilterSize()) { - LogDebug("Filter doesn't have this tag type "); + LoggerD("Filter doesn't have this tag type "); return; } } else { - LogDebug("It can't get real nfc tag type"); + LoggerD("It can't get real nfc tag type"); int cnt; for (cnt = 0; cnt < m_tagFilter->getFilterSize(); cnt++) { if (NFC_TAGTYPE_GENERIC_PICC == m_tagFilter->getFilterValue(cnt)) @@ -106,7 +106,7 @@ void NFCAdapter::NFCTagHasDetected(void *props) } if (cnt == m_tagFilter->getFilterSize()) { - LogDebug("Filter doesn't have this tag type "); + LoggerD("Filter doesn't have this tag type "); return; } @@ -120,7 +120,7 @@ void NFCAdapter::NFCTagHasDetected(void *props) event->setNFCProperties(props); event->setNFCType(NFC_TAG_TYPE); - LogDebug("emit event with nfc tag info"); + LoggerD("emit event with nfc tag info"); m_NFCTagEmitterPtr->emit(event); } } @@ -135,7 +135,7 @@ void NFCAdapter::NFCTargetHasDetected(void *props) event->setNFCStatus(NFC_ATTATCHED); event->setNFCProperties(props); event->setNFCType(NFC_TARGET_TYPE); - LogDebug("emit event with nfc target info"); + LoggerD("emit event with nfc target info"); m_NFCTargetEmitterPtr->emit(event); } } @@ -149,7 +149,7 @@ bool NFCAdapter::getPowerState() { } void NFCAdapter::setPowered(const EventNFCChangedSetPoweredPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); EventRequestReceiver::PostRequest(event); } @@ -171,13 +171,13 @@ void NFCAdapter::OnRequestReceived(const EventNFCChangedSetPoweredPtr& event) { NFCDefaultAdapterSingleton::Instance().setPowered(event->getState(), this); return; } Catch(PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); event->setResult(false); event->setError(DeviceAPI::Common::JSTizenException::SERVICE_NOT_AVAILABLE); event->setErrorMessage("Progressing Identical Operation"); EventRequestReceiver::ManualAnswer(event); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); setPoweredManualAnswer(NFC_ERROR_OPERATION_FAILED); } } diff --git a/src/NFC/NFCConverter.cpp b/src/NFC/NFCConverter.cpp old mode 100755 new mode 100644 index 7994cb1..c8723dc --- a/src/NFC/NFCConverter.cpp +++ b/src/NFC/NFCConverter.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - - -#include #include #include #include @@ -28,6 +25,7 @@ #include "JSNdefRecordURI.h" #include "JSNdefRecordMedia.h" #include "JSNdefMessage.h" +#include using namespace std; using namespace WrtDeviceApis::CommonsJavaScript; @@ -46,19 +44,19 @@ vector NFCConverter::m_allowedTagFilterProperties; NFCConverter::NFCConverter(JSContextRef context) : Converter(context) { - LogDebug("entered"); + LoggerD("entered"); static bool init = initializeAllowedProperties(); (void) init; } NFCConverter::~NFCConverter() { - LogDebug("entered"); + LoggerD("entered"); } TagFilterPtr NFCConverter::toNFCTagFilter(JSValueRef jsValue) { - LogDebug("entered"); + LoggerD("entered"); if (JSValueIsNull(m_context, jsValue) || JSValueIsUndefined(m_context, jsValue)) { return TagFilterPtr(); //empty filter @@ -68,15 +66,15 @@ TagFilterPtr NFCConverter::toNFCTagFilter(JSValueRef jsValue) if (!JSValueIsUndefined(m_context, jsValue)) { vector filter_values(toVectorOfStrings(jsValue)); - LogDebug("NFCConverter, start setting filter values, tag_types.size() : " << filter_values.size()); + LoggerD("NFCConverter, start setting filter values, tag_types.size() : " << filter_values.size()); for (unsigned int i=0; iaddTagTypeValue(filterValue); - LogDebug("NFCConverter, tag_types.at(i): " << filter_values.at(i)); + LoggerD("NFCConverter, tag_types.at(i): " << filter_values.at(i)); } } - LogDebug("NFCConverter, filter size == " << filter->getFilterSize()); + LoggerD("NFCConverter, filter size == " << filter->getFilterSize()); return filter; } @@ -197,7 +195,7 @@ std::string NFCConverter::toNfcTextEncodeUTFString(nfcTextEncodeUTF encode) { nfcTNF NFCConverter::toNfcTNF(const JSValueRef& arg) { long value = toLong(arg); - LogDebug("toNfcTNF, value == " << value); + LoggerD("toNfcTNF, value == " << value); if ((value < NFC_TNF_EMPTY) || (value > NFC_TNF_UNCHANGED)) { ThrowMsg(InvalidArgumentException, "It is not a correct tnf value"); @@ -208,7 +206,7 @@ nfcTNF NFCConverter::toNfcTNF(const JSValueRef& arg) { bool NFCConverter::initializeAllowedProperties() { - LogDebug("entered"); + LoggerD("entered"); //NFC Filter properties m_allowedTagFilterProperties.push_back(NFC_FILTER_ATTRIBUTE_TAG_TYPES); return true; @@ -274,9 +272,9 @@ JSValueRef NFCConverter::toJSNdefRecordArray(INdefMessagePtr ndefMessage) { } bool NFCConverter::isNdefRecord(const JSValueRef& arg) { - LogDebug("Entered"); + LoggerD("Entered"); if (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, arg)) { - LogDebug("Object is Null or Undefied"); + LoggerD("Object is Null or Undefied"); return false; } if (JSValueIsObjectOfClass(m_context, arg, JSNdefRecord::getClassRef()) @@ -301,7 +299,7 @@ std::vector NFCConverter::toVectorOfRecordHandles(const JSValueRef& arg) JSObjectRef obj = toJSObjectRef(arg); if (!obj) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Object is null"); } @@ -336,7 +334,7 @@ std::string NFCConverter::toRecordClassName(NdefRecordData arg) { } void *NFCConverter::getRecordHandle(const JSValueRef& arg) { - LogDebug("Entered"); + LoggerD("Entered"); if (!isNdefRecord(arg)) { ThrowMsg(Commons::ConversionException, "Message is JS null or JS undefined."); @@ -344,12 +342,12 @@ void *NFCConverter::getRecordHandle(const JSValueRef& arg) { JSObjectRef obj = toJSObjectRef(arg); if (!obj) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Object is null"); } NdefRecordPrivObject* privateObject = static_cast(JSObjectGetPrivate(obj)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not set"); } @@ -367,7 +365,7 @@ void *NFCConverter::copiedMessage(const JSValueRef& arg) { JSObjectRef obj = toJSObjectRef(arg); if (!obj) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Object is null"); } return copiedMessage(obj); @@ -376,7 +374,7 @@ void *NFCConverter::copiedMessage(const JSValueRef& arg) { void *NFCConverter::copiedMessage(const JSObjectRef& obj) { NdefMessagePrivObject* privateObject = static_cast(JSObjectGetPrivate(obj)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object is not set"); } @@ -386,7 +384,7 @@ void *NFCConverter::copiedMessage(const JSObjectRef& obj) { } NFCChangedCallback NFCConverter::toNFCChangedCallback(const JSValueRef& arg) { - LogDebug("Entered"); + LoggerD("Entered"); JSObjectRef object = toJSObjectRef(arg); NFCChangedCallback result; diff --git a/src/NFC/NFCDefaultAdapter.cpp b/src/NFC/NFCDefaultAdapter.cpp old mode 100755 new mode 100644 index 35de650..2180c32 --- a/src/NFC/NFCDefaultAdapter.cpp +++ b/src/NFC/NFCDefaultAdapter.cpp @@ -15,7 +15,7 @@ // limitations under the License. // -#include +#include #include #include #include @@ -23,7 +23,7 @@ #include #include "NFCDefaultAdapter.h" #include "NFCUtil.h" - +#include using namespace DPL; IMPLEMENT_SINGLETON(DeviceAPI::NFC::NFCDefaultAdapter) @@ -34,7 +34,7 @@ namespace NFC { namespace { static void TagDetectedCallback(nfc_discovered_type_e type, nfc_tag_h tag, void *data) { - LogDebug("Callback TagDetectedCallback."); + LoggerD("Callback TagDetectedCallback."); if (data) { if (NFC_DISCOVERED_TYPE_ATTACHED == type) { @@ -43,13 +43,13 @@ namespace (static_cast(data))->NFCTagHasDetected(NULL); } } else { - LogError("Callback private data is NULL."); + LoggerE("Callback private data is NULL."); } } static void TargetDetectedCallback(nfc_discovered_type_e type, nfc_p2p_target_h target, void *data) { - LogDebug("Callback TargetDetectedCallback."); + LoggerD("Callback TargetDetectedCallback."); if (data) { if (NFC_DISCOVERED_TYPE_ATTACHED == type) { @@ -58,17 +58,17 @@ namespace (static_cast(data))->NFCTargetHasDetected(NULL); } } else { - LogError("Callback private data is NULL."); + LoggerE("Callback private data is NULL."); } } static void NFCInitializeCompletedCallback(nfc_error_e result, void *user_data) { - LogDebug("Callback NFCInitializeCompletedCallback. result : " << (int)result); + LoggerD("Callback NFCInitializeCompletedCallback. result : " << (int)result); if (user_data && (result == NFC_ERROR_NONE)) (static_cast(user_data))->getCurrentNFC(); } static void NFCSetActivationCompletedCallback(nfc_error_e error, void *user_data) { - LogDebug("Callback NFCSetActivationCompletedCallback."); + LoggerD("Callback NFCSetActivationCompletedCallback."); NFCDefaultAdapterSingleton::Instance().setPoweredManualAnswer(error); } @@ -76,7 +76,7 @@ namespace NFCDefaultAdapter::NFCDefaultAdapter() :m_initialized(false) { - LogDebug("NFC Enter"); + LoggerD("NFC Enter"); m_NFCTagListeners.clear(); m_NFCTargetListeners.clear(); @@ -84,13 +84,13 @@ NFCDefaultAdapter::NFCDefaultAdapter() } NFCDefaultAdapter::~NFCDefaultAdapter() { - LogDebug("Enter"); + LoggerD("Enter"); deinitialze(); } void NFCDefaultAdapter::setExclusiveMode(bool mode) { - LogDebug("Enter"); - LogDebug("initilized:" << m_initialized); + LoggerD("Enter"); + LoggerD("initilized:" << m_initialized); if (!m_initialized) { if (nfc_manager_initialize_sync() != NFC_ERROR_NONE) { @@ -106,11 +106,11 @@ void NFCDefaultAdapter::setExclusiveMode(bool mode) { */ } bool bEnabled = !mode; - LogDebug("system handeler enable?" << bEnabled); + LoggerD("system handeler enable?" << bEnabled); // If exclusive mode is true, system handler has to be disabled. if (nfc_manager_set_system_handler_enable(bEnabled) != NFC_ERROR_NONE) ThrowMsg(UnknownException, "Failed to set exclusive mode."); - LogDebug("End"); + LoggerD("End"); } bool NFCDefaultAdapter::isSupported() { @@ -118,7 +118,7 @@ bool NFCDefaultAdapter::isSupported() { } void NFCDefaultAdapter::deinitialze() { - LogDebug("Enter"); + LoggerD("Enter"); int result = -1; m_NFCTagListeners.clear(); @@ -134,23 +134,23 @@ void NFCDefaultAdapter::deinitialze() { { result = nfc_manager_deinitialize (); if (result !=NFC_ERROR_NONE) { - LogInfo("failed to deinitialize nfc"); + LoggerI("failed to deinitialize nfc"); } } m_initialized = false; - LogDebug("destroy nfc"); + LoggerD("destroy nfc"); } void NFCDefaultAdapter::unsetExclusiveMode() { - LogDebug("entered"); + LoggerD("entered"); if (m_initialized) if (nfc_manager_set_system_handler_enable(true) != NFC_ERROR_NONE) - LogDebug("failed to unset exclusive mode"); + LoggerD("failed to unset exclusive mode"); } int NFCDefaultAdapter::setTagListener(NFCAdapter * adapter) { - LogDebug(" NFCDefaultAdapter::setTagListener Entered"); + LoggerD(" NFCDefaultAdapter::setTagListener Entered"); int result = -1; m_NFCTagListeners.push_back(adapter); @@ -178,12 +178,12 @@ int NFCDefaultAdapter::setTagListener(NFCAdapter * adapter) { util.throwNFCException(result, "failed to set callback of nfc_manager_set_tag_discovered_cb"); } - LogInfo("NFCDefaultAdapter::setTagListener : result << " << result); + LoggerI("NFCDefaultAdapter::setTagListener : result << " << result); return result; } int NFCDefaultAdapter::setPeerListener(NFCAdapter *adapter) { - LogDebug(" NFCDefaultAdapter::setPeerListener Entered"); + LoggerD(" NFCDefaultAdapter::setPeerListener Entered"); int result = -1; m_NFCTargetListeners.push_back(adapter); @@ -210,12 +210,12 @@ int NFCDefaultAdapter::setPeerListener(NFCAdapter *adapter) { Util.throwNFCException(result, "failed to set callback of nfc_manager_set_p2p_target_discovered_cb"); } - LogInfo("NFCDefaultAdapter::setPeerListener : result << " << result); + LoggerI("NFCDefaultAdapter::setPeerListener : result << " << result); return result; } void NFCDefaultAdapter::unsetTagListener(NFCAdapter * adapter) { - LogDebug(" NFCDefaultAdapter::unsetTagListener Entered"); + LoggerD(" NFCDefaultAdapter::unsetTagListener Entered"); if (!m_initialized) { m_NFCTagListeners.clear(); @@ -226,7 +226,7 @@ void NFCDefaultAdapter::unsetTagListener(NFCAdapter * adapter) { for (it = m_NFCTagListeners.begin(); it != m_NFCTagListeners.end(); ++it) { if (*it == adapter) { m_NFCTagListeners.erase(it); - LogDebug("emitter is removed. (" << m_NFCTagListeners.size() << ")"); + LoggerD("emitter is removed. (" << m_NFCTagListeners.size() << ")"); break; } } @@ -236,7 +236,7 @@ void NFCDefaultAdapter::unsetTagListener(NFCAdapter * adapter) { } void NFCDefaultAdapter::unsetPeerListener(NFCAdapter * adapter) { - LogDebug(" NFCDefaultAdapter::unsetPeerListener Entered"); + LoggerD(" NFCDefaultAdapter::unsetPeerListener Entered"); if (!m_initialized) { m_NFCTagListeners.clear(); @@ -247,7 +247,7 @@ void NFCDefaultAdapter::unsetPeerListener(NFCAdapter * adapter) { for (it = m_NFCTargetListeners.begin(); it != m_NFCTargetListeners.end(); ++it) { if (*it == adapter) { m_NFCTargetListeners.erase(it); - LogDebug("emitter is removed. (" << m_NFCTargetListeners.size() << ")"); + LoggerD("emitter is removed. (" << m_NFCTargetListeners.size() << ")"); break; } } @@ -259,7 +259,7 @@ void NFCDefaultAdapter::unsetPeerListener(NFCAdapter * adapter) { void NFCDefaultAdapter::NFCTagHasDetected(void *props) { - LogDebug("NFCDefaultAdapter::NFCTagHasDetected Enter type"); + LoggerD("NFCDefaultAdapter::NFCTagHasDetected Enter type"); std::vector::iterator it; for (it = m_NFCTagListeners.begin(); it != m_NFCTagListeners.end(); ++it) { @@ -276,10 +276,10 @@ void NFCDefaultAdapter::NFCTargetHasDetected(void *props) } void NFCDefaultAdapter::getCurrentNFC() { - LogDebug("Enter"); + LoggerD("Enter"); if (!m_initialized) { - LogError("No Initialized"); + LoggerE("No Initialized"); return; } @@ -300,12 +300,12 @@ void NFCDefaultAdapter::getCurrentNFC() { } int NFCDefaultAdapter::initialize() { - LogDebug("NFCDefaultAdapter::initialize Entered"); + LoggerD("NFCDefaultAdapter::initialize Entered"); int result = -1; //nfc_manager_deinitialize(); result = nfc_manager_initialize(NFCInitializeCompletedCallback, this); if (result != NFC_ERROR_NONE) { - LogError("Could not initialize NFC."); + LoggerE("Could not initialize NFC."); m_initialized = false; } else { m_initialized = true; @@ -314,7 +314,7 @@ int NFCDefaultAdapter::initialize() { } void *NFCDefaultAdapter::getCachedMessage() { - LogDebug("Entered"); + LoggerD("Entered"); nfc_ndef_message_h messageHandle = NULL; int result = nfc_manager_get_cached_message(&messageHandle); if ((result == NFC_ERROR_INVALID_NDEF_MESSAGE) || (result == NFC_ERROR_NO_NDEF_MESSAGE)) { @@ -336,7 +336,7 @@ bool NFCDefaultAdapter::getPowerState() { } void NFCDefaultAdapter::setPowered(const bool state, NFCAdapter * poweredAdapter) { - LogDebug("Enter"); + LoggerD("Enter"); try { if (m_poweredAdapter != NULL) { ThrowMsg(PlatformException, "Progressing Identical Operation"); @@ -360,7 +360,7 @@ void NFCDefaultAdapter::setPowered(const bool state, NFCAdapter * poweredAdapter m_poweredAdapter = NULL; } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); poweredAdapter->setPoweredManualAnswer(NFC_ERROR_OPERATION_FAILED); m_poweredAdapter = NULL; } diff --git a/src/NFC/NFCListenerManager.h b/src/NFC/NFCListenerManager.h old mode 100755 new mode 100644 index 5702396..628df15 --- a/src/NFC/NFCListenerManager.h +++ b/src/NFC/NFCListenerManager.h @@ -21,12 +21,12 @@ #include #include -#include #include #include #include #include "JSNFCAdapter.h" #include "JSNFCTarget.h" +#include namespace DeviceAPI { namespace NFC { @@ -65,14 +65,14 @@ public: virtual void cancelListener() { - LogDebug("context : " << m_context); - LogDebug("object : " << m_object); + LoggerD("context : " << m_context); + LoggerD("object : " << m_object); switch(m_watchId) { case ID_NFCPEER_RECEIVENDEF_LISTENER: { NFCTargetPrivObject* privateObject = static_cast(JSObjectGetPrivate(m_object)); if (NULL == privateObject) { - LogWarning("Object has no privateObject"); + LoggerW("Object has no privateObject"); return; } @@ -85,7 +85,7 @@ public: { NFCAdapterPrivObject* privateObject = static_cast(JSObjectGetPrivate(m_object)); if (NULL == privateObject) { - LogError("Object has no privateObject"); + LoggerE("Object has no privateObject"); return; } Try { @@ -95,13 +95,13 @@ public: else nfcAdapter->unsetPeerListener(); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } break; } default: - LogError("Wrong ID"); + LoggerE("Wrong ID"); } } }; diff --git a/src/NFC/NFCStaticController.cpp b/src/NFC/NFCStaticController.cpp old mode 100755 new mode 100644 index 40b2e8c..0950191 --- a/src/NFC/NFCStaticController.cpp +++ b/src/NFC/NFCStaticController.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include @@ -33,6 +31,7 @@ #include "JSNFCTarget.h" #include "NFCConverter.h" #include "NFCAsyncCallbackManager.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::CommonsJavaScript; @@ -52,7 +51,7 @@ NFCStaticController::NFCStaticController() : } void NFCStaticController::onAnswerReceived(const EventNFCChangedPtr& event) { - LogDebug("onAnswerReceived Enter"); + LoggerD("onAnswerReceived Enter"); EventNFCChangedPrivateDataPtr privateData = DPL::DynamicPointerCast(event->getPrivateData()); @@ -72,7 +71,7 @@ void NFCStaticController::onAnswerReceived(const EventNFCChangedPtr& event) { nfcObj = JSNFCTag::createJSObject(context, nfcProp); else nfcObj = JSNFCTarget::createJSObject(context, nfcProp); - LogDebug("callOnSuccess"); + LoggerD("callOnSuccess"); callbackManager->callOnSuccess(static_cast(nfcObj)); } else { JSCallbackManagerPtr detachedCallbackManager = privateData->getDetachedCallbackManager(); @@ -80,13 +79,13 @@ void NFCStaticController::onAnswerReceived(const EventNFCChangedPtr& event) { detachedCallbackManager->callOnSuccess(); } } Catch (ConversionException) { - LogError("Conversion exception while processing EventNFCChanged"); + LoggerE("Conversion exception while processing EventNFCChanged"); } Catch (PlatformException) { - LogError("PlatformException:Platform can't create NFCTag" << _rethrown_exception.GetMessage()); + LoggerE("PlatformException:Platform can't create NFCTag" << _rethrown_exception.GetMessage()); } Catch (UnknownException) { - LogError("UnknownException:Platform can't create NFCTag" << _rethrown_exception.GetMessage()); + LoggerE("UnknownException:Platform can't create NFCTag" << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointer exception while processing EventNFCChanged"); + LoggerE("NullPointer exception while processing EventNFCChanged"); } } @@ -98,16 +97,16 @@ void NFCStaticController::OnAnswerReceived(const EventNFCChangedSetPoweredPtr &e Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); JSValueRef errorObject; @@ -120,15 +119,15 @@ void NFCStaticController::OnAnswerReceived(const EventNFCChangedSetPoweredPtr &e errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } Catch (PlatformException) { - LogError("PlatformException" << _rethrown_exception.GetMessage()); + LoggerE("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()); + LoggerE("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()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } diff --git a/src/NFC/NFCTag.cpp b/src/NFC/NFCTag.cpp old mode 100755 new mode 100644 index a05f153..8f60f34 --- a/src/NFC/NFCTag.cpp +++ b/src/NFC/NFCTag.cpp @@ -15,16 +15,12 @@ // limitations under the License. // - - - -#include - #include #include #include "NFCTag.h" #include "NFCUtil.h" +#include namespace DeviceAPI { namespace NFC { @@ -38,29 +34,29 @@ namespace * @param this_ User data pointer. */ static bool TagInformationCallback(const char *key, const unsigned char *value, int value_size, void *user_data) { - LogDebug("Callback TagInformationCallback."); + LoggerD("Callback TagInformationCallback."); if (user_data) { NFCUtil util; std::vector tagInfo = util.toVector(value, value_size); (static_cast(user_data))->makeTagProperties(key, tagInfo); return TRUE; } - LogDebug("Error! TagInformationCallback is Null."); + LoggerD("Error! TagInformationCallback is Null."); return false; } static void TagReadCallback(nfc_error_e result , nfc_ndef_message_h message , void * data) { - LogDebug("Callback TagReadCallback."); + LoggerD("Callback TagReadCallback."); if (data) { NFCTag *tagPtr = (NFCTag *)((EventNFCPtrs *)data)->getThisPtr(); if (tagPtr) { EventTagActionReadPtr event = ((EventNFCPtrs *)data)->getEventPtrs(); - LogDebug("message handler :" << message); + LoggerD("message handler :" << message); unsigned char *rawdata = NULL; int size; if (nfc_ndef_message_get_rawdata(message, &rawdata, &size) != NFC_ERROR_NONE) { - LogError("Can't get record's rawdata"); + LoggerE("Can't get record's rawdata"); if (rawdata) free(rawdata); return; @@ -74,43 +70,43 @@ namespace } } else { - LogDebug("Error! TagReadCallback is Null."); + LoggerD("Error! TagReadCallback is Null."); } } static void TagWriteCallback(nfc_error_e result, void *data) { - LogDebug("Callback TagWriteCallback."); + LoggerD("Callback TagWriteCallback."); if (data) { ((NFCTag *)data)->writeNdefManualAnswer((int)result); } else { - LogDebug("Error! TagWriteCallback is Null."); + LoggerD("Error! TagWriteCallback is Null."); } } static void TagTransceiveCallback(nfc_error_e result, unsigned char *buffer, int buffer_size, void *data) { - LogDebug("Callback TagTransceiveCallback."); + LoggerD("Callback TagTransceiveCallback."); if (data) { NFCUtil util; std::vector responseData = util.toVector(buffer, buffer_size) ; ((NFCTag *)data)->transceiveManualAnswer((int)result, responseData); } else { - LogDebug("Error! TagTransceiveCallback is Null."); + LoggerD("Error! TagTransceiveCallback is Null."); } } static void TagFormatCallback(nfc_error_e result, void *data) { - LogDebug("Callback TagFormatCallback."); + LoggerD("Callback TagFormatCallback."); if (data) { ((NFCTag *)data)->formatManualAnswer((int)result); } else { - LogDebug("Error! TagFormatCallback is Null."); + LoggerD("Error! TagFormatCallback is Null."); } } }//private namespace NFCTag::NFCTag(void *tagHandle) { - LogDebug("entered"); + LoggerD("entered"); handle = (nfc_tag_h)tagHandle; @@ -121,7 +117,7 @@ NFCTag::NFCTag(void *tagHandle) NFCTag::~NFCTag() { - LogDebug("entered"); + LoggerD("entered"); handle = NULL; } @@ -166,7 +162,7 @@ long NFCTag::getNdefSize(){ return static_cast(ndefSize); } std::vector NFCTag::getProperties() { - LogDebug("Enter"); + LoggerD("Enter"); props.clear(); int result = nfc_tag_foreach_information(handle, TagInformationCallback, this); @@ -185,7 +181,7 @@ void NFCTag::makeTagProperties(const char *key, std::vector &valu } void NFCTag::readNdef(const EventTagActionReadPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); if (!isNDEFSupport()) ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Not Support NDEF"); @@ -193,7 +189,7 @@ void NFCTag::readNdef(const EventTagActionReadPtr& event) { } void NFCTag::writeNdef(const EventTagActionWritePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); if (!isNDEFSupport()) ThrowMsg(WrtDeviceApis::Commons::UnsupportedException, "Not Support NDEF"); @@ -206,7 +202,7 @@ void NFCTag::writeNdef(const EventTagActionWritePtr& event) { } void NFCTag::transceive(const EventTagActionTransceivePtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTagActionTransceivePtr.Get() != NULL) EventTagActionTransceives.push_back(event); @@ -215,13 +211,13 @@ void NFCTag::transceive(const EventTagActionTransceivePtr& event) { } void NFCTag::format(const EventTagActionFormatPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); EventRequestReceiver::PostRequest(event); } void NFCTag::readNdefManualAnswer(int result, std::vector &data, const EventTagActionReadPtr &event) { - LogDebug("Enter"); + LoggerD("Enter"); if ((nfc_error_e)result == NFC_ERROR_NONE) { event->setResult(TRUE); event->setReadNdefResult(data); @@ -237,7 +233,7 @@ void NFCTag::readNdefManualAnswer(int result, std::vector &data, for (it = EventTagActionsReads.begin(); it != EventTagActionsReads.end(); ++it) { if ((*it)->getEventPtrs() == event) { EventTagActionsReads.erase(it); - LogDebug("event is removed. (" << EventTagActionsReads.size() << ")"); + LoggerD("event is removed. (" << EventTagActionsReads.size() << ")"); break; } } @@ -245,10 +241,10 @@ void NFCTag::readNdefManualAnswer(int result, std::vector &data, void NFCTag::writeNdefManualAnswer(int result) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTagActionWritePtr.Get() != NULL) { if (nfc_ndef_message_destroy(static_cast(m_EventTagActionWritePtr->getNdefForWriting())) != NFC_ERROR_NONE) - LogError("Can't destroy NdefMessage"); + LoggerE("Can't destroy NdefMessage"); if ((nfc_error_e)result == NFC_ERROR_NONE) { m_EventTagActionWritePtr->setResult(TRUE); @@ -264,7 +260,7 @@ void NFCTag::writeNdefManualAnswer(int result) if (EventTagActionWrites.size() > 0) { EventTagActionWritePtr event = EventTagActionWrites.front(); EventTagActionWrites.erase(EventTagActionWrites.begin()); - LogDebug("EventTagActionWrites is removed. (" << EventTagActionWrites.size() << ")"); + LoggerD("EventTagActionWrites is removed. (" << EventTagActionWrites.size() << ")"); EventRequestReceiver::PostRequest(event); } } @@ -272,7 +268,7 @@ void NFCTag::writeNdefManualAnswer(int result) void NFCTag::transceiveManualAnswer(int result , std::vector &data) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTagActionTransceivePtr.Get() != NULL) { if ((nfc_error_e)result == NFC_ERROR_NONE) { m_EventTagActionTransceivePtr->setResult(TRUE); @@ -289,7 +285,7 @@ void NFCTag::transceiveManualAnswer(int result , std::vector &dat if (EventTagActionTransceives.size() > 0) { EventTagActionTransceivePtr event = EventTagActionTransceives.front(); EventTagActionTransceives.erase(EventTagActionTransceives.begin()); - LogDebug("EventTagActionWrites is removed. (" << EventTagActionTransceives.size() << ")"); + LoggerD("EventTagActionWrites is removed. (" << EventTagActionTransceives.size() << ")"); EventRequestReceiver::PostRequest(event); } } @@ -297,7 +293,7 @@ void NFCTag::transceiveManualAnswer(int result , std::vector &dat void NFCTag::formatManualAnswer(int result) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTagActionFormatPtr.Get() != NULL) { if ((nfc_error_e)result == NFC_ERROR_NONE) { m_EventTagActionFormatPtr->setResult(TRUE); @@ -313,7 +309,7 @@ void NFCTag::formatManualAnswer(int result) } void NFCTag::OnRequestReceived(const EventTagActionReadPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); try { event->switchToManualAnswer(); @@ -334,14 +330,14 @@ void NFCTag::OnRequestReceived(const EventTagActionReadPtr& event) { for (it = EventTagActionsReads.begin(); it != EventTagActionsReads.end(); ++it) { if ((*it)->getEventPtrs() == event) { EventTagActionsReads.erase(it); - LogDebug("event is removed. (" << EventTagActionsReads.size() << ")"); + LoggerD("event is removed. (" << EventTagActionsReads.size() << ")"); break; } } } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setResult(false); EventRequestReceiver::ManualAnswer(event); @@ -364,7 +360,7 @@ void NFCTag::OnRequestReceived(const EventTagActionWritePtr& event) { } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); if (event != m_EventTagActionWritePtr) m_EventTagActionWritePtr = event; @@ -392,7 +388,7 @@ void NFCTag::OnRequestReceived(const EventTagActionTransceivePtr& event) { } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); std::vector emptyData; transceiveManualAnswer(NFC_ERROR_OPERATION_FAILED, emptyData); @@ -415,7 +411,7 @@ void NFCTag::OnRequestReceived(const EventTagActionFormatPtr& event) { m_EventTagActionFormatPtr = event; NFCUtil util; - LogDebug("key size :" << event->getKeySize()); + LoggerD("key size :" << event->getKeySize()); unsigned char *key = util.toCharPtr(event->getKey()); int result = nfc_tag_format_ndef(handle, key, event->getKeySize(), TagFormatCallback, this); @@ -433,7 +429,7 @@ void NFCTag::OnRequestReceived(const EventTagActionFormatPtr& event) { } } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setResult(false); EventRequestReceiver::ManualAnswer(event); diff --git a/src/NFC/NFCTarget.cpp b/src/NFC/NFCTarget.cpp old mode 100755 new mode 100644 index 6adcc90..5a4231a --- a/src/NFC/NFCTarget.cpp +++ b/src/NFC/NFCTarget.cpp @@ -15,15 +15,10 @@ // limitations under the License. // - - - -#include - #include - #include "NFCTarget.h" #include "NFCUtil.h" +#include namespace DeviceAPI { namespace NFC { @@ -39,12 +34,12 @@ namespace * @param this_ User data pointer. */ static void TargetReceivedCallback(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data) { - LogDebug("Callback TargetReceivedCallback."); + LoggerD("Callback TargetReceivedCallback."); if (user_data) { unsigned char *rawdata = NULL; int size; if (nfc_ndef_message_get_rawdata(message, &rawdata, &size) != NFC_ERROR_NONE) { - LogError("Can't get rawdata of message"); + LoggerE("Can't get rawdata of message"); if (rawdata) free(rawdata); return; @@ -56,37 +51,37 @@ namespace free(rawdata); ((NFCTarget *)user_data)->receiveNdef(receiveData); } else { - LogDebug("Error! TargetReceivedCallback is Null."); + LoggerD("Error! TargetReceivedCallback is Null."); } } static void TargetSentCallback(nfc_error_e result, void *user_data) { - LogDebug("Callback TargetSentCallback."); + LoggerD("Callback TargetSentCallback."); if (user_data) { ((NFCTarget *)user_data)->sendNDEFManualAnswer((unsigned int)result); } else { - LogDebug("Error! TargetSentCallback is Null."); + LoggerD("Error! TargetSentCallback is Null."); } } }//private namespace NFCTarget::NFCTarget(void *targetHandle) { - LogDebug("entered"); + LoggerD("entered"); if (targetHandle == NULL) ThrowMsg(Commons::UnknownException, "Target Handler is Null Pointer."); handle = (nfc_p2p_target_h)targetHandle; - LogDebug("handle:"<&messageData) { - LogDebug("Enter"); + LoggerD("Enter"); if ((m_isSetReceiveListenter == true) && (m_emitter.Get() != NULL)) { EventTargetActionReceivePtr event(new EventTargetActionReceive()); event->setReadNdefResult(messageData); @@ -126,18 +121,18 @@ void NFCTarget::receiveNdef(std::vector&messageData) { } void NFCTarget::unsetReceiveNDEFListener() { - LogDebug("Enter"); + LoggerD("Enter"); if (m_isSetReceiveListenter == true) { nfc_p2p_unset_data_received_cb(handle); - LogDebug("Success to unset Listener"); + LoggerD("Success to unset Listener"); } else { - LogDebug("No set Listener"); + LoggerD("No set Listener"); } m_isSetReceiveListenter = false; } void NFCTarget::sendNDEF(const EventTargetActionSendPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTargetActionSendPtr.Get() != NULL) m_EventTargetActionSends.push_back(event); @@ -148,10 +143,10 @@ void NFCTarget::sendNDEF(const EventTargetActionSendPtr& event) { } void NFCTarget::sendNDEFManualAnswer(unsigned int result) { - LogDebug("Enter"); + LoggerD("Enter"); if (m_EventTargetActionSendPtr.Get() != NULL) { if (nfc_ndef_message_destroy(static_cast(m_EventTargetActionSendPtr->getMessageForSending())) != NFC_ERROR_NONE) - LogError("Can't destroy NdefMessage"); + LoggerE("Can't destroy NdefMessage"); if ((nfc_error_e)result == NFC_ERROR_NONE) { m_EventTargetActionSendPtr->setResult(TRUE); @@ -168,14 +163,14 @@ void NFCTarget::sendNDEFManualAnswer(unsigned int result) { if (m_EventTargetActionSends.size() > 0) { EventTargetActionSendPtr event = m_EventTargetActionSends.front(); m_EventTargetActionSends.erase(m_EventTargetActionSends.begin()); - LogDebug("m_EventTargetActionSends is removed. (" << m_EventTargetActionSends.size() << ")"); + LoggerD("m_EventTargetActionSends is removed. (" << m_EventTargetActionSends.size() << ")"); EventRequestReceiver::PostRequest(event); } } } void NFCTarget::OnRequestReceived(const EventTargetActionSendPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); try { event->switchToManualAnswer(); m_EventTargetActionSendPtr = event; @@ -189,7 +184,7 @@ void NFCTarget::OnRequestReceived(const EventTargetActionSendPtr& event) { sendNDEFManualAnswer(result); } } catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); if (event != m_EventTargetActionSendPtr) m_EventTargetActionSendPtr = event; sendNDEFManualAnswer(NFC_ERROR_OPERATION_FAILED); diff --git a/src/NFC/NFCUtil.cpp b/src/NFC/NFCUtil.cpp old mode 100755 new mode 100644 index 5a5fd9f..d7fed7c --- a/src/NFC/NFCUtil.cpp +++ b/src/NFC/NFCUtil.cpp @@ -15,14 +15,11 @@ // limitations under the License. // - - #include #include -#include #include - #include "NFCUtil.h" +#include namespace DeviceAPI { namespace NFC { @@ -35,9 +32,9 @@ std::vector NFCUtil::toVector(const unsigned char *ch, const int for (i = 0; i < size; i++) vec.push_back(ch[i]); - LogDebug("result:" << byteToString(ch, size)); + LoggerD("result:" << byteToString(ch, size)); } else - LogDebug("result: NULL"); + LoggerD("result: NULL"); return vec; } @@ -61,28 +58,28 @@ char *NFCUtil::byteToString(std::vector *buffer){ if (charBuf) { if (buffer->size() > 255) { memcpy(localbuffer, charBuf, 255); - LogDebug("size is " << buffer->size() << ". Too Big! It will copy some of data(255 bytes)"); + LoggerD("size is " << buffer->size() << ". Too Big! It will copy some of data(255 bytes)"); } else memcpy(localbuffer, charBuf, buffer->size()); free(charBuf); } else - LogDebug("Size is 0"); + LoggerD("Size is 0"); } else - LogDebug("Size is 0"); + LoggerD("Size is 0"); return localbuffer; } char *NFCUtil::byteToString(const unsigned char* buffer, const int size){ if (size > 255) - LogDebug("size is " << size << ". Too Big! It will copy some of data(255 bytes)"); + LoggerD("size is " << size << ". Too Big! It will copy some of data(255 bytes)"); static char localbuffer[256]; memset(localbuffer, 0, 256); if (size > 0) memcpy(localbuffer, buffer, size > 255 ? 255 : size); else - LogDebug("Size is 0"); + LoggerD("Size is 0"); return localbuffer; } @@ -186,9 +183,9 @@ NdefRecordData NFCUtil::getNDEFRecordData(void *handle) { result = nfc_ndef_record_get_payload(recordHandle, &payload, &payloadSize); throwNFCException(result, "Can't get record's payload"); - LogDebug("tnf : " <(tnf)); recordData.properties.typeName = toVector(typeName, typeSize); @@ -232,7 +229,7 @@ bool NFCUtil::copyNDEFRecord(void **src, void **dest) { } std::string NFCUtil::getNFCErrorString(const int errorCode) { - LogDebug ("Errorcode : " << errorCode); + LoggerD ("Errorcode : " << errorCode); switch(errorCode) { case NFC_ERROR_NONE: return ""; @@ -256,7 +253,7 @@ std::string NFCUtil::getNFCErrorString(const int errorCode) { } std::string NFCUtil::getNFCErrorMessage(const int errorCode) { - LogDebug ("Errorcode : " << errorCode); + LoggerD ("Errorcode : " << errorCode); switch(errorCode) { case NFC_ERROR_NONE: return ""; @@ -293,7 +290,7 @@ std::string NFCUtil::getNFCErrorMessage(const int errorCode) { } void NFCUtil::throwNFCException(const int errorCode, const std::string &message) { - LogDebug ("Errorcode : " << static_cast(errorCode)); + LoggerD ("Errorcode : " << static_cast(errorCode)); switch(errorCode) { case NFC_ERROR_NONE: diff --git a/src/NFC/NdefMessage.cpp b/src/NFC/NdefMessage.cpp old mode 100755 new mode 100644 index 4dbef30..97c42e7 --- a/src/NFC/NdefMessage.cpp +++ b/src/NFC/NdefMessage.cpp @@ -15,13 +15,10 @@ // limitations under the License. // - -#include - #include - #include "NdefMessage.h" #include "NFCUtil.h" +#include namespace DeviceAPI { namespace NFC { @@ -30,7 +27,7 @@ using namespace WrtDeviceApis::Commons; NdefMessage::NdefMessage() { - LogDebug("entered"); + LoggerD("entered"); recordPtr = NULL; NFCUtil util; int result = nfc_ndef_message_create(&handle); @@ -43,7 +40,7 @@ NdefMessage::NdefMessage() NdefMessage::NdefMessage(void *messageHandle) { - LogDebug("entered"); + LoggerD("entered"); recordPtr = NULL; if (messageHandle == NULL) { handle = NULL; @@ -55,7 +52,7 @@ NdefMessage::NdefMessage(void *messageHandle) NdefMessage::NdefMessage(std::vector &ndefRcords) { - LogDebug("entered"); + LoggerD("entered"); recordPtr = NULL; handle = NULL; handle = static_cast(makeMessage(ndefRcords)); @@ -63,14 +60,14 @@ NdefMessage::NdefMessage(std::vector &ndefRcords) NdefMessage::NdefMessage(const std::vector &rawdata) { - LogDebug("entered"); + LoggerD("entered"); recordPtr = NULL; handle = static_cast(makeMessage(rawdata)); } NdefMessage::~NdefMessage() { - LogDebug("entered"< &ndefRcords) { nfc_ndef_record_h insertRecord; if (!util.copyNDEFRecord(&ndefRcords[i], (void **)(&insertRecord))) { - LogDebug("copyNDEFRecord fail!"); + LoggerD("copyNDEFRecord fail!"); ThrowMsg(UnknownException, "Can't copy Record"); } result = nfc_ndef_message_append_record(message, insertRecord); if (result != NFC_ERROR_NONE) { - LogError(i << " record can't be inserted. " << insertRecord << " : " << message); + LoggerE(i << " record can't be inserted. " << insertRecord << " : " << message); nfc_ndef_message_destroy(message); util.throwNFCException(result, "Can't insert record in Ndef Message"); } @@ -122,12 +119,12 @@ void *NdefMessage::makeMessage(const std::vector &rawdata) { } void NdefMessage::setRecordesPtr(void *records) { - LogDebug("entered"<(count); } @@ -159,7 +156,7 @@ std::vector NdefMessage::toByte() { free(rawdata); util.throwNFCException(result, "Can't get serial bytes of NDEF message"); } - LogDebug(rawdata); + LoggerD(rawdata); std::vector byteData = util.toVector(rawdata, size); if (rawdata) free(rawdata); diff --git a/src/NFC/NdefRecord.cpp b/src/NFC/NdefRecord.cpp old mode 100755 new mode 100644 index e459bf4..513468c --- a/src/NFC/NdefRecord.cpp +++ b/src/NFC/NdefRecord.cpp @@ -15,14 +15,10 @@ // limitations under the License. // - - - -#include #include - #include "NdefRecord.h" #include "NFCUtil.h" +#include namespace DeviceAPI { namespace NFC { @@ -36,7 +32,7 @@ NdefRecord::NdefRecord() NdefRecord::NdefRecord(std::vector data) { - LogDebug("entered"); + LoggerD("entered"); nfc_ndef_message_h messageHandle; NFCUtil util; @@ -90,7 +86,7 @@ NdefRecord::NdefRecord(std::vector data) NdefRecord::NdefRecord(const NdefRecordProperties &ndefRecordProperties, std::vector payload) { - LogDebug("entered"); + LoggerD("entered"); NFCUtil util; @@ -98,7 +94,7 @@ NdefRecord::NdefRecord(const NdefRecordProperties &ndefRecordProperties, std::ve unsigned char * typeName = util.toCharPtr(ndefRecordProperties.typeName); unsigned char * id = util.toCharPtr(ndefRecordProperties.id); - LogDebug("typeName : " << util.byteToString(typeName, ndefRecordProperties.typeName.size())); + LoggerD("typeName : " << util.byteToString(typeName, ndefRecordProperties.typeName.size())); int result = nfc_ndef_record_create(&handle, static_cast(util.convertToTNF(ndefRecordProperties.tnf)), typeName, ndefRecordProperties.typeName.size(), id, ndefRecordProperties.id.size(), recordPayload, payload.size()) ; if (recordPayload) @@ -116,7 +112,7 @@ NdefRecord::NdefRecord(const NdefRecordProperties &ndefRecordProperties, std::ve NdefRecord::NdefRecord(const std::string &text, const std::string &langCode, const short encodeType) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_create_text(&handle, text.c_str(), langCode.c_str(), _convertToEncodeType(static_cast(encodeType))); @@ -129,7 +125,7 @@ NdefRecord::NdefRecord(const std::string &text, const std::string &langCode, con NdefRecord::NdefRecord(const std::string &uri) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_create_uri(&handle, uri.c_str()); @@ -142,7 +138,7 @@ NdefRecord::NdefRecord(const std::string &uri) NdefRecord::NdefRecord(const std::string &mimeType, const std::vector data) { - LogDebug("entered"); + LoggerD("entered"); NFCUtil util; @@ -160,7 +156,7 @@ NdefRecord::NdefRecord(const std::string &mimeType, const std::vector NdefRecord::getID() { } bool NdefRecord::getText(char **text) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_get_text(handle, text); if (result == NFC_ERROR_INVALID_RECORD_TYPE) @@ -247,12 +243,12 @@ bool NdefRecord::getText(char **text) { if (result != NFC_ERROR_NONE) util.throwNFCException(result, "Can't get text of record"); - LogDebug("text : " << *text); + LoggerD("text : " << *text); return true; } bool NdefRecord::getLangCode(char **langCode) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_get_langcode(handle, langCode); if (result == NFC_ERROR_INVALID_RECORD_TYPE) @@ -262,11 +258,11 @@ bool NdefRecord::getLangCode(char **langCode) { if (result != NFC_ERROR_NONE) util.throwNFCException(result, "Can't get langcode of record"); - LogDebug("langCode : " << *langCode); + LoggerD("langCode : " << *langCode); return true; } bool NdefRecord::getEncodeType(nfcTextEncodeUTF *encodeType) { - LogDebug("entered"); + LoggerD("entered"); nfc_encode_type_e type; int result = nfc_ndef_record_get_encode_type(handle, &type); @@ -278,12 +274,12 @@ bool NdefRecord::getEncodeType(nfcTextEncodeUTF *encodeType) { util.throwNFCException(result, "Can't get encode type of record"); *encodeType = _convertToNfcEncodeType(type); - LogDebug("encodeType : " << *encodeType); + LoggerD("encodeType : " << *encodeType); return true; } bool NdefRecord::getUri(char **uri) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_get_uri(handle, uri); if (result == NFC_ERROR_INVALID_RECORD_TYPE) return false; @@ -292,12 +288,12 @@ bool NdefRecord::getUri(char **uri) { if (result != NFC_ERROR_NONE) util.throwNFCException(result, "Can't get uri of record"); - LogDebug("uri : " << *uri); + LoggerD("uri : " << *uri); return true; } bool NdefRecord::getMimeType(char **mimeType) { - LogDebug("entered"); + LoggerD("entered"); int result = nfc_ndef_record_get_mime_type(handle, mimeType); if (result == NFC_ERROR_INVALID_RECORD_TYPE) return false; @@ -306,11 +302,11 @@ bool NdefRecord::getMimeType(char **mimeType) { if (result != NFC_ERROR_NONE) util.throwNFCException(result, "Can't get mime type of record"); - LogDebug("mimeType : " << *mimeType); + LoggerD("mimeType : " << *mimeType); return true; } std::vector NdefRecord::getPayload() { - LogDebug("entered"); + LoggerD("entered"); int size; unsigned char *recordbuffer; int result = nfc_ndef_record_get_payload(handle, &recordbuffer, &size); @@ -319,7 +315,7 @@ std::vector NdefRecord::getPayload() { if (result != NFC_ERROR_NONE) util.throwNFCException(result, "Can't get record's payload"); - LogDebug("payload : " << util.byteToString(recordbuffer, size)); + LoggerD("payload : " << util.byteToString(recordbuffer, size)); return util.toVector(recordbuffer, size); } diff --git a/src/NFC/ResponseDispatcher.cpp b/src/NFC/ResponseDispatcher.cpp index 9fee4e3..429fb62 100644 --- a/src/NFC/ResponseDispatcher.cpp +++ b/src/NFC/ResponseDispatcher.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include @@ -24,6 +23,7 @@ #include "NFCConverter.h" #include "JSNdefMessage.h" #include "NFCAsyncCallbackManager.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -45,12 +45,12 @@ NFCResponseDispatcher::NFCResponseDispatcher() : TargetSendNdefAnswerReceiver(ThreadEnum::NULL_THREAD), TargetReceiveNdefListener(ThreadEnum::NULL_THREAD) { - LogDebug("entered"); + LoggerD("entered"); } NFCResponseDispatcher::~NFCResponseDispatcher() { - LogDebug("entered"); + LoggerD("entered"); } void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionReadPtr &event) @@ -60,17 +60,17 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionReadPtr &event) Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(JSNdefMessage::createJSObject(cbm->getContext(), event->getReadNdefResult())); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); @@ -85,11 +85,11 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionReadPtr &event) cbm->callOnError(errorObject); } Catch (PlatformException) { - LogError("Platform can't create NdefMessage" << _rethrown_exception.GetMessage()); + LoggerE("Platform can't create NdefMessage" << _rethrown_exception.GetMessage()); JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } Catch (Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } @@ -101,17 +101,17 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionWritePtr &event DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); @@ -134,7 +134,7 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionTransceivePtr & Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); @@ -143,11 +143,11 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionTransceivePtr & if (event->getResult()) { NFCConverter convert(context); - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(convert.toJSValueRef(event->getTransceiveBuffer())); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); @@ -162,11 +162,11 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionTransceivePtr & cbm->callOnError(errorObject); } Catch (ConversionException) { - LogError("Conversion exception while processing EventTagActionTransceive"); + LoggerE("Conversion exception while processing EventTagActionTransceive"); JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } Catch (Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSValueRef errorObject = JSTizenExceptionFactory::makeErrorObject(cbm->getContext(), JSTizenException::UNKNOWN_ERROR,"Unknown Error"); cbm->callOnError(errorObject); } @@ -178,17 +178,17 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTagActionFormatPtr &even DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); @@ -210,17 +210,17 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTargetActionSendPtr &eve DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } NFCAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(cbm); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(); return; } - LogDebug("result fail"); + LoggerD("result fail"); std::string error = event->getError(); std::string errorMessage = event->getErrorMessage(); @@ -238,24 +238,24 @@ void NFCResponseDispatcher::OnAnswerReceived(const EventTargetActionSendPtr &eve void NFCResponseDispatcher::onAnswerReceived(const EventTargetActionReceivePtr &event) { - LogDebug("onAnswerReceived Enter"); + LoggerD("onAnswerReceived Enter"); JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); Try { if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } JSContextRef context = cbm->getContext(); - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(JSNdefMessage::createJSObject(context, event->getReadNdefResult())); } Catch (PlatformException) { - LogError("Platform can't create NdefMessage" << _rethrown_exception.GetMessage()); + LoggerE("Platform can't create NdefMessage" << _rethrown_exception.GetMessage()); } Catch (Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } } diff --git a/src/NFC/plugin_initializer.cpp b/src/NFC/plugin_initializer.cpp old mode 100755 new mode 100644 index 6865243..51521a6 --- a/src/NFC/plugin_initializer.cpp +++ b/src/NFC/plugin_initializer.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -28,6 +27,7 @@ #include "NFCAsyncCallbackManager.h" #include "NFCListenerManager.h" #include "NFCDefaultAdapter.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -49,39 +49,39 @@ class_definition_options_t ConstructorClassOptions = void on_widget_start_callback(int widgetId) { - LogDebug("[TIZEN\\NFC ] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[TIZEN\\NFC ] on_widget_start_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[TIZEN\\NFC ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[TIZEN\\NFC ] on_widget_stop_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\NFC] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\NFC] on_frame_load_callback (" << context << ")"); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\NFC] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\NFC] on_frame_unload_callback (" << context << ")"); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); DeviceAPI::NFC::NFCAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); DeviceAPI::NFC::NFCListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp b/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp old mode 100755 new mode 100644 index 166a3f3..b6a9a2c --- a/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp +++ b/src/NetworkBearerSelection/JSNetworkBearerSelection.cpp @@ -33,11 +33,7 @@ #include "JSNetworkBearerSelectionCallbackManager.h" #include "NetworkBearerSelectionResponseDispatcher.h" #include "plugin_config.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "TIZEN_N_NETWORKBEARER" -#endif +#include namespace DeviceAPI { namespace NetworkBearerSelection { @@ -95,12 +91,12 @@ void JSNetworkBearerSelection::initialize(JSContextRef context, JSObjectRef obje INetworkBearerSelectionPtr NetworkBearers(NetworkBearerSelectionFactory::getInstance().getNetworkBearerSelections()); JSNetworkBearerSelectionPriv* priv = new JSNetworkBearerSelectionPriv(context, NetworkBearers); if (!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } - LogDebug("JSNetworkBearerSelection::initialize "); + LoggerD("JSNetworkBearerSelection::initialize "); } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -109,21 +105,21 @@ void JSNetworkBearerSelection::finalize(JSObjectRef object) JSNetworkBearerSelectionPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting gallery"); + LoggerD("Deleting gallery"); delete priv; } JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); JSNetworkBearerSelectionPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); Converter converter(context); Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 3) { @@ -131,7 +127,7 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS } if (argumentCount == 4) { if (check.isCallback(arguments[3])) { - LogDebug("arguments 3 is callback"); + LoggerD("arguments 3 is callback"); } else if (!JSValueIsNull(context, arguments[3]) && !JSValueIsUndefined(context, arguments[3])) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } @@ -174,7 +170,7 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS } } Catch(ConversionException) { - LogError("Error on conversion : " << _rethrown_exception.GetMessage()); + LoggerE("Error on conversion : " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } @@ -223,13 +219,13 @@ JSValueRef JSNetworkBearerSelection::requestRouteToHost(JSContextRef context, JS JSValueRef JSNetworkBearerSelection::releaseRouteToHost(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); JSNetworkBearerSelectionPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); Converter converter(context); Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 3) { diff --git a/src/NetworkBearerSelection/JSNetworkBearerSelectionCallbackManager.cpp b/src/NetworkBearerSelection/JSNetworkBearerSelectionCallbackManager.cpp old mode 100755 new mode 100644 index 71b0d1a..1759b33 --- a/src/NetworkBearerSelection/JSNetworkBearerSelectionCallbackManager.cpp +++ b/src/NetworkBearerSelection/JSNetworkBearerSelectionCallbackManager.cpp @@ -16,7 +16,7 @@ // #include "JSNetworkBearerSelectionCallbackManager.h" -#include +#include namespace DeviceAPI { namespace NetworkBearerSelection { @@ -210,7 +210,7 @@ void JSNetworkBearerSelectionCallbackManager::callOnSuccess() { if (m_onSuccess == NULL) { - //LogDebug("oncontactsadded callback is not set"); + //LoggerD("oncontactsadded callback is not set"); return; } @@ -221,7 +221,7 @@ void JSNetworkBearerSelectionCallbackManager::callOnPaused() { if (m_onPaused == NULL) { - //LogDebug("oncontactsadded callback is not set"); + //LoggerD("oncontactsadded callback is not set"); return; } @@ -232,7 +232,7 @@ void JSNetworkBearerSelectionCallbackManager::callOnResumed() { if (m_onResumed == NULL) { - //LogDebug("oncontactsadded callback is not set"); + //LoggerD("oncontactsadded callback is not set"); return; } @@ -243,7 +243,7 @@ void JSNetworkBearerSelectionCallbackManager::callOnDisconnected() { if (m_onDisconnected == NULL) { - //LogDebug("oncontactsadded callback is not set"); + //LoggerD("oncontactsadded callback is not set"); return; } @@ -254,7 +254,7 @@ void JSNetworkBearerSelectionCallbackManager::callOnError(JSValueRef error) { if (m_onError == NULL) { - //LogDebug("Error callback is not set"); + //LoggerD("Error callback is not set"); return; } JSValueRef objParam[1] = { error }; @@ -265,7 +265,7 @@ void JSNetworkBearerSelectionCallbackManager::makeCallback(JSContextRef context, { if (callback == NULL) { - LogError("callback is NULL"); + LoggerE("callback is NULL"); return; } @@ -273,12 +273,12 @@ void JSNetworkBearerSelectionCallbackManager::makeCallback(JSContextRef context, { if (argc == 0) { - //LogDebug("Calling object directly, no arguments"); + //LoggerD("Calling object directly, no arguments"); JSObjectCallAsFunction(context, callback, object, 0, NULL, NULL); } else { - //LogDebug("Calling object directly, one argument"); + //LoggerD("Calling object directly, one argument"); JSObjectCallAsFunction(context, callback, object, argc, argv, NULL); } return; diff --git a/src/NetworkBearerSelection/NetworkBearerSelection.cpp b/src/NetworkBearerSelection/NetworkBearerSelection.cpp old mode 100755 new mode 100644 index 138db9b..3abbe05 --- a/src/NetworkBearerSelection/NetworkBearerSelection.cpp +++ b/src/NetworkBearerSelection/NetworkBearerSelection.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -23,6 +22,7 @@ #include "NetworkBearerSelection.h" #include #include +#include using namespace WrtDeviceApis::CommonsJavaScript; using namespace WrtDeviceApis::Commons; @@ -33,8 +33,9 @@ namespace NetworkBearerSelection { static void connection_state_changed_callback(connection_profile_state_e state, void* user_data) { + LoggerD("enter"); if(user_data != NULL) { - LogDebug("Callback registration Succeeded"); + LoggerD("Callback registration Succeeded"); NewtorkBearerSelectionPendingEvent *pendingEvent = (NewtorkBearerSelectionPendingEvent *)user_data; NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject(); EventNetworkBearerSelectionPtr event = pendingEvent->getEvent(); @@ -53,8 +54,9 @@ static void connection_state_changed_callback(connection_profile_state_e state, static void connection_opened_callback(connection_error_e result, void* user_data) { + LoggerD("enter"); if (result == CONNECTION_ERROR_NONE) { - LogDebug("Connection open Succeeded"); + LoggerD("Connection open Succeeded"); if(user_data != NULL) { NewtorkBearerSelectionPendingEvent *pendingEvent = (NewtorkBearerSelectionPendingEvent *)user_data; NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject(); @@ -71,8 +73,9 @@ static void connection_opened_callback(connection_error_e result, void* user_dat static void connection_closed_callback(connection_error_e result, void* user_data) { + LoggerD("enter"); if (result == CONNECTION_ERROR_NONE) { - LogDebug("Connection close Succeeded"); + LoggerD("Connection close Succeeded"); if (user_data != NULL) { NewtorkBearerReleasePendingEvent *pendingEvent = (NewtorkBearerReleasePendingEvent *)user_data; NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject(); @@ -87,11 +90,21 @@ static void connection_closed_callback(connection_error_e result, void* user_dat } } +static void connection_closed_callback2(connection_error_e result, void* user_data) +{ + LoggerD("enter"); + if (result == CONNECTION_ERROR_NONE) { + LoggerD("Connection close Succeeded"); + } +} + + static void connection_removed_callback(connection_error_e result, void* user_data) { + LoggerD("enter"); if (user_data != NULL) { if (result == CONNECTION_ERROR_NONE) { - LogDebug("Connection close Succeeded"); + LoggerD("Connection close Succeeded"); NewtorkBearerSelectionPendingEvent *pendingEvent = (NewtorkBearerSelectionPendingEvent *)user_data; NetworkBearerSelection *networkBearerSelection = (NetworkBearerSelection *)pendingEvent->getThisObject(); EventNetworkBearerSelectionPtr event = pendingEvent->getEvent(); @@ -107,14 +120,15 @@ static void connection_removed_callback(connection_error_e result, void* user_da } NetworkBearerSelection::NetworkBearerSelection() : m_connectionHandle(NULL), - m_profileHandle(NULL) + m_profileHandle(NULL), + m_connectionState(NETWORK_UNKNOWN) { int ret = connection_create(&m_connectionHandle); if (CONNECTION_ERROR_NONE == ret) { - LogDebug("Client registration success"); + LoggerD("Client registration success"); } else { - LogDebug("Client registration failed"); + LoggerD("Client registration failed"); m_connectionHandle = NULL; } } @@ -122,30 +136,28 @@ NetworkBearerSelection::NetworkBearerSelection() : m_connectionHandle(NULL), NetworkBearerSelection::~NetworkBearerSelection() { if(m_connectionHandle != NULL) { - LogDebug("Client deregistration success"); + LoggerD("Client deregistration success"); connection_destroy(m_connectionHandle); } else { - LogDebug("Client deregistration failed"); + LoggerD("Client deregistration failed"); } } void NetworkBearerSelection::requestRouteToHost(const EventNetworkBearerSelectionPtr &event) { - LogDebug("enter"); EventRequestReceiver::PostRequest(event); } void NetworkBearerSelection::releaseRouteToHost(const EventNetworkBearerReleasePtr &event) { - LogDebug("enter"); EventRequestReceiver::PostRequest(event); } void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelectionPtr &event) { - LogDebug("enter"); + LoggerD("m_connectionState : " << m_connectionState); - if (checkProfileHandle() == false) { + if (m_connectionState == NETWORK_CONNECTED) { reLaunchConnection(event); return; } @@ -154,12 +166,14 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelection int ret = connection_get_profile_iterator(m_connectionHandle, CONNECTION_ITERATOR_TYPE_REGISTERED, &profileIter); if (ret != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get profile iterator"); + LoggerD("Fail to get profile iterator"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); return; } while (connection_profile_iterator_has_next(profileIter)) { if (connection_profile_iterator_next(profileIter, &m_profileHandle) != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get profile handle"); + LoggerD("Fail to get profile handle"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); return; } } @@ -167,7 +181,8 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelection NewtorkBearerSelectionPendingEvent *pendingEvent = new NewtorkBearerSelectionPendingEvent((void *)this, event); if (connection_open_profile(m_connectionHandle, m_profileHandle, connection_opened_callback, pendingEvent) != CONNECTION_ERROR_NONE) { - LogDebug("Connection open Failed"); + LoggerD("Connection open Failed"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); delete pendingEvent; pendingEvent = NULL; } @@ -175,19 +190,19 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerSelection void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerReleasePtr &event) { - LogDebug("enter"); + LoggerD("enter"); if (event->getDomainName().compare(m_domainName) == 0) { event->switchToManualAnswer(); if (connection_profile_unset_state_changed_cb(m_profileHandle) != CONNECTION_ERROR_NONE) { - LogDebug("unset callback is failed"); + LoggerD("unset callback is failed"); return; } NewtorkBearerReleasePendingEvent *pendingEvent = new NewtorkBearerReleasePendingEvent((void *)this, event); - + if (connection_close_profile(m_connectionHandle, m_profileHandle, connection_closed_callback, pendingEvent) != CONNECTION_ERROR_NONE) { - LogDebug("connection close failed"); + LoggerD("connection close failed"); delete pendingEvent; pendingEvent = NULL; EventRequestReceiver::ManualAnswer(event); @@ -200,17 +215,19 @@ void NetworkBearerSelection::OnRequestReceived(const EventNetworkBearerReleasePt void NetworkBearerSelection::reLaunchConnection(const EventNetworkBearerSelectionPtr &event) { - LogDebug("enter"); + LoggerD("enter"); if (connection_profile_unset_state_changed_cb(m_profileHandle) != CONNECTION_ERROR_NONE) { - LogDebug("unset callback is failed"); + LoggerD("unset callback is failed"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); return; } NewtorkBearerSelectionPendingEvent *pendingEvent = new NewtorkBearerSelectionPendingEvent((void *)this, event); if (connection_close_profile(m_connectionHandle, m_profileHandle, connection_removed_callback, pendingEvent) != CONNECTION_ERROR_NONE) { - LogDebug("connection close failed"); + LoggerD("connection close failed"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); delete pendingEvent; pendingEvent = NULL; } @@ -218,19 +235,21 @@ void NetworkBearerSelection::reLaunchConnection(const EventNetworkBearerSelectio void NetworkBearerSelection::removeStateChangeListener(const EventNetworkBearerSelectionPtr &event) { - LogDebug("enter"); + LoggerD("enter"); m_profileHandle = NULL; connection_profile_iterator_h profileIter; int ret = connection_get_profile_iterator(m_connectionHandle, CONNECTION_ITERATOR_TYPE_REGISTERED, &profileIter); if (ret != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get profile iterator"); + LoggerD("Fail to get profile iterator"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); return; } while (connection_profile_iterator_has_next(profileIter)) { if (connection_profile_iterator_next(profileIter, &m_profileHandle) != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get profile handle"); + LoggerD("Fail to get profile handle"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); return; } } @@ -238,7 +257,8 @@ void NetworkBearerSelection::removeStateChangeListener(const EventNetworkBearerS NewtorkBearerSelectionPendingEvent *pendingEvent = new NewtorkBearerSelectionPendingEvent((void *)this, event); if (connection_open_profile(m_connectionHandle, m_profileHandle, connection_opened_callback, pendingEvent) != CONNECTION_ERROR_NONE) { - LogDebug("Connection open Failed"); + LoggerD("Connection open Failed"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); delete pendingEvent; pendingEvent = NULL; } @@ -246,30 +266,35 @@ void NetworkBearerSelection::removeStateChangeListener(const EventNetworkBearerS void NetworkBearerSelection::registStateChangeListener(const EventNetworkBearerSelectionPtr &event) { - LogDebug("enter"); + LoggerD("enter"); char *interfaceName = NULL; char *hostAddr = NULL; struct hostent *host_entry; - int ndx = 0; - int ret = 0; if (connection_profile_get_network_interface_name(m_profileHandle, &interfaceName) != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get interface name!"); + LoggerD("Fail to get interface name!"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); } else { - LogDebug("Interface name : " << interfaceName); + LoggerD("Interface name : " << interfaceName); } host_entry = gethostbyname(event->getDomainName().c_str()); if(!host_entry) { - LogDebug("gethostbyname is failed"); - makeCallback(event, CONNECTION_STATE_ERROR); + LoggerD("gethostbyname is failed"); + makeCallback(event, CONNECTION_STATE_INVALID_VALUES_ERROR); + + if (connection_close_profile(m_connectionHandle, m_profileHandle, connection_closed_callback2, NULL) != CONNECTION_ERROR_NONE) { + LoggerD("connection close failed"); + makeCallback(event, CONNECTION_STATE_PLATFORM_ERROR); + } + m_profileHandle = NULL; return; } hostAddr = inet_ntoa( *(struct in_addr*)host_entry->h_addr_list[0]); - LogDebug("hostAddr : " << hostAddr); + LoggerD("hostAddr : " << hostAddr); NewtorkBearerSelectionPendingEvent *pendingEvent = new NewtorkBearerSelectionPendingEvent((void *)this, event); connection_profile_set_state_changed_cb(m_profileHandle, connection_state_changed_callback, pendingEvent); @@ -278,26 +303,32 @@ void NetworkBearerSelection::registStateChangeListener(const EventNetworkBearerS void NetworkBearerSelection::deregistStateChangeListener(const EventNetworkBearerReleasePtr &event) { - LogDebug("enter"); + LoggerD("enter"); m_profileHandle = NULL; - + m_connectionState = NETWORK_DISCONNECTED; EventRequestReceiver::ManualAnswer(event); } void NetworkBearerSelection::makeCallback(const EventNetworkBearerSelectionPtr &event, connectionStateType state) { - LogDebug("enter"); + LoggerD("state : " << state); OnNetworkBearerSelectionStateChangedEmitterPtr emitter = event->getEmitter(); OnNetworkBearerSelectionStateChangedPtr listener(new OnNetworkBearerSelectionStateChanged()); m_domainName = event->getDomainName(); - listener->setConnectionStateType(state); - if (state == CONNECTION_STATE_ERROR) { + if (state == CONNECTION_STATE_INVALID_VALUES_ERROR) { + m_connectionState = NETWORK_CONNECTION_FAILED; listener->setExceptionCode(ExceptionCodes::InvalidArgumentException); + } else if (state == CONNECTION_STATE_PLATFORM_ERROR) { + m_connectionState = NETWORK_CONNECTION_FAILED; + listener->setExceptionCode(ExceptionCodes::PlatformException); + } else if (state == CONNECTION_STATE_DISCONNECTED) { + m_connectionState = NETWORK_DISCONNECTED; + } else if (state == CONNECTION_STATE_CONNECTED) { + m_connectionState = NETWORK_CONNECTED; } - emitter->emit(listener); } @@ -314,11 +345,11 @@ bool NetworkBearerSelection::checkCellularNetworkEnable() connection_cellular_state_e cellularState; if (connection_get_cellular_state(m_connectionHandle, &cellularState) != CONNECTION_ERROR_NONE) { - LogDebug("Fail to get Cellular state"); + LoggerD("Fail to get Cellular state"); return false; } - LogDebug("celluar network state is " << cellularState); + LoggerD("celluar network state is " << cellularState); if (cellularState == CONNECTION_CELLULAR_STATE_AVAILABLE || cellularState == CONNECTION_CELLULAR_STATE_CONNECTED) { return true; diff --git a/src/NetworkBearerSelection/NetworkBearerSelection.h b/src/NetworkBearerSelection/NetworkBearerSelection.h index 27545c9..40ae3fa 100755 --- a/src/NetworkBearerSelection/NetworkBearerSelection.h +++ b/src/NetworkBearerSelection/NetworkBearerSelection.h @@ -32,6 +32,13 @@ namespace DeviceAPI { namespace NetworkBearerSelection { +enum { + NETWORK_UNKNOWN = 0, + NETWORK_CONNECTED = 1, + NETWORK_DISCONNECTED = 2, + NETWORK_CONNECTION_FAILED = 3 +}; + class NetworkBearerSelection : public INetworkBearerSelection { friend class NetworkBearerSelectionFactory; @@ -59,6 +66,7 @@ class NetworkBearerSelection : public INetworkBearerSelection connection_h m_connectionHandle; connection_profile_h m_profileHandle; std::string m_domainName; + long m_connectionState; }; class NewtorkBearerSelectionPendingEvent diff --git a/src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp b/src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp old mode 100755 new mode 100644 index 1bce2a5..f78e1cd --- a/src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp +++ b/src/NetworkBearerSelection/NetworkBearerSelectionResponseDispatcher.cpp @@ -17,10 +17,10 @@ #include "NetworkBearerSelectionResponseDispatcher.h" #include "JSNetworkBearerSelectionCallbackManager.h" -#include #include #include #include +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -48,16 +48,16 @@ NetworkBearerSelectionResponseDispatcher::~NetworkBearerSelectionResponseDispatc void NetworkBearerSelectionResponseDispatcher::OnAnswerReceived(const EventNetworkBearerSelectionPtr &event) { - LogDebug("entered"); + LoggerD("entered"); } void NetworkBearerSelectionResponseDispatcher::OnAnswerReceived(const EventNetworkBearerReleasePtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -94,23 +94,23 @@ void NetworkBearerSelectionResponseDispatcher::OnAnswerReceived(const EventNetwo void NetworkBearerSelectionResponseDispatcher::onAnswerReceived(const OnNetworkBearerSelectionStateChangedPtr& event) { - LogDebug("entered"); + LoggerD("entered"); JSNetworkBearerSelectionCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } Try { if (event->getConnectionStateType() == CONNECTION_STATE_CONNECTED) { - LogDebug("success callback"); + LoggerD("success callback"); callbackManager->callOnSuccess(); } else if (event->getConnectionStateType() == CONNECTION_STATE_DISCONNECTED) { - LogDebug("disconnect callback"); + LoggerD("disconnect callback"); callbackManager->callOnDisconnected(); - } else if (event->getConnectionStateType() == CONNECTION_STATE_ERROR) { + } else if (event->getConnectionStateType() == CONNECTION_STATE_INVALID_VALUES_ERROR || event->getConnectionStateType() == CONNECTION_STATE_PLATFORM_ERROR) { JSContextRef gContext = callbackManager->getContext(); JSValueRef error = NULL; @@ -138,12 +138,12 @@ void NetworkBearerSelectionResponseDispatcher::onAnswerReceived(const OnNetworkB callbackManager->callOnError(error); return; } - LogDebug("error callback"); + LoggerD("error callback"); } } Catch(Exception) { - LogError("Error during processing answer."); + LoggerE("Error during processing answer."); } } diff --git a/src/NetworkBearerSelection/OnNetworkBearerSelectionStateChanged.h b/src/NetworkBearerSelection/OnNetworkBearerSelectionStateChanged.h index c29c6fb..02d393d 100755 --- a/src/NetworkBearerSelection/OnNetworkBearerSelectionStateChanged.h +++ b/src/NetworkBearerSelection/OnNetworkBearerSelectionStateChanged.h @@ -29,7 +29,8 @@ namespace NetworkBearerSelection { enum connectionStateType { CONNECTION_STATE_DISCONNECTED = 0, CONNECTION_STATE_CONNECTED = 1, - CONNECTION_STATE_ERROR = 2 + CONNECTION_STATE_INVALID_VALUES_ERROR = 2, + CONNECTION_STATE_PLATFORM_ERROR = 3 }; class OnNetworkBearerSelectionStateChanged : public WrtDeviceApis::Commons::ListenerEvent diff --git a/src/NetworkBearerSelection/plugin_initializer.cpp b/src/NetworkBearerSelection/plugin_initializer.cpp old mode 100755 new mode 100644 index 5189ddb..7f5347f --- a/src/NetworkBearerSelection/plugin_initializer.cpp +++ b/src/NetworkBearerSelection/plugin_initializer.cpp @@ -15,10 +15,10 @@ // limitations under the License. // -#include #include #include #include "JSNetworkBearerSelection.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -30,27 +30,27 @@ namespace NetworkBearerSelection { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\NetworkBearerSelection ] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\NetworkBearerSelection ] on_widget_start_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\NetworkBearerSelection ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\NetworkBearerSelection ] on_widget_stop_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } diff --git a/src/Notification/JSNotificationDetailInfo.cpp b/src/Notification/JSNotificationDetailInfo.cpp old mode 100755 new mode 100644 index 7d57658..57ddf82 --- a/src/Notification/JSNotificationDetailInfo.cpp +++ b/src/Notification/JSNotificationDetailInfo.cpp @@ -102,13 +102,13 @@ JSObjectRef JSNotificationDetailInfo::constructor(JSContextRef context, try { priv->setMainText(validator.toString(0, false, "")); } catch (const BasePlatformException& err) { - LogWarning("mainText convertion is failed. %s", err.getMessage().c_str()); + LoggerW("mainText convertion is failed. %s", err.getMessage().c_str()); } try { priv->setSubText(validator.toString(1, true, "")); } catch (const BasePlatformException& err) { - LogWarning("subText convertion is failed. %s", err.getMessage().c_str()); + LoggerW("subText convertion is failed. %s", err.getMessage().c_str()); } JSObjectRef obj = JSObjectMake(context, getClassRef(), NULL); diff --git a/src/Notification/JSNotificationManager.cpp b/src/Notification/JSNotificationManager.cpp old mode 100755 new mode 100644 index 7f91db5..6b1f504 --- a/src/Notification/JSNotificationManager.cpp +++ b/src/Notification/JSNotificationManager.cpp @@ -84,7 +84,7 @@ void JSNotificationManager::initialize(JSContextRef context, JSObjectRef object) { if (!JSObjectGetPrivate(object)) { NotificationManager *priv = new NotificationManager(); - LogDebug("initialize priv=" << priv); + LoggerD("initialize priv=" << priv); if (!JSObjectSetPrivate(object, static_cast(priv))) { delete priv; } @@ -118,15 +118,15 @@ JSValueRef JSNotificationManager::post(JSContextRef context, throw TypeMismatchException("Private object is NULL."); } - LogInfo("priv=" << priv); + LoggerI("priv=" << priv); ArgumentValidator validator(context, argumentCount, arguments); // notification JSObjectRef notificationObj = validator.toObject(0, JSStatusNotification::getClassRef()); - LogInfo("Notification Obj: " << notificationObj); + LoggerI("Notification Obj: " << notificationObj); StatusNotification *notification = JSStatusNotification::getPrivateObject(context, notificationObj); - LogInfo("Notification : " << notification); + LoggerI("Notification : " << notification); if (!notification) { throw TypeMismatchException("Notification's private object is NULL."); @@ -143,7 +143,7 @@ JSValueRef JSNotificationManager::post(JSContextRef context, if(stream.fail()) throw TypeMismatchException("Notification's ID conversion is failed."); - LogInfo ("posted notification id : " << stream.str()); + LoggerI ("posted notification id : " << stream.str()); //delete notificaiton ID JSStringRef propertyIDName = JSStringCreateWithUTF8CString(NOTIFICATION_ID); @@ -263,7 +263,7 @@ JSValueRef JSNotificationManager::removeAll(JSContextRef context, AceSecurityStatus status = NOTIFICATION_CHECK_ACCESS(NOTIFICATION_FUNC); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); - LogInfo("remove All"); + LoggerI("remove All"); try { // Private Object NotificationManager *priv = static_cast(JSObjectGetPrivate(thisObject)); @@ -302,7 +302,7 @@ JSValueRef JSNotificationManager::get(JSContextRef context, // id std::string id = validator.toString(0); - LogDebug("get notification id :" << id); + LoggerD("get notification id :" << id); JSObjectRef obj = JSObjectMake(context, JSStatusNotification::getClassRef(), NULL); //make object StatusNotification* noti = priv->get(id); // perform JSStatusNotification::setPrivateObject(context, obj, noti); diff --git a/src/Notification/JSStatusNotification.cpp b/src/Notification/JSStatusNotification.cpp old mode 100755 new mode 100644 index 7e1aa9e..d0511ac --- a/src/Notification/JSStatusNotification.cpp +++ b/src/Notification/JSStatusNotification.cpp @@ -73,7 +73,7 @@ bool JSStatusNotification::setProperty(JSContextRef context, { StatusNotification *priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("statusNotification :" << priv); + LoggerD("statusNotification :" << priv); if (!priv) { throw TypeMismatchException("StatusNotification's private object is NULL."); } @@ -92,12 +92,12 @@ bool JSStatusNotification::setProperty(JSContextRef context, delete[] buffer; } - LogInfo("property =" << property); + LoggerI("property =" << property); if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE) { std::string strProgressType = JSUtil::JSValueToString(context, value); - LogInfo("Progress Type : " << strProgressType); + LoggerI("Progress Type : " << strProgressType); NotificationProgressType progType = NOTI_PROGRESS_TYPE_NONE; if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0) @@ -115,7 +115,7 @@ bool JSStatusNotification::setProperty(JSContextRef context, { // progressValue unsigned long progressVal = JSUtil::JSValueToULong(context, value); - LogInfo("Progress Value : " << progressVal); + LoggerI("Progress Value : " << progressVal); if ( priv->getProgressType() == NOTI_PROGRESS_TYPE_PERCENTAGE) { @@ -134,7 +134,7 @@ bool JSStatusNotification::setProperty(JSContextRef context, } catch ( const BasePlatformException& err) { - LogWarning(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); + LoggerW(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); } @@ -148,7 +148,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context, { StatusNotification *priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("statusNotification :" << priv); + LoggerD("statusNotification :" << priv); if (!priv) { throw TypeMismatchException("StatusNotification's private object is NULL."); } @@ -167,7 +167,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context, delete[] buffer; } - LogInfo("property =" << property); + LoggerI("property =" << property); if ( property == STATUS_NOTIFICATION_PROGRESS_TYPE) { std::string type; @@ -186,7 +186,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context, else if ( property == STATUS_NOTIFICATION_PROGRESS_VALUE) { // progressValue - LogInfo("Progress Type=" << priv->getProgressType()); + LoggerI("Progress Type=" << priv->getProgressType()); // progressValue unsigned long progressVal = 0; @@ -199,7 +199,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context, progressVal = (unsigned long)priv->getProgressValue(); } - LogInfo("Progress Value=" << progressVal); + LoggerI("Progress Value=" << progressVal); if( priv->getNotiType() != NOTI_TYPE_PROGRESS && progressVal == 0) { @@ -214,7 +214,7 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context, } catch ( const BasePlatformException& err) { - LogWarning(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); + LoggerW(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); return NULL; } @@ -239,7 +239,7 @@ const JSClassDefinition* JSStatusNotification::getClassInfo() void JSStatusNotification::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("JSStatusNotification::initialize, nothing "); + LoggerD("JSStatusNotification::initialize, nothing "); } void JSStatusNotification::finalize(JSObjectRef object) @@ -271,7 +271,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, //Status Notification Type. NotificationType notiType = NOTI_TYPE_NONE; std::string strStatusType = validator.toString(0, false, ""); - LogInfo("Notification Type : " << strStatusType); + LoggerI("Notification Type : " << strStatusType); if( strStatusType.compare(TIZEN_STATUS_NOTIFICATION_TYPE_SIMPLE) == 0) notiType = NOTI_TYPE_SIMPLE; @@ -292,7 +292,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, if (notiInitDict) { - LogInfo("Set Notification Init Dictionary"); + LoggerI("Set Notification Init Dictionary"); //content JSValueRef contentValue = JSUtil::getProperty(context, notiInitDict, NOTIFICATION_CONTENT); if (!JSValueIsUndefined(context, contentValue)) @@ -316,7 +316,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, #if 0 catch ( const BasePlatformException& err) { - LogWarning("notification's icon path convertion is failed." << err.getMessage()); + LoggerW("notification's icon path convertion is failed." << err.getMessage()); } #endif @@ -358,7 +358,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, { JSValueRef progressTypeValue = JSUtil::getProperty(context, notiInitDict, STATUS_NOTIFICATION_PROGRESS_TYPE); std::string strProgressType = JSUtil::JSValueToString(context, progressTypeValue); - LogInfo("==Progress Type : " << strProgressType); + LoggerI("==Progress Type : " << strProgressType); if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0) progressType = NOTI_PROGRESS_TYPE_PERCENTAGE; else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0) @@ -377,7 +377,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, if (!JSValueIsUndefined(context, progressTypeValue)) { std::string strProgressType = JSUtil::JSValueToString(context, progressTypeValue); - LogInfo("==Progress Type : " << strProgressType); + LoggerI("==Progress Type : " << strProgressType); if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0) progressType = NOTI_PROGRESS_TYPE_PERCENTAGE; else if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0) @@ -419,7 +419,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, NotificationDetailInfo* item = static_cast(JSObjectGetPrivate(object)); std::string main = item->getMainText(); std::string sub = item->getSubText(); - LogInfo("Main : " << main << " Sub : " << sub); + LoggerI("Main : " << main << " Sub : " << sub); NotificationDetailInfo *detailinfo = new NotificationDetailInfo(NULL, (int)i, main, sub); detailInfos.push_back(detailinfo); @@ -462,7 +462,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, JSValueRef element = JSGetArrayElement(context, arrayobj, i); DeviceAPI::Filesystem::IPathPtr thumbnailPath = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, element)); - LogInfo("thumbnail Path = " << thumbnailPath->getFullPath()); + LoggerI("thumbnail Path = " << thumbnailPath->getFullPath()); thumbnailPaths.push_back(thumbnailPath->getFullPath()); } } @@ -495,7 +495,7 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, } catch ( const BasePlatformException& err) { - LogWarning(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); + LoggerW(" notification convertion is failed. " << err.getName().c_str() << ":" << err.getMessage().c_str()); JSObjectRef error = JSWebAPIError::makeJSWebAPIError(context, err); *exception = error; return error; @@ -507,10 +507,10 @@ JSObjectRef JSStatusNotification::constructor(JSContextRef context, StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context, JSObjectRef object) { - LogDebug("get object :" << object); + LoggerD("get object :" << object); StatusNotification *priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("statusNotification :" << priv); + LoggerD("statusNotification :" << priv); if (!priv) { throw TypeMismatchException("StatusNotification's private object is NULL."); } @@ -599,7 +599,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context, JSValueRef element = JSGetArrayElement(context, arrayobj, i); DeviceAPI::Filesystem::IPathPtr thumbnailPath = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, JSUtil::JSValueToString(context, element)); - LogInfo("thumbnail Path = " << thumbnailPath->getFullPath()); + LoggerI("thumbnail Path = " << thumbnailPath->getFullPath()); thumbnailPaths.push_back(thumbnailPath->getFullPath()); } } @@ -634,7 +634,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context, // progressType JSValueRef progressType = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_TYPE); std::string strProgressType = JSUtil::JSValueToString(context, progressType); - LogInfo("Progress Type : " << strProgressType); + LoggerI("Progress Type : " << strProgressType); NotificationProgressType progType = NOTI_PROGRESS_TYPE_NONE; if( strProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE) == 0) @@ -647,7 +647,7 @@ StatusNotification* JSStatusNotification::getPrivateObject(JSContextRef context, // progressValue JSValueRef progressValue = JSUtil::getProperty(context, object, STATUS_NOTIFICATION_PROGRESS_VALUE); - LogInfo(" Progress Value in Private Object = " << JSUtil::JSValueToULong(context, progressValue)); + LoggerI(" Progress Value in Private Object = " << JSUtil::JSValueToULong(context, progressValue)); if ( progType == NOTI_PROGRESS_TYPE_PERCENTAGE) { if ( 100 < JSUtil::JSValueToULong(context, progressValue) ) @@ -763,12 +763,12 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob // thumbnails std::vector thumbnails = priv->getThumbnails(); - LogInfo("Thumbnail Size : " << thumbnails.size()); + LoggerI("Thumbnail Size : " << thumbnails.size()); JSValueRef tumbnailvalueArray[thumbnails.size()]; for( unsigned int i = 0 ; i < thumbnails.size(); i++) { if (!thumbnails[i].empty()) { - LogInfo("Thumbnail :" << thumbnails[i]); + LoggerI("Thumbnail :" << thumbnails[i]); tumbnailvalueArray[i] = JSUtil::toJSValueRef(context, DeviceAPI::Filesystem::Utils::toVirtualPath(context, thumbnails[i])); } } @@ -802,7 +802,7 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob #if 0 // progressType & Value - LogInfo("Progress Type=" << priv->getProgressType()); + LoggerI("Progress Type=" << priv->getProgressType()); // progressValue unsigned long progressVal = 0; @@ -817,25 +817,25 @@ void JSStatusNotification::setPrivateObject(JSContextRef context, JSObjectRef ob progressVal = (unsigned long)priv->getProgressValue(); } - LogInfo("Progress Type=" << type); + LoggerI("Progress Type=" << type); JSUtil::setProperty(context, object, STATUS_NOTIFICATION_PROGRESS_TYPE, JSUtil::toJSValueRef(context, type), kJSPropertyAttributeNone); - LogInfo("Progress Value =" << progressVal); + LoggerI("Progress Value =" << progressVal); JSUtil::setProperty(context, object, STATUS_NOTIFICATION_PROGRESS_VALUE, JSUtil::toJSValueRef(context, progressVal), kJSPropertyAttributeNone); #endif // detailInfo std::vector detailInfo = priv->getDetailInfos(); - LogInfo("detail Info Size : " << detailInfo.size()); + LoggerI("detail Info Size : " << detailInfo.size()); JSObjectRef valueArray[detailInfo.size()]; for( unsigned int i = 0 ; i < detailInfo.size(); i++) { if (detailInfo[i]) { - LogInfo("Main = " << detailInfo[i]->getMainText() << " Sub = " << detailInfo[i]->getSubText()); + LoggerI("Main = " << detailInfo[i]->getMainText() << " Sub = " << detailInfo[i]->getSubText()); valueArray[i] = JSObjectMake(GlobalContextManager::getInstance()->getGlobalContext(context), JSNotificationDetailInfo::getClassRef(), static_cast(detailInfo[i])); JSNotificationDetailInfo::setPrivateObject(context, valueArray[i], detailInfo[i]); - LogInfo("make Object : " << valueArray[i]); + LoggerI("make Object : " << valueArray[i]); } } diff --git a/src/Notification/NotificationDetailInfo.cpp b/src/Notification/NotificationDetailInfo.cpp index d96a92b..ff899b3 100755 --- a/src/Notification/NotificationDetailInfo.cpp +++ b/src/Notification/NotificationDetailInfo.cpp @@ -30,7 +30,7 @@ NotificationDetailInfo::NotificationDetailInfo(): m_index(-1), m_notiHandle(NULL) { - LogDebug("create by constructor"); + LoggerD("create by constructor"); } NotificationDetailInfo::NotificationDetailInfo(notification_h noti): @@ -40,7 +40,7 @@ NotificationDetailInfo::NotificationDetailInfo(notification_h noti): m_index(-1), m_notiHandle(noti) { - LogDebug("create by constructor"); + LoggerD("create by constructor"); } NotificationDetailInfo::NotificationDetailInfo(std::string &mainText, std::string &subText): @@ -48,215 +48,49 @@ NotificationDetailInfo::NotificationDetailInfo(std::string &mainText, std::strin m_mainText(mainText), m_subText(subText) { - LogDebug("create DetilaInfo mainText:" << mainText << " subText:" << subText); + LoggerD("create DetilaInfo mainText:" << mainText << " subText:" << subText); } NotificationDetailInfo::NotificationDetailInfo(notification_h noti, int index, std::string &mainText, std::string &subText) : m_updated(false), m_mainText(mainText), m_subText(subText), - m_notiHandle(noti), - m_index(index) + m_index(index), + m_notiHandle(noti) { - LogDebug("create DetilaInfo mainText:" << mainText << " subText:" << subText); - LogDebug("handle:" << noti << " m_index:" << index); + LoggerD("create DetilaInfo mainText:" << mainText << " subText:" << subText); + LoggerD("handle:" << noti << " m_index:" << index); } NotificationDetailInfo::~NotificationDetailInfo() { //free. - LogDebug(" ~NotificationDetailInfo"); + LoggerD(" ~NotificationDetailInfo"); } std::string NotificationDetailInfo::getMainText() const { -#if 0 - //return m_info; - if (m_notiHandle && m_index >= 0) - { - LogDebug("index = " << m_index); - int index = m_index; - notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; - switch (index) - { - case 0: - type = NOTIFICATION_TEXT_TYPE_INFO_1; - break; - case 1: - type = NOTIFICATION_TEXT_TYPE_INFO_2; - break; - case 2: - type = NOTIFICATION_TEXT_TYPE_INFO_3; - break; - default : - type = NOTIFICATION_TEXT_TYPE_NONE; - } - - char *info = NULL; - - if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE) - { - throw UnknownException("get notification information error"); - } - - std::string strInfo; - if (info) - strInfo = info; - LogDebug(" info " << strInfo); - - return strInfo; - } - else - { - return m_mainText; - } -#endif - LogInfo(" Main Text : " << m_mainText); + LoggerI(" Main Text : " << m_mainText); return m_mainText; } void NotificationDetailInfo::setMainText(std::string mainText) { - LogInfo("mainText :" << mainText); -#if 0 - if (m_notiHandle && m_index >= 0) - { - int idx = m_index; - LogDebug(" index : " << idx); - LogDebug(" mainText : " << mainText); - notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; - - switch (idx) - { - case 0: - type = NOTIFICATION_TEXT_TYPE_INFO_1; - break; - case 1: - type = NOTIFICATION_TEXT_TYPE_INFO_2; - break; - case 2: - type = NOTIFICATION_TEXT_TYPE_INFO_3; - break; - default : - type = NOTIFICATION_TEXT_TYPE_NONE; - } - - if ( type != NOTIFICATION_TEXT_TYPE_NONE) - { - if (getMainText().compare(mainText)) - { - if (notification_set_text(m_notiHandle, type, mainText.c_str(), - NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE) - { - throw UnknownException("set notification sound error"); - } - setUpdatedFlag(true); - } - } - } - else - { - m_mainText = mainText; - } -#endif + LoggerI("mainText :" << mainText); m_mainText = mainText; - } std::string NotificationDetailInfo::getSubText() const { -#if 0 - if (m_notiHandle && m_index >= 0) - { - int index = m_index; - LogDebug(" index : " << index); - - notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; - switch (index) - { - case 0: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1; - break; - case 1: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2; - break; - case 2: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3; - break; - default : - type = NOTIFICATION_TEXT_TYPE_NONE; - } - - char *subInfo = NULL; - - if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE) - { - throw UnknownException("get notification sub information error"); - } - - std::string strSubInfo; - if (subInfo) - strSubInfo = subInfo; - LogDebug(" sub info " << strSubInfo); - return strSubInfo; - - } - else - { - return m_subText; - } -#endif - LogInfo("sub Text : " << m_subText); + LoggerI("sub Text : " << m_subText); return m_subText; - } void NotificationDetailInfo::setSubText(std::string subText) { - LogDebug("subText :" << subText); -#if 0 - if (m_notiHandle && m_index >= 0) - { - int idx = m_index; - LogDebug(" index : " << idx); - LogDebug(" input value : " << subText); - notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; - - switch (idx) - { - case 0: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1; - break; - case 1: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2; - break; - case 2: - type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3; - break; - default : - type = NOTIFICATION_TEXT_TYPE_NONE; - } - - if ( type != NOTIFICATION_TEXT_TYPE_NONE) - { - if (getSubText().compare(subText)) - { - if (notification_set_text(m_notiHandle, type, subText.c_str(), - NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE) - { - throw UnknownException("set notification sound error"); - } - setUpdatedFlag(true); - } - } - } - else - { - m_subText = subText; - } -#endif + LoggerD("subText :" << subText); m_subText = subText; } diff --git a/src/Notification/NotificationLine.cpp b/src/Notification/NotificationLine.cpp old mode 100755 new mode 100644 index d89704f..2c748c3 --- a/src/Notification/NotificationLine.cpp +++ b/src/Notification/NotificationLine.cpp @@ -25,7 +25,7 @@ NotificationLine::NotificationLine() : m_notiHandle(NULL), m_index(-1) { - LogDebug("created by constructor"); + LoggerD("created by constructor"); } NotificationLine::~NotificationLine() @@ -36,7 +36,7 @@ NotificationLine::NotificationLine(notification_h noti, int index): m_notiHandle(noti), m_index(index) { - LogDebug("create by notification"); + LoggerD("create by notification"); } NotificationLine::NotificationLine(notification_h noti, int index, std::string &info, std::string &subInfo): @@ -45,7 +45,7 @@ m_subInfo(subInfo), m_notiHandle(noti), m_index(index) { - LogDebug("create by notification with data" ); + LoggerD("create by notification with data" ); } std::string NotificationLine::getInformation() const @@ -53,7 +53,7 @@ std::string NotificationLine::getInformation() const //return m_info; if (m_notiHandle && m_index >= 0) { - LogDebug("index = " << m_index); + LoggerD("index = " << m_index); int index = m_index; notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (index) @@ -81,7 +81,7 @@ std::string NotificationLine::getInformation() const std::string strInfo; if (info) strInfo = info; - LogDebug(" info " << strInfo); + LoggerD(" info " << strInfo); return strInfo; } @@ -97,8 +97,8 @@ void NotificationLine::setInformation(const std::string &info) if (m_notiHandle && m_index >= 0) { int idx = m_index; - LogDebug(" index : " << idx); - LogDebug(" info : " << info); + LoggerD(" index : " << idx); + LoggerD(" info : " << info); notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (idx) @@ -141,7 +141,7 @@ std::string NotificationLine::getSubInformation() const if (m_notiHandle && m_index >= 0) { int index = m_index; - LogDebug(" index : " << index); + LoggerD(" index : " << index); notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (index) @@ -169,7 +169,7 @@ std::string NotificationLine::getSubInformation() const std::string strSubInfo; if (subInfo) strSubInfo = subInfo; - LogDebug(" sub info " << strSubInfo); + LoggerD(" sub info " << strSubInfo); return strSubInfo; } @@ -184,8 +184,8 @@ void NotificationLine::setSubInformation(const std::string &subInfo) if (m_notiHandle && m_index >= 0) { int idx = m_index; - LogDebug(" index : " << idx); - LogDebug(" input value : " << subInfo); + LoggerD(" index : " << idx); + LoggerD(" input value : " << subInfo); notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (idx) diff --git a/src/Notification/NotificationManager.cpp b/src/Notification/NotificationManager.cpp old mode 100755 new mode 100644 index 74606fc..a0121cd --- a/src/Notification/NotificationManager.cpp +++ b/src/Notification/NotificationManager.cpp @@ -47,7 +47,7 @@ static bool notification_package_equal(notification_h handle) return false; } - LogDebug("handle package=" << handle_package); + LoggerD("handle package=" << handle_package); if (app_get_package(&package)) { @@ -72,7 +72,7 @@ static bool notification_package_equal(notification_h handle) cmdline[ret] = 0; close(fd); - LogDebug("package=" << package); + LoggerD("package=" << package); if (strlen(cmdline) == strlen(handle_package)) { @@ -84,7 +84,7 @@ static bool notification_package_equal(notification_h handle) } else { - LogDebug("package=" << package); + LoggerD("package=" << package); if (strlen(package) == strlen(handle_package)) { @@ -112,10 +112,10 @@ int NotificationManager::post(StatusNotification *notification) if ( notification ) { - LogInfo(" notification id = " << notification->getID()); + LoggerI(" notification id = " << notification->getID()); notification_h handle = (notification_h)notification->getNotificationHandle(); - LogInfo("notification hanel :" << handle); + LoggerI("notification hanel :" << handle); if ( handle ) { @@ -135,13 +135,13 @@ int NotificationManager::post(StatusNotification *notification) { if (notification->getLaunchFlag()) { - LogInfo("Notification Launch Flag True"); + LoggerI("Notification Launch Flag True"); notification_set_property(handle, 0); notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data); } else { - LogInfo("Notification Launch Flag False"); + LoggerI("Notification Launch Flag False"); notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH); } @@ -180,9 +180,9 @@ int NotificationManager::post(StatusNotification *notification) } } - LogDebug(" Layout type = " << noti_layout); + LoggerD(" Layout type = " << noti_layout); ret = notification_set_layout(handle, noti_layout); - LogDebug("set Layout result= " << ret); + LoggerD("set Layout result= " << ret); int privID = -1; @@ -190,7 +190,7 @@ int NotificationManager::post(StatusNotification *notification) if (NOTIFICATION_ERROR_NONE == ret) { id = privID; - LogDebug("private ID : " << privID); + LoggerD("private ID : " << privID); notification->setUpdatedFlag(false); } else @@ -207,21 +207,21 @@ int NotificationManager::post(StatusNotification *notification) { throw UnknownException("get notification size error"); } - LogInfo("get Size : " << value); + LoggerI("get Size : " << value); notification_update_size(handle, NOTIFICATION_PRIV_ID_NONE, value); if (notification_get_progress(handle, &value) != NOTIFICATION_ERROR_NONE) { throw UnknownException("get notification percentage error"); } - LogInfo("get Percentage : " << value); + LoggerI("get Percentage : " << value); notification_update_progress(handle, NOTIFICATION_PRIV_ID_NONE, value); } } else { - LogDebug("it has not notification handle."); + LoggerD("it has not notification handle."); throw UnknownException("It is Empty Notification."); } } @@ -236,33 +236,33 @@ void NotificationManager::update(StatusNotification *notification) { if (notification) { - LogDebug(" notification id = " << notification->getID()); + LoggerD(" notification id = " << notification->getID()); notification_h handle = (notification_h)notification->getNotificationHandle(); - LogDebug("handle = " << handle); + LoggerD("handle = " << handle); if (handle) { - LogDebug(" noti type = " << notification->getNotiType()); + LoggerD(" noti type = " << notification->getNotiType()); if ( notification->getNotiType() == NOTI_TYPE_PROGRESS) { int ret = 0; - LogDebug(" progress type = " << notification->getProgressType()); - LogDebug(" noti id = " << notification->getID()); - LogDebug(" noti progress value = " << notification->getProgressValue()); + LoggerD(" progress type = " << notification->getProgressType()); + LoggerD(" noti id = " << notification->getID()); + LoggerD(" noti progress value = " << notification->getProgressValue()); if ( NOTI_PROGRESS_TYPE_PERCENTAGE == notification->getProgressType() ) { - LogDebug( " Percentage "); + LoggerD( " Percentage "); ret = notification_update_progress(handle, NOTIFICATION_PRIV_ID_NONE, notification->getProgressValue()); } else if ( NOTI_PROGRESS_TYPE_SIZE == notification->getProgressType()) { - LogDebug( " size "); + LoggerD( " size "); ret = notification_update_size(handle, NOTIFICATION_PRIV_ID_NONE, notification->getProgressValue()); } - LogDebug(" notification_update_progress = " << ret); + LoggerD(" notification_update_progress = " << ret); if (NOTIFICATION_ERROR_NONE != ret) { @@ -278,7 +278,7 @@ void NotificationManager::update(StatusNotification *notification) } - LogDebug(" updated Flag = " << notification->getUpdatedFlag()); + LoggerD(" updated Flag = " << notification->getUpdatedFlag()); if ( notification->getUpdatedFlag()) { @@ -313,9 +313,9 @@ void NotificationManager::update(StatusNotification *notification) } } - LogDebug(" Layout type = " << noti_layout); + LoggerD(" Layout type = " << noti_layout); int ret = notification_set_layout(handle, noti_layout); - LogDebug("set Layout result= " << ret); + LoggerD("set Layout result= " << ret); bundle *service_data = NULL; @@ -331,13 +331,13 @@ void NotificationManager::update(StatusNotification *notification) { if (notification->getLaunchFlag()) { - LogInfo("Notification Launch Flag True"); + LoggerI("Notification Launch Flag True"); notification_set_property(handle, 0); notification_set_execute_option(handle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, service_data); } else { - LogInfo("Notification Launch Flag False"); + LoggerI("Notification Launch Flag False"); notification_set_property(handle, NOTIFICATION_PROP_DISABLE_APP_LAUNCH); } @@ -346,9 +346,9 @@ void NotificationManager::update(StatusNotification *notification) notification->setLaunchFlag(false); - LogDebug(" get Title = " << notification->getTitle()); + LoggerD(" get Title = " << notification->getTitle()); ret = notification_update(handle); - LogDebug(" notification_update = " << ret); + LoggerD(" notification_update = " << ret); notification->setUpdatedFlag(false); //init if (ret != NOTIFICATION_ERROR_NONE) @@ -356,18 +356,18 @@ void NotificationManager::update(StatusNotification *notification) throw UnknownException("Notification Object update fail, Error Code : "); } - LogDebug(" get Title = " << notification->getTitle()); + LoggerD(" get Title = " << notification->getTitle()); } } else { - LogDebug("it has not notification handle."); + LoggerD("it has not notification handle."); throw UnknownException("It is Empty Notification."); } } else { - LogDebug(" INotification is NULL"); + LoggerD(" INotification is NULL"); throw UnknownException("Notificaton Error."); } @@ -378,7 +378,7 @@ void NotificationManager::remove(std::string id) int ret = 0; bool existFalg = false; - LogDebug("id : " << id); + LoggerD("id : " << id); std::istringstream stream(id); if (stream.fail()) { @@ -393,7 +393,7 @@ void NotificationManager::remove(std::string id) if (notification_get_grouping_list( NOTIFICATION_TYPE_NONE , -1, ¬i_list)) { - LogDebug(" get notification list failed..."); + LoggerD(" get notification list failed..."); throw UnknownException("Can't get noti list"); } @@ -406,7 +406,7 @@ void NotificationManager::remove(std::string id) { int noti_priv = -1; notification_get_id(noti, NULL, ¬i_priv); - LogDebug(" notification id = " << noti_priv); + LoggerD(" notification id = " << noti_priv); if (noti_priv == privID) existFalg = true; } @@ -416,13 +416,13 @@ void NotificationManager::remove(std::string id) if (noti_list) notification_free_list(noti_list); - LogDebug(" notification ID : "<< privID); + LoggerD(" notification ID : "<< privID); if ( !existFalg ) throw NotFoundException("not exist id"); ret = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NONE, privID); - LogDebug("ret = " << ret); + LoggerD("ret = " << ret); if (ret != NOTIFICATION_ERROR_NONE) { if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID) @@ -450,7 +450,7 @@ StatusNotification* NotificationManager::get(std::string id) { int privID = 0; - LogDebug("id : " << id); + LoggerD("id : " << id); std::istringstream stream(id); if (stream.fail()) { @@ -463,7 +463,7 @@ StatusNotification* NotificationManager::get(std::string id) } std::vector NotificationManager::getAll() { - LogDebug("OK"); + LoggerD("OK"); std::vector data; notification_h noti = NULL; @@ -472,7 +472,7 @@ std::vector NotificationManager::getAll() if (notification_get_grouping_list( NOTIFICATION_TYPE_NONE , -1, ¬i_list)) { - LogDebug(" get notification list failed..."); + LoggerD(" get notification list failed..."); throw UnknownException("Can't get noti list"); } @@ -485,12 +485,12 @@ std::vector NotificationManager::getAll() { int noti_priv = -1; notification_get_id(noti, NULL, ¬i_priv); - LogDebug(" notification id = " << noti_priv); + LoggerD(" notification id = " << noti_priv); StatusNotification* notification = new StatusNotification(noti_priv); notification_get_id((notification_h)notification->getNotificationHandle(), NULL, ¬i_priv); - LogDebug("loaded notification id = " << noti_priv); + LoggerD("loaded notification id = " << noti_priv); data.push_back(notification); @@ -510,12 +510,12 @@ std::vector NotificationManager::getAll() { int noti_priv = -1; notification_get_id(noti, NULL, ¬i_priv); - LogDebug(" notification id = " << noti_priv); + LoggerD(" notification id = " << noti_priv); StatusNotification* notification = new StatusNotification(noti_priv); notification_get_id((notification_h)notification->getNotificationHandle(), NULL, ¬i_priv); - LogDebug("loaded notification id = " << noti_priv); + LoggerD("loaded notification id = " << noti_priv); data.push_back(notification); diff --git a/src/Notification/StatusNotification.cpp b/src/Notification/StatusNotification.cpp index 1087157..bcfab33 100755 --- a/src/Notification/StatusNotification.cpp +++ b/src/Notification/StatusNotification.cpp @@ -35,34 +35,34 @@ extern "C" int service_to_bundle(service_h service, bundle **data); //callback functions. static bool service_extra_data_cb(service_h service, const char *key, void *user_data) { - LogInfo("OK"); + LoggerI("OK"); char **value = NULL; int length = 0; if (user_data != NULL && key != NULL) { - LogInfo("user data & key is existed"); + LoggerI("user data & key is existed"); DeviceAPI::Application::ApplicationControlPtr* appControl = (DeviceAPI::Application::ApplicationControlPtr*)(user_data); DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData()); - LogInfo("key = " << key); + LoggerI("key = " << key); std::string keyStr = key; std::vector keyValue; int index = 0; if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE) { - LogInfo("extra_data_array length = " << length); + LoggerI("extra_data_array length = " << length); if (value != NULL && length != 0) { - LogInfo("extra_data_length = " << length); + LoggerI("extra_data_length = " << length); data->setKey(key); for (index = 0; index < length; index++) { - LogInfo("Value=" << value[index]); + LoggerI("Value=" << value[index]); keyValue.push_back(value[index]); } @@ -77,21 +77,23 @@ static bool service_extra_data_cb(service_h service, const char *key, void *user return true; } +#if 0 static bool service_extra_data_delete_cb(service_h service, const char *key, void *user_data) { - LogInfo("OK"); + LoggerI("OK"); if (key != NULL) { - LogInfo("del key = " << key); + LoggerI("del key = " << key); if (service_remove_extra_data(service, key) != SERVICE_ERROR_NONE) { - LogWarning("remove extra data failed"); + LoggerW("remove extra data failed"); return false; } } return true; } +#endif StatusNotification::StatusNotification(NotificationType statusType) : m_notiType(NOTI_TYPE_NONE), @@ -101,7 +103,7 @@ StatusNotification::StatusNotification(NotificationType statusType) : m_notiUpdated(false), m_launchFlag(false) { - LogInfo("statusType =" << statusType); + LoggerI("statusType =" << statusType); notification_type_e type = NOTIFICATION_TYPE_NONE; setNotiType(statusType); @@ -116,23 +118,23 @@ StatusNotification::StatusNotification(NotificationType statusType) : } else { - LogInfo(" invalide noti type"); + LoggerI(" invalide noti type"); throw TypeMismatchException("value is not notification type"); } setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default - LogInfo("Notification Type : " << type); + LoggerI("Notification Type : " << type); notification_h noti = notification_create(type); //create notificatin. if ( noti ) { - LogInfo("noti =" << noti); + LoggerI("noti =" << noti); setNotificationHandle((void*)noti); if (NOTIFICATION_TYPE_ONGOING == type) { //ongoing no ticker. - LogInfo("ongoing type"); + LoggerI("ongoing type"); notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |NOTIFICATION_DISPLAY_APP_INDICATOR ); } } @@ -154,7 +156,7 @@ StatusNotification::StatusNotification(void* noti) : m_notiUpdated(false), m_launchFlag(false) { - LogInfo("noti : " << noti); + LoggerI("noti : " << noti); notification_h notification = (notification_h)noti; @@ -192,7 +194,7 @@ StatusNotification::StatusNotification(void* noti) : } } - LogInfo(" notification type =" << type); + LoggerI(" notification type =" << type); setNotiType(type); setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default. @@ -209,17 +211,17 @@ StatusNotification::StatusNotification(void* noti) : bundle *bSvc = NULL; int ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc); - LogInfo("ret = " << ret); + LoggerI("ret = " << ret); if (ret == NOTIFICATION_ERROR_NONE) { - LogInfo(" bundle = " << bSvc); + LoggerI(" bundle = " << bSvc); if (bSvc) { - LogInfo("bundle is valid"); + LoggerI("bundle is valid"); int ret = service_create_event(bSvc, &m_service); if (ret != SERVICE_ERROR_NONE) { - LogInfo("Service Create Event Error"); + LoggerI("Service Create Event Error"); throw UnknownException("can't make service object"); } } @@ -246,10 +248,10 @@ StatusNotification::StatusNotification(int privID) : m_notiUpdated(false), m_launchFlag(false) { - LogInfo("priv ID : " << privID); + LoggerI("priv ID : " << privID); notification_h notification = notification_load( NULL, privID); //load notification. - LogInfo(" notification " << notification); + LoggerI(" notification " << notification); if ( notification ) { @@ -284,7 +286,7 @@ StatusNotification::StatusNotification(int privID) : } } - LogInfo(" notification type =" << type); + LoggerI(" notification type =" << type); setNotiType(type); setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default. setNotificationHandle((void*)notification); @@ -300,17 +302,17 @@ StatusNotification::StatusNotification(int privID) : bundle *bSvc = NULL; int ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc); - LogInfo("ret = " << ret); + LoggerI("ret = " << ret); if (ret == NOTIFICATION_ERROR_NONE) { - LogInfo(" bundle = " << bSvc); + LoggerI(" bundle = " << bSvc); if (bSvc) { - LogInfo("bundle is valid"); + LoggerI("bundle is valid"); int ret = service_create_event(bSvc, &m_service); if (ret != SERVICE_ERROR_NONE) { - LogInfo("Service Create Event Error"); + LoggerI("Service Create Event Error"); throw UnknownException("can't make service object"); } } @@ -331,7 +333,7 @@ StatusNotification::StatusNotification(int privID) : StatusNotification::~StatusNotification() { - LogInfo(" notification = " << m_notiHandle); + LoggerI(" notification = " << m_notiHandle); //clear thumbnail. //clearDetailInfos(); @@ -339,7 +341,7 @@ StatusNotification::~StatusNotification() if (m_notiHandle) { #if 0 - LogInfo(" service = " << m_service); + LoggerI(" service = " << m_service); if (m_service != NULL) { service_destroy(m_service); @@ -395,7 +397,7 @@ std::string StatusNotification::getStatusType() void StatusNotification::setStatusType(std::string type) { - LogInfo("type = " << type); + LoggerI("type = " << type); NotificationType notiType = NOTI_TYPE_NONE; @@ -410,13 +412,13 @@ void StatusNotification::setStatusType(std::string type) else throw InvalidValuesException("Invalid Status Type."); - LogInfo("Notification type = " << notiType); + LoggerI("Notification type = " << notiType); setNotiType(notiType); } time_t StatusNotification::getPostedTime() { - LogInfo("get m_notiHandle = " << m_notiHandle); + LoggerI("get m_notiHandle = " << m_notiHandle); time_t postedTime = 0; @@ -428,7 +430,7 @@ time_t StatusNotification::getPostedTime() } } - LogInfo("posted Time =" << ctime(&postedTime)); + LoggerI("posted Time =" << ctime(&postedTime)); return postedTime; } @@ -454,10 +456,10 @@ std::string StatusNotification::getTitle() void StatusNotification::setTitle(std::string title) { - LogInfo("Title : " << title); + LoggerI("Title : " << title); if (m_notiHandle) { - LogInfo("get Title : " << getTitle()); + LoggerI("get Title : " << getTitle()); if((getTitle()).compare(title)) //different value. { if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, title.c_str(), @@ -470,12 +472,12 @@ void StatusNotification::setTitle(std::string title) } else { - LogInfo(" title = " << title << " getTitle = " << getTitle()); + LoggerI(" title = " << title << " getTitle = " << getTitle()); } } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } @@ -483,7 +485,7 @@ void StatusNotification::setTitle(std::string title) std::string StatusNotification::getContent() { - LogInfo("get Content handle: " << m_notiHandle); + LoggerI("get Content handle: " << m_notiHandle); if (m_notiHandle) { char *content = NULL; @@ -493,7 +495,7 @@ std::string StatusNotification::getContent() throw UnknownException("get notification Content error"); } - LogInfo(" get Content : " << content); + LoggerI(" get Content : " << content); std::string notiContent; @@ -512,7 +514,7 @@ std::string StatusNotification::getContent() char* StatusNotification::getStrContent() { - LogInfo("get Content handle: " << m_notiHandle); + LoggerI("get Content handle: " << m_notiHandle); if (m_notiHandle) { char *content = NULL; @@ -532,7 +534,7 @@ char* StatusNotification::getStrContent() void StatusNotification::setContent(std::string content) { - LogInfo("Content : " << content); + LoggerI("Content : " << content); if (m_notiHandle) { if((getContent()).compare(content)) //different value. @@ -547,7 +549,7 @@ void StatusNotification::setContent(std::string content) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } @@ -555,7 +557,7 @@ void StatusNotification::setContent(std::string content) std::string StatusNotification::getIconPath() { - LogInfo("m_notiHandle = " << m_notiHandle); + LoggerI("m_notiHandle = " << m_notiHandle); if (m_notiHandle) { char *iconPath = NULL; @@ -565,7 +567,7 @@ std::string StatusNotification::getIconPath() } std::string notiIconPath(iconPath); - LogInfo("icon Path = " << iconPath); + LoggerI("icon Path = " << iconPath); //if icon path invalid, return empty string. if ( notiIconPath.find(DEFAULT_ICON_PATH,0) == std::string::npos) @@ -585,7 +587,7 @@ void StatusNotification::setIconPath(const std::string& iconPath) { if (m_notiHandle) { - LogInfo("icon path = " << iconPath << " origin icon path = " << getIconPath()); + LoggerI("icon path = " << iconPath << " origin icon path = " << getIconPath()); if( getIconPath().compare(iconPath)) { if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON, iconPath.c_str()) != NOTIFICATION_ERROR_NONE) @@ -597,14 +599,14 @@ void StatusNotification::setIconPath(const std::string& iconPath) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } std::string StatusNotification::getSoundPath() { - LogInfo("Handle = " << m_notiHandle); + LoggerI("Handle = " << m_notiHandle); if (m_notiHandle) { @@ -616,10 +618,10 @@ std::string StatusNotification::getSoundPath() throw UnknownException("get notification sound error"); } - LogInfo(" sound type = " << type << " path = " << soundPath); + LoggerI(" sound type = " << type << " path = " << soundPath); if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA ) { - LogInfo("soundPath = " << soundPath); + LoggerI("soundPath = " << soundPath); return std::string(soundPath); } else @@ -629,7 +631,7 @@ std::string StatusNotification::getSoundPath() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } @@ -638,7 +640,7 @@ void StatusNotification::setSoundPath(const std::string& sound) { if (m_notiHandle) { - LogInfo("sound path = " << sound << " origin sound path = " << getSoundPath()); + LoggerI("sound path = " << sound << " origin sound path = " << getSoundPath()); if( getSoundPath().compare(sound)) { @@ -651,10 +653,10 @@ void StatusNotification::setSoundPath(const std::string& sound) if (sound.empty()) { - LogInfo("sound path is NULL"); + LoggerI("sound path is NULL"); if ( NOTI_TYPE_ONGOING == getNotiType() || NOTI_TYPE_PROGRESS == getNotiType()) { - LogInfo("Ongoing Type" ); + LoggerI("Ongoing Type" ); if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_NONE, NULL) != NOTIFICATION_ERROR_NONE) { throw UnknownException("set notification sound error"); @@ -672,14 +674,14 @@ void StatusNotification::setSoundPath(const std::string& sound) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } bool StatusNotification::getDefaultVibration() { - LogInfo("getDefaultVibration"); + LoggerI("getDefaultVibration"); if (m_notiHandle) { notification_vibration_type_e vib_type; @@ -699,7 +701,7 @@ bool StatusNotification::getDefaultVibration() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } @@ -708,11 +710,11 @@ bool StatusNotification::getDefaultVibration() void StatusNotification::setDefaultVibration(const bool& vibration) { - LogInfo("vibration = " << vibration); + LoggerI("vibration = " << vibration); if (m_notiHandle) { notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE; - LogInfo("old vibration = " << getDefaultVibration()); + LoggerI("old vibration = " << getDefaultVibration()); if (getDefaultVibration() != vibration) { if (vibration) @@ -723,7 +725,7 @@ void StatusNotification::setDefaultVibration(const bool& vibration) { vib_type = NOTIFICATION_VIBRATION_TYPE_NONE; } - LogInfo("type vibration type= " << vib_type); + LoggerI("type vibration type= " << vib_type); if (notification_set_vibration(m_notiHandle, vib_type , NULL) != NOTIFICATION_ERROR_NONE) { @@ -734,7 +736,7 @@ void StatusNotification::setDefaultVibration(const bool& vibration) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } @@ -755,7 +757,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication // mandatory if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE) { - LogDebug("Operation Str = " << tempStr); + LoggerD("Operation Str = " << tempStr); if (tempStr) { appControl->setOperation(tempStr); @@ -767,7 +769,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication // optional if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE) { - LogDebug("Mime Str = " << tempStr); + LoggerD("Mime Str = " << tempStr); if (tempStr) { appControl->setMime(tempStr); @@ -779,7 +781,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication // optional if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE) { - LogDebug("Uri Str = " << tempStr); + LoggerD("Uri Str = " << tempStr); if (tempStr) { appControl->setUri(tempStr); @@ -790,7 +792,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE) { - LogDebug("Category Str = " << tempStr); + LoggerD("Category Str = " << tempStr); if (tempStr) { appControl->setCategory(tempStr); @@ -823,7 +825,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication service = NULL; } - LogWarning(_rethrown_exception.GetMessage()); + LoggerW(_rethrown_exception.GetMessage()); } return appControl; @@ -831,7 +833,7 @@ DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplication void StatusNotification::setApplicationControl(DeviceAPI::Application::ApplicationControlPtr control) { - LogInfo("Entered m_service : " << m_service << " control : " << control); + LoggerI("Entered m_service : " << m_service << " control : " << control); //delete old service. if (m_service) @@ -846,7 +848,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati } else { - LogInfo("getOperation : " << control->getOperation().c_str()); + LoggerI("getOperation : " << control->getOperation().c_str()); if (control->getOperation().size() != 0) { m_launchFlag = true; //default attribute @@ -857,7 +859,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati } // optional - LogInfo("getUri : " << control->getUri().c_str()); + LoggerI("getUri : " << control->getUri().c_str()); if (control->getUri().size() != 0) { if (service_set_uri(m_service, control->getUri().c_str() ) != SERVICE_ERROR_NONE) @@ -867,7 +869,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati } // optional - LogInfo("getMime : " << control->getMime().c_str()); + LoggerI("getMime : " << control->getMime().c_str()); if (control->getMime().size() != 0) { if (service_set_mime(m_service, control->getMime().c_str() ) != SERVICE_ERROR_NONE) @@ -876,7 +878,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati } } - LogInfo("Category : " << control->getCategory().c_str()); + LoggerI("Category : " << control->getCategory().c_str()); if (control->getCategory().size() != 0) { if (service_set_category(m_service, control->getCategory().c_str() ) != SERVICE_ERROR_NONE) @@ -884,17 +886,17 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati throw UnknownException("service set mime error"); } } - +#if 0 //remove key - //if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE) - //{ - // throw UnknownException("get notification service uri error"); - //} - + if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE) + { + throw UnknownException("get notification service uri error"); + } +#endif std::vector appControlDataArray = control->getAppControlDataArray(); size_t index = 0; - LogInfo (" App Control Datas Count : " << appControlDataArray.size()); + LoggerI (" App Control Datas Count : " << appControlDataArray.size()); DeviceAPI::Application::ApplicationControlDataArray::iterator iter; @@ -902,7 +904,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati { DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter; std::string key = appControlData->getKey(); - LogInfo(" key : " << key); + LoggerI(" key : " << key); if (key.empty()) continue; @@ -913,11 +915,11 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati for (size_t indexArray = 0; indexArray < value.size(); indexArray++) { arrayValue[indexArray] = (char*)value[indexArray].c_str(); - LogInfo( " value : " << arrayValue[indexArray]); + LoggerI( " value : " << arrayValue[indexArray]); } const char* strKey = key.c_str(); - LogInfo( " value size: " << value.size()); + LoggerI( " value size: " << value.size()); if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE) { throw UnknownException("service set extra data error"); @@ -934,7 +936,7 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati throw UnknownException("service get bundle"); } - LogDebug("bundle_data : " << bundle_data); + LoggerD("bundle_data : " << bundle_data); if (bundle_data) { @@ -948,12 +950,12 @@ void StatusNotification::setApplicationControl(DeviceAPI::Application::Applicati void StatusNotification::setApplicationId(const std::string& appId) { - LogInfo("m_service = " << m_service << " appId = " << appId); + LoggerI("m_service = " << m_service << " appId = " << appId); if (!m_service) { if (service_create(&m_service) != SERVICE_ERROR_NONE) { - LogWarning("Create Service Failed.."); + LoggerW("Create Service Failed.."); throw UnknownException("service creation error"); } } @@ -987,11 +989,11 @@ std::string StatusNotification::getApplicationId() { if (retcode == SERVICE_ERROR_OUT_OF_MEMORY) { - LogWarning("SERVICE_ERROR_OUT_OF_MEMORY"); + LoggerW("SERVICE_ERROR_OUT_OF_MEMORY"); } else { - LogWarning("UI_NOTIFICATION_ERROR_INVALID_PARAMETER"); + LoggerW("UI_NOTIFICATION_ERROR_INVALID_PARAMETER"); } throw UnknownException ("get notification service error "); } @@ -1017,7 +1019,7 @@ std::string StatusNotification::getApplicationId() free(appIdStr); } } - LogInfo(retString); + LoggerI(retString); return retString; @@ -1037,7 +1039,7 @@ double StatusNotification::getProgressValue() { throw UnknownException("get notification size error"); } - LogInfo("Size Val = " << value); + LoggerI("Size Val = " << value); } else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE ) { @@ -1045,7 +1047,7 @@ double StatusNotification::getProgressValue() { throw UnknownException("get notification percentage error"); } - LogInfo("Percentage Val = " << value); + LoggerI("Percentage Val = " << value); } else { @@ -1054,9 +1056,9 @@ double StatusNotification::getProgressValue() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); } - LogInfo("value = " << value); + LoggerI("value = " << value); return value; } @@ -1066,10 +1068,10 @@ void StatusNotification::setProgressValue(const double &progressValue) if (m_notiHandle) { NotificationProgressType progressType = getProgressType(); - LogInfo("Progress Type : " << progressType); + LoggerI("Progress Type : " << progressType); double val = getProgressValue(); - LogInfo("Progress value = " << progressValue << " origin Progress Value =" << val); + LoggerI("Progress value = " << progressValue << " origin Progress Value =" << val); if (progressType == NOTI_PROGRESS_TYPE_SIZE) { @@ -1092,14 +1094,14 @@ void StatusNotification::setProgressValue(const double &progressValue) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } } std::string StatusNotification::getSubIconPath() { - LogInfo("Handle = " << m_notiHandle); + LoggerI("Handle = " << m_notiHandle); if (m_notiHandle) { char *subIconPath = NULL; @@ -1125,7 +1127,7 @@ void StatusNotification::setSubIconPath(const std::string& subIconPath) { if (m_notiHandle) { - LogInfo(" subIconPath = " << subIconPath << " origin SubIconPath = " << getSubIconPath()); + LoggerI(" subIconPath = " << subIconPath << " origin SubIconPath = " << getSubIconPath()); if( getSubIconPath().compare(subIconPath)) { @@ -1138,7 +1140,7 @@ void StatusNotification::setSubIconPath(const std::string& subIconPath) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } @@ -1173,13 +1175,13 @@ std::string StatusNotification::getInformation(int index) std::string strInfo; if (info) strInfo = info; - LogDebug(" info " << strInfo); + LoggerD(" info " << strInfo); return strInfo; } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } @@ -1191,8 +1193,8 @@ void StatusNotification::setInformation( const std::string& info, int index) if (m_notiHandle) { int idx = index; - LogDebug(" index : " << idx); - LogDebug(" log : " << info); + LoggerD(" index : " << idx); + LoggerD(" log : " << info); notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (idx) @@ -1225,7 +1227,7 @@ void StatusNotification::setInformation( const std::string& info, int index) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException("notification handle is null"); } } @@ -1261,13 +1263,13 @@ std::string StatusNotification::getSubInformation(int index) std::string strSubInfo; if (subInfo) strSubInfo = subInfo; - LogDebug(" subInfo " << strSubInfo); + LoggerD(" subInfo " << strSubInfo); return strSubInfo; } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } @@ -1278,8 +1280,8 @@ void StatusNotification::setSubInformation( const std::string& subInfo, int inde if (m_notiHandle) { int idx = index; - LogDebug(" index : " << idx); - LogDebug(" log : " << subInfo); + LoggerD(" index : " << idx); + LoggerD(" log : " << subInfo); notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; switch (idx) @@ -1312,7 +1314,7 @@ void StatusNotification::setSubInformation( const std::string& subInfo, int inde } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } @@ -1384,14 +1386,14 @@ void StatusNotification::loadThumbnails() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } } std::vector StatusNotification::getThumbnails() { - LogInfo(" thumbnail Size : " << m_thumbs.size()); + LoggerI(" thumbnail Size : " << m_thumbs.size()); return m_thumbs; } @@ -1399,7 +1401,7 @@ std::string StatusNotification::getThumbnail(int index) { if (m_notiHandle) { - LogInfo(" index : " << index); + LoggerI(" index : " << index); notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE; @@ -1445,7 +1447,7 @@ std::string StatusNotification::getThumbnail(int index) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } #if 0 @@ -1459,7 +1461,7 @@ std::string StatusNotification::getThumbnail(int index) void StatusNotification::setThumbnails(std::vector thumbs) { - LogInfo("set thumbnails"); + LoggerI("set thumbnails"); if (m_notiHandle) { std::vector::iterator it; @@ -1477,7 +1479,7 @@ void StatusNotification::setThumbnails(std::vector thumbs) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } } @@ -1486,8 +1488,8 @@ void StatusNotification::setThumbnail( const std::string& thumb, int index) { if (m_notiHandle) { - LogInfo(" index : " << index); - LogInfo(" thumb : " << thumb); + LoggerI(" index : " << index); + LoggerI(" thumb : " << thumb); notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE; switch (index) @@ -1527,7 +1529,7 @@ void StatusNotification::setThumbnail( const std::string& thumb, int index) std::string StatusNotification::getBackground() { - LogInfo(" Handle : " << m_notiHandle); + LoggerI(" Handle : " << m_notiHandle); if (m_notiHandle) { @@ -1545,7 +1547,7 @@ std::string StatusNotification::getBackground() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } @@ -1553,7 +1555,7 @@ std::string StatusNotification::getBackground() void StatusNotification::setBackground(const std::string imagePath) { - LogInfo(" imagePath : " << imagePath); + LoggerI(" imagePath : " << imagePath); if (m_notiHandle) { if (getBackground().compare(imagePath)) @@ -1567,14 +1569,14 @@ void StatusNotification::setBackground(const std::string imagePath) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } } long StatusNotification::getNumber() { - LogInfo("Handle = " << m_notiHandle); + LoggerI("Handle = " << m_notiHandle); if (m_notiHandle) { long number = 0; @@ -1588,22 +1590,22 @@ long StatusNotification::getNumber() if (strNumber) std::istringstream(strNumber) >> number; else - LogInfo("Number Is NULL"); + LoggerI("Number Is NULL"); - LogInfo("number = " << number); + LoggerI("number = " << number); return number; } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); return 0; } } const char* StatusNotification::getStrNumber() { - LogInfo("Handle = " << m_notiHandle); + LoggerI("Handle = " << m_notiHandle); if (m_notiHandle) { char *strNumber = NULL; @@ -1622,14 +1624,14 @@ const char* StatusNotification::getStrNumber() } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); return NULL; } } void StatusNotification::setNumber(const long number) { - LogInfo("Number = " << number); + LoggerI("Number = " << number); if (m_notiHandle) { if(number!=getNumber()) @@ -1652,7 +1654,7 @@ void StatusNotification::setNumber(const long number) } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } } @@ -1668,7 +1670,7 @@ void StatusNotification::setNotificationHandle(void *handle) { throw UnknownException( "notification handle null error"); } - LogInfo("handle = " << handle << " m_notiHandle = " << m_notiHandle); + LoggerI("handle = " << handle << " m_notiHandle = " << m_notiHandle); if (m_notiHandle != NULL) { @@ -1692,7 +1694,7 @@ service_h StatusNotification::getService() //Detail Info void StatusNotification::loadDetailInfos() { - LogInfo("noti Handle = " << m_notiHandle); + LoggerI("noti Handle = " << m_notiHandle); if (m_notiHandle) { @@ -1700,14 +1702,14 @@ void StatusNotification::loadDetailInfos() { std::string main = getInformation(idx); std::string sub = getSubInformation(idx); - LogInfo("Main : " << main << " Sub : " << sub); + LoggerI("Main : " << main << " Sub : " << sub); NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub); m_detailInfos.push_back(info); } } else { - LogDebug("noti Handle is NULL"); + LoggerD("noti Handle is NULL"); throw UnknownException( "notification handle is null"); } @@ -1720,7 +1722,7 @@ std::vector StatusNotification::getDetailInfos() const void StatusNotification::setDetailInfos(const std::vector value) { - LogInfo("DetailInfos = " << value.size()); + LoggerI("DetailInfos = " << value.size()); if (m_notiHandle) { @@ -1732,7 +1734,7 @@ void StatusNotification::setDetailInfos(const std::vectorgetMainText() << " sub " << info->getSubText() ); + LoggerI("main " << info->getMainText() << " sub " << info->getSubText() ); setInformation(info->getMainText(), idx); setSubInformation(info->getSubText(), idx); } @@ -1743,7 +1745,7 @@ void StatusNotification::setDetailInfos(const std::vectoraddGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Notification] on_frame_unload_callback (%p)" << context); + LoggerD("[Tizen\\Notification] on_frame_unload_callback (%p)" << context); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/Package/JSPackageInformation.cpp b/src/Package/JSPackageInformation.cpp index 29859c2..827410b 100644 --- a/src/Package/JSPackageInformation.cpp +++ b/src/Package/JSPackageInformation.cpp @@ -16,16 +16,13 @@ // #include - #include #include #include #include - -#include - #include "JSPackageInformation.h" #include "PackageInformation.h" +#include namespace DeviceAPI { namespace Package { @@ -84,10 +81,10 @@ JSClassRef JSPackageInformation::getClassRef() { JSValueRef JSPackageInformation::createJSObject(JSContextRef context, PackageInformation *pkgInfo) { - //LogError("createJSObject enter"); + //LoggerE("createJSObject enter"); JSObjectRef jsValueRef = JSObjectMake(context, getClassRef(), static_cast(pkgInfo)); if (NULL == jsValueRef) { - LogError("object creation error"); + LoggerE("object creation error"); return JSValueMakeUndefined(context); } @@ -97,12 +94,12 @@ JSValueRef JSPackageInformation::createJSObject(JSContextRef context, PackageInf void JSPackageInformation::initialize(JSContextRef context, JSObjectRef object) { - LOGI(">> initialize"); + LoggerD(">> initialize"); } void JSPackageInformation::finalize(JSObjectRef object) { - LOGI(">> finalize"); + LoggerD(">> finalize"); } bool JSPackageInformation::isObjectOfClass(JSContextRef context, JSValueRef value) diff --git a/src/Package/JSPackageManager.cpp b/src/Package/JSPackageManager.cpp index cd31cab..e9b2c9d 100644 --- a/src/Package/JSPackageManager.cpp +++ b/src/Package/JSPackageManager.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include "JSPackageManager.h" #include "JSPackageInformation.h" @@ -38,6 +37,7 @@ #include "PackageManager.h" #include "PackageInformation.h" #include "plugin_config.h" +#include namespace DeviceAPI { namespace Package { @@ -114,7 +114,7 @@ JSValueRef JSPackageManager::install(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL); @@ -171,7 +171,7 @@ JSValueRef JSPackageManager::uninstall(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_INSTALL); @@ -228,7 +228,7 @@ JSValueRef JSPackageManager::getPackagesInfo(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGES_INFO); @@ -264,7 +264,7 @@ JSValueRef JSPackageManager::getPackageInfo(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGE_INFO); @@ -273,7 +273,7 @@ JSValueRef JSPackageManager::getPackageInfo(JSContextRef context, try { ArgumentValidator validator(context, argumentCount, arguments); string id = validator.toString(0, true); - //LogDebug("id = " << id); + //LoggerD("id = " << id); PackageInformation* pkgInfo = PackageManager::getInstance()->getPackageInfo(id); TIME_TRACER_ITEM_END(__FUNCTION__, 0); @@ -295,7 +295,7 @@ JSValueRef JSPackageManager::setPackageInfoEventListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_SET_PACKAGE_INFO_EVENT_LISTENER); @@ -349,7 +349,7 @@ JSValueRef JSPackageManager::unsetPackageInfoEventListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_UNSET_PACKAGE_INFO_EVENT_LISTENER); @@ -374,7 +374,7 @@ JSValueRef JSPackageManager::move(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); //AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_MOVE); //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -420,13 +420,13 @@ JSValueRef JSPackageManager::move(JSContextRef context, PackageManager::getInstance()->move(id, storage, pkgInstallEventCB); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -441,7 +441,7 @@ JSValueRef JSPackageManager::isInstalled(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); //AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_IS_INSTALLED); //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -457,13 +457,13 @@ JSValueRef JSPackageManager::isInstalled(JSContextRef context, return converter.toJSValueRef(PackageManager::getInstance()->isInstalled(id)); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } @@ -477,7 +477,7 @@ JSValueRef JSPackageManager::getPackageIdFromAppId(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); //AceSecurityStatus status = PACKAGE_CHECK_ACCESS(PACKAGE_FUNCTION_API_GET_PACKAGE_ID_FROM_APP_ID); //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -493,13 +493,13 @@ JSValueRef JSPackageManager::getPackageIdFromAppId(JSContextRef context, return converter.toJSValueRef(PackageManager::getInstance()->getPackageIdFromAppId(id)); } Catch (NotFoundException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_FOUND_ERROR, _rethrown_exception.GetMessage()); } Catch (ConversionException) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, _rethrown_exception.GetMessage()); } Catch (Exception) { - LogWarning("Exception: "<<_rethrown_exception.GetMessage()); + LoggerW("Exception: "<<_rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, _rethrown_exception.GetMessage()); } diff --git a/src/Package/PackageInformation.h b/src/Package/PackageInformation.h index 86528a3..4309009 100644 --- a/src/Package/PackageInformation.h +++ b/src/Package/PackageInformation.h @@ -19,7 +19,7 @@ #define _TIZEN_PACKAGE_INFORMATION_H_ #include -#include +#include namespace DeviceAPI { namespace Package { diff --git a/src/Package/PackageManager.cpp b/src/Package/PackageManager.cpp index 556c460..52553ef 100644 --- a/src/Package/PackageManager.cpp +++ b/src/Package/PackageManager.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include @@ -39,6 +38,7 @@ #include "PackageManager.h" #include "PackageInformation.h" #include "JSPackageInformation.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -93,6 +93,7 @@ PackageInfoEventCallback::PackageInfoEventCallback(CallbackUserData* oninstalled m_oninstalled = oninstalled; m_onupdated = onupdated; m_onuninstalled = onuninstalled; + m_handle_p = NULL; } PackageInfoEventCallback::~PackageInfoEventCallback() @@ -122,6 +123,15 @@ CallbackUserData* PackageInfoEventCallback::getOnUninstalled() return m_onuninstalled; } +pkgmgr_client** PackageInfoEventCallback::getEventHandler() +{ + return m_handle_p; +} + +void PackageInfoEventCallback::setEventHandler(pkgmgr_client **handler) +{ + m_handle_p = handler; +} PackageInstallEventCallback::PackageInstallEventCallback(JSContextRef globalCtx, CallbackUserData* onprogress, CallbackUserData* oncomplete, CallbackUserData* onerror) { @@ -136,7 +146,7 @@ PackageInstallEventCallback::PackageInstallEventCallback(JSContextRef globalCtx, PackageInstallEventCallback::~PackageInstallEventCallback() { if (m_request_handle != NULL) { - LogDebug("destroy client handle"); + LoggerD("destroy client handle"); //package_manager_request_destroy(m_request_handle); package_manager_client_destroy(m_request_handle); } @@ -183,35 +193,35 @@ package_manager_request_h PackageInstallEventCallback::getHandle() static int get_current_pkg_id(char** pkg_id) { - LogDebug("get_current_pkg_id enter"); + LoggerD("get_current_pkg_id enter"); int parent_pid = getppid(); - LogDebug("parent pid : " << parent_pid); + LoggerD("parent pid : " << parent_pid); char* app_id = NULL; app_info_h handle; int ret = app_manager_get_app_id(parent_pid, &app_id); if ((ret != APP_MANAGER_ERROR_NONE) || (app_id == NULL)) { - LogDebug("Cannot get app id from pid : " << parent_pid); + LoggerD("Cannot get app id from pid : " << parent_pid); return ret; } else { - LogDebug("app_id : " << app_id); + LoggerD("app_id : " << app_id); } ret = app_manager_get_app_info(app_id, &handle); if (ret != APP_MANAGER_ERROR_NONE) { - LogDebug("Fail to get appinfo by " << app_id); + LoggerD("Fail to get appinfo by " << app_id); return ret; } ret = app_info_get_package(handle, pkg_id); if ((ret != APP_MANAGER_ERROR_NONE) || (*pkg_id == NULL)) { - LogDebug("Fail to get pkg_id by " << app_id); + LoggerD("Fail to get pkg_id by " << app_id); return ret; } ret = app_info_destroy(handle); if (ret != APP_MANAGER_ERROR_NONE) { - LogDebug("Fail to get destory appinfo"); + LoggerD("Fail to get destory appinfo"); return ret; } @@ -220,7 +230,7 @@ static int get_current_pkg_id(char** pkg_id) static bool app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data) { - //LogDebug("app_callback enter : " << app_id); + //LoggerD("app_callback enter : " << app_id); PackageInformation* pkgInfo = (PackageInformation*)user_data; pkgInfo->m_appIds.push_back(app_id); return true; @@ -228,7 +238,7 @@ static bool app_callback(package_info_app_component_type_e comp_type, const char static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle) { - //LogDebug("enter"); + //LoggerD("enter"); PackageInformation *pkgInfo = new PackageInformation(); @@ -247,7 +257,7 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle) ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &id); if ((ret != PMINFO_R_OK) || (id == NULL)) { - LogDebug("Fail to get id. return NULL."); + LoggerD("Fail to get id. return NULL."); delete pkgInfo; return NULL; } else { @@ -256,63 +266,63 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle) ret = pkgmgrinfo_pkginfo_get_label(handle, &name); if ((ret != PMINFO_R_OK) || (name == NULL)) { - LogDebug("Fail to get labe"); + LoggerD("Fail to get labe"); } else { pkgInfo->m_name = name; } ret = pkgmgrinfo_pkginfo_get_icon(handle, &iconPath); if ((ret != PMINFO_R_OK) || (iconPath == NULL)) { - LogDebug("Fail to get iconPath"); + LoggerD("Fail to get iconPath"); } else { pkgInfo->m_iconPath = iconPath; } ret = pkgmgrinfo_pkginfo_get_version(handle, &version); if ((ret != PMINFO_R_OK) || (version == NULL)) { - LogDebug("Fail to get version"); + LoggerD("Fail to get version"); } else { pkgInfo->m_version = version; } ret = pkgmgrinfo_pkginfo_get_total_size(handle, &totalSize); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get totalSize"); + LoggerD("Fail to get totalSize"); } else { pkgInfo->m_totalSize = totalSize; } ret = pkgmgrinfo_pkginfo_get_data_size(handle, &dataSize); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get dataSize"); + LoggerD("Fail to get dataSize"); } else { pkgInfo->m_dataSize = dataSize; } ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &lastModified); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get lastModified"); + LoggerD("Fail to get lastModified"); } else { pkgInfo->m_lastModified = lastModified; } ret = pkgmgrinfo_pkginfo_get_type(handle, &type); if ((ret != PMINFO_R_OK) || (type == NULL)) { - LogDebug("Fail to get type"); + LoggerD("Fail to get type"); } else { pkgInfo->m_type = type; } ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author); if ((ret != PMINFO_R_OK) || (author == NULL)) { - LogDebug("Fail to get author"); + LoggerD("Fail to get author"); } else { pkgInfo->m_author = author; } ret = pkgmgrinfo_pkginfo_get_description(handle, &description); if ((ret != PMINFO_R_OK) || (description == NULL)) { - LogDebug("Fail to get description"); + LoggerD("Fail to get description"); } else { pkgInfo->m_description = description; } @@ -321,19 +331,19 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle) ret = package_manager_get_package_info(id, &package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot create package info by : " << id); + LoggerD("Cannot create package info by : " << id); delete pkgInfo; return NULL; } ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, (void*)pkgInfo); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("failed while getting appids"); + LoggerD("failed while getting appids"); } ret = package_info_destroy(package_info); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("Cannot destroy package info"); + LoggerD("Cannot destroy package info"); } // REMARK: do not destroy handle. because handle is comes from outside!! @@ -342,7 +352,7 @@ static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle) static gboolean getCompleteCB(void *data) { - LogDebug("entered"); + LoggerD("entered"); PackageInfoCallbackData *callback = (PackageInfoCallbackData *)data; JSContextRef context = callback->getContext(); @@ -368,7 +378,7 @@ static gboolean getCompleteCB(void *data) callback->callSuccessCallback(jsResult); } else { - LogDebug("Fail!!"); + LoggerD("Fail!!"); JSValueRef error = JSTizenExceptionFactory::makeErrorObject(callback->getContext(), JSTizenException::UNKNOWN_ERROR, "platform exception"); callback->callErrorCallback(error); } @@ -381,27 +391,27 @@ static gboolean getCompleteCB(void *data) static int get_package_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data) { - //LogDebug("entered"); + //LoggerD("entered"); PackageInfoCallbackData *callback = (PackageInfoCallbackData *)user_data; PackageInformation* pkgInfo = create_pkg_info(handle); if (pkgInfo != NULL) { callback->addPackageInfo(*pkgInfo); delete pkgInfo; } else { - LogError("Fail to get pkgInfo"); + LoggerE("Fail to get pkgInfo"); } return 0; } static void getThreadCB(void *data, Ecore_Thread *thread) { - LogDebug("entered"); + LoggerD("entered"); PackageInfoCallbackData *callback = (PackageInfoCallbackData *)data; int ret = pkgmgrinfo_pkginfo_get_list(get_package_list_cb, data); if (ret != PMINFO_R_OK) { - LogDebug("Fail to get package info"); + LoggerD("Fail to get package info"); callback->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::PlatformException); } @@ -420,7 +430,7 @@ static void package_event_cb(app_manger_event_type_e event_type, const char *pac pkgmgrinfo_pkginfo_h handle; int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle); if (ret != PMINFO_R_OK) { - LogDebug("fail to find pkg info with given pkg : " << package); + LoggerD("fail to find pkg info with given pkg : " << package); // Do not throw exception. No one can handle exception because this code is called from async callback. //throw NotFoundException("Can't find given package"); break; @@ -430,7 +440,7 @@ static void package_event_cb(app_manger_event_type_e event_type, const char *pac pkgmgrinfo_appinfo_destroy_appinfo(handle); if (pkgInfo == NULL) { - LogDebug("Fail to get pkg info. skip callback call for pkgid " << package); + LoggerD("Fail to get pkg info. skip callback call for pkgid " << package); } else { CallbackUserData *callback = eventCB->getOnInstalled(); if (callback) { @@ -440,7 +450,7 @@ static void package_event_cb(app_manger_event_type_e event_type, const char *pac break; } case APP_MANAGER_EVENT_UNINSTALLED: { - LogDebug("uninstall : " << package); + LoggerD("uninstall : " << package); CallbackUserData *callback = eventCB->getOnUninstalled(); if (callback) { Converter converter(callback->getContext()); @@ -461,7 +471,7 @@ static void package_event_cb(app_manger_event_type_e event_type, const char *pac pkgmgrinfo_appinfo_destroy_appinfo(handle); if (pkgInfo == NULL) { - LogDebug("Fail to get pkg info. skip callback call for pkgid " << package); + LoggerD("Fail to get pkg info. skip callback call for pkgid " << package); } else { CallbackUserData *callback = eventCB->getOnUpdated(); if (callback) { @@ -471,7 +481,7 @@ static void package_event_cb(app_manger_event_type_e event_type, const char *pac break; } default: - LogDebug("Fail!! Unknown event type is entered : " << event_type); + LoggerD("Fail!! Unknown event type is entered : " << event_type); break; } @@ -484,6 +494,7 @@ static int app_list_changed_cb_broker(int id, const char *type, const char *pack if (!strcasecmp(key, "start")) { + LoggerD("start "); if (!strcasecmp(val, "install")) { event_type = APP_MANAGER_EVENT_INSTALLED; @@ -499,13 +510,24 @@ static int app_list_changed_cb_broker(int id, const char *type, const char *pack } else if (!strcasecmp(key, "end") && !strcasecmp(val, "ok")) { + LoggerD("end "); if (event_type >= 0) { package_event_cb(event_type, package, data); + + // Check whether handler is freed in the callback function or not. + // if freed, return error code to avoid iteration of callback function. (core platform side) + PackageInfoEventCallback * callback = (PackageInfoEventCallback *)data; + pkgmgr_client ** handler_p = callback->getEventHandler(); + if (*handler_p == NULL) { + LoggerD("handler is NULL"); + return -1; + } + LoggerD("handler is not NULL"); } } - return APP_MANAGER_ERROR_NONE; + return 0; } @@ -516,7 +538,7 @@ void install_request_cb(int id, const char *type, const char *package, package_manager_error_e error, void *user_data) { - LogDebug("install_request_cb "); + LoggerD("install_request_cb "); PackageInstallEventCallback *callback = (PackageInstallEventCallback *)user_data; JSContextRef context = callback->getContext();; @@ -527,7 +549,7 @@ void install_request_cb(int id, const char *type, const char *package, callback->getOnComplete()->callSuccessCallback(converter.toJSValueRef(package)); } - LogDebug("destroy client handle"); + LoggerD("destroy client handle"); // this api is not supported from platform. //package_manager_request_destroy(callback->getHandle()); package_manager_client_destroy(callback->getHandle()); @@ -550,7 +572,7 @@ void install_request_cb(int id, const char *type, const char *package, callback->getOnError()->callSuccessCallback(jsError); } - LogDebug("destroy client handle"); + LoggerD("destroy client handle"); // this api is not supported from platform. //package_manager_request_destroy(callback->getHandle()); package_manager_client_destroy(callback->getHandle()); @@ -575,7 +597,7 @@ void install_request_cb(int id, const char *type, const char *package, if (callback->getOnError()) { callback->getOnError()->callSuccessCallback(error); } - LogDebug("destroy client handle"); + LoggerD("destroy client handle"); // this api is not supported from platform. //package_manager_request_destroy(callback->getHandle()); package_manager_client_destroy(callback->getHandle()); @@ -591,7 +613,7 @@ void install_request_cb(int id, const char *type, const char *package, void PackageManager::install(string pkgPath, PackageInstallEventCallback* callback) { - LogDebug("install"); + LoggerD("install"); int ret = 0; int id = 0; package_manager_request_h request_h; @@ -611,7 +633,7 @@ void PackageManager::install(string pkgPath, PackageInstallEventCallback* callba ret = package_manager_request_install(request_h, pkgPath.c_str(), &id); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("error : " << pkgPath); + LoggerD("error : " << pkgPath); if (errCallback) { JSValueRef error = JSTizenExceptionFactory::makeErrorObject(globalCtx, JSTizenException::NOT_FOUND_ERROR, "Not proper file"); @@ -637,7 +659,7 @@ void PackageManager::install(string pkgPath, PackageInstallEventCallback* callba void PackageManager::uninstall(string pkgPath, PackageInstallEventCallback* callback) { - LogDebug("uninstall"); + LoggerD("uninstall"); int ret = 0; int id = 0; package_manager_request_h request_h; @@ -658,7 +680,7 @@ void PackageManager::uninstall(string pkgPath, PackageInstallEventCallback* call ret = package_manager_request_uninstall(request_h, pkgPath.c_str(), &id); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogDebug("error : " << pkgPath); + LoggerD("error : " << pkgPath); if (errCallback) { JSValueRef error = JSTizenExceptionFactory::makeErrorObject(globalCtx, JSTizenException::NOT_FOUND_ERROR, "Not proper file"); @@ -693,7 +715,7 @@ PackageInformation* PackageManager::getPackageInfo(string pkgId) int ret = get_current_pkg_id(&pkg_id); if((ret != APP_MANAGER_ERROR_NONE) || (pkg_id == NULL)) { - LogError("Can not get app id from current pid (" << ret << ")"); + LoggerE("Can not get app id from current pid (" << ret << ")"); throw NotFoundException("Can't find given package"); } pkgId = pkg_id; @@ -719,7 +741,7 @@ PackageInformation* PackageManager::getPackageInfo(string pkgId) void PackageManager::getPackagesInfo(PackageInfoCallbackData *user_data) { - LogDebug("entered"); + LoggerD("entered"); // getting info of all package from other thread. the result callback will be called on main thread ecore_thread_run(getThreadCB, NULL, NULL, user_data); @@ -728,7 +750,7 @@ void PackageManager::getPackagesInfo(PackageInfoCallbackData *user_data) void PackageManager::setPackageInfoEventListener(PackageInfoEventCallback * eventCB) { - LogDebug("enter"); + LoggerD("enter"); if (m_manager_handle == NULL) { m_manager_handle = pkgmgr_client_new(PC_LISTENING); @@ -737,15 +759,17 @@ void PackageManager::setPackageInfoEventListener(PackageInfoEventCallback * even } } + eventCB->setEventHandler(&m_manager_handle); + pkgmgr_client_listen_status(m_manager_handle, app_list_changed_cb_broker, eventCB); } void PackageManager::unsetPackageInfoEventListener() { - LogDebug("enter"); + LoggerD("enter"); if (m_manager_handle == NULL) { - LogDebug("no package manager handle registered"); + LoggerD("no package manager handle registered"); return; } @@ -754,19 +778,19 @@ void PackageManager::unsetPackageInfoEventListener() } PackageManager* PackageManager::getInstance(){ - LogDebug("enter to getInstance()"); + LoggerD("enter to getInstance()"); static PackageManager instance; return &instance; } PackageManager::PackageManager() { - LogDebug("Create PackageManager"); + LoggerD("Create PackageManager"); } PackageManager::~PackageManager() { - LogDebug("Destroy PackageManager"); + LoggerD("Destroy PackageManager"); if (m_manager_handle != NULL) { pkgmgr_client_free(m_manager_handle); @@ -780,7 +804,7 @@ PackageManager::~PackageManager() #if 0 void PackageManager::move(string pkgPath, string target, PackageInstallEventCallback* callback) { - LogDebug("entered : " << pkgPath); + LoggerD("entered : " << pkgPath); int ret = 0; package_manager_move_type_e type = PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL; @@ -813,13 +837,13 @@ void PackageManager::move(string pkgPath, string target, PackageInstallEventCall bool PackageManager::isInstalled(string pkgId) { - LogDebug("pkgId = " << pkgId); + LoggerD("pkgId = " << pkgId); package_info_h handle; int ret = 0; ret = package_manager_get_package_info(pkgId.c_str(), &handle); if (ret == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE) { - LogError("No patched package: " << pkgId); + LoggerE("No patched package: " << pkgId); return false; } else if (ret == PACKAGE_MANAGER_ERROR_NONE) { // TODO: Should I exception handling while destory handle? what should I do for that time? @@ -832,14 +856,14 @@ bool PackageManager::isInstalled(string pkgId) string PackageManager::getPackageIdFromAppId(string appId) { - LogDebug("appId = " << appId); + LoggerD("appId = " << appId); char *pkg_id = NULL; string pkgId; int ret = 0; ret = package_manager_get_package_id_by_app_id(appId.c_str(), &pkg_id); if (ret != PACKAGE_MANAGER_ERROR_NONE) { - LogError("Error on get pkgId from appId : " << appId); + LoggerE("Error on get pkgId from appId : " << appId); ThrowMsg(NotFoundException, "Not found pkg"); } diff --git a/src/Package/PackageManager.h b/src/Package/PackageManager.h index c037876..f78f98e 100644 --- a/src/Package/PackageManager.h +++ b/src/Package/PackageManager.h @@ -63,11 +63,14 @@ public: CallbackUserData* getOnInstalled(); CallbackUserData* getOnUpdated(); CallbackUserData* getOnUninstalled(); + pkgmgr_client ** getEventHandler(); + void setEventHandler(pkgmgr_client **handle_p); private: CallbackUserData* m_oninstalled; CallbackUserData* m_onupdated; CallbackUserData* m_onuninstalled; + pkgmgr_client **m_handle_p; }; class PackageInstallEventCallback diff --git a/src/Package/plugin_initializer.cpp b/src/Package/plugin_initializer.cpp index 9345146..2706b29 100644 --- a/src/Package/plugin_initializer.cpp +++ b/src/Package/plugin_initializer.cpp @@ -15,12 +15,12 @@ // limitations under the License. // -#include #include #include #include #include #include "JSPackageManager.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; @@ -30,35 +30,35 @@ namespace DeviceAPI { namespace Package { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen2_1\\Package] on_widget_start_callback ("<addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Package] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\Package] on_frame_unload_callback (" << context << ")"); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/Power/JSPowerManager.cpp b/src/Power/JSPowerManager.cpp old mode 100755 new mode 100644 index 82c55de..b42bf04 --- a/src/Power/JSPowerManager.cpp +++ b/src/Power/JSPowerManager.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include "JSPowerManager.h" #include "plugin_config.h" #include "PowerManager.h" +#include using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -107,7 +107,7 @@ JSValueRef JSPowerManager::request(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_REQUEST); @@ -135,7 +135,7 @@ JSValueRef JSPowerManager::release(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try{ @@ -159,7 +159,7 @@ JSValueRef JSPowerManager::setScreenStateChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try{ @@ -190,7 +190,7 @@ JSValueRef JSPowerManager::unsetScreenStateChangeListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); CallbackUserData *callback = static_cast(JSObjectGetPrivate(thisObject)); @@ -210,7 +210,7 @@ JSValueRef JSPowerManager::getScreenBrightness(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try{ @@ -229,7 +229,7 @@ JSValueRef JSPowerManager::setScreenBrightness(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -254,7 +254,7 @@ JSValueRef JSPowerManager::isScreenOn(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try{ @@ -273,7 +273,7 @@ JSValueRef JSPowerManager::restoreScreenBrightness(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); try{ @@ -291,7 +291,7 @@ JSValueRef JSPowerManager::turnScreenOn(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -312,7 +312,7 @@ JSValueRef JSPowerManager::turnScreenOff(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); AceSecurityStatus status = POWER_CHECK_ACCESS(POWER_FUNCTION_API_RELEASE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); diff --git a/src/Power/PowerManager.cpp b/src/Power/PowerManager.cpp old mode 100755 new mode 100644 index b12f74f..26610af --- a/src/Power/PowerManager.cpp +++ b/src/Power/PowerManager.cpp @@ -20,12 +20,11 @@ #include #include #include -#include #include #include -#include #include #include +#include using namespace DeviceAPI::Common; using namespace std; @@ -74,7 +73,7 @@ const std::string PowerState::toString(){ void PowerManager::onPlatformStateChangedCB(power_state_e state, void *user_data){ PowerManager* object = static_cast(user_data); if(object == NULL){ - LOGE("User data is NULL"); + LoggerE("User data is NULL"); return; } PowerState current(PowerState::SCREENOFF); @@ -115,7 +114,7 @@ void PowerManager::request(PowerResource resource, PowerState state){ ret = power_lock_state( (power_state_e)native_state , 0); if( POWER_ERROR_NONE!=ret ){ - LOGE("power_lock_state(%d) error %d",native_state, ret); + LoggerE("power_lock_state(%d) error %d",native_state, ret); throw UnknownException("power_lock_state error"); } break; @@ -125,7 +124,7 @@ void PowerManager::request(PowerResource resource, PowerState state){ int maxBrightness; ret = device_get_max_brightness(0, &maxBrightness); if( DEVICE_ERROR_NONE!=ret) { - LOGE("Platform error while getting max brightness: %d", ret); + LoggerE("Platform error while getting max brightness: %d", ret); throw UnknownException("Platform error while getting max brightness"); } @@ -134,7 +133,7 @@ void PowerManager::request(PowerResource resource, PowerState state){ LOGI("Succeeded setting the brightness to a max level: %d", maxBrightness); ret = power_lock_state(POWER_STATE_NORMAL, 0); if( POWER_ERROR_NONE!=ret ){ - LOGE("Platform error while locking state %d", ret); + LoggerE("Platform error while locking state %d", ret); throw UnknownException("Platform error while locking state"); } @@ -145,7 +144,7 @@ void PowerManager::request(PowerResource resource, PowerState state){ break; } case PowerState::SCREENOFF: - LOGE("SCREEN_OFF state cannot be requested"); + LoggerE("SCREEN_OFF state cannot be requested"); throw InvalidValuesException("SCREEN_OFF state cannot be requested"); default : @@ -167,7 +166,7 @@ void PowerManager::release(PowerResource resource){ if( mBrightStateEnable ){ ret = device_set_brightness_from_settings(0); if( DEVICE_ERROR_NONE!=ret){ - LOGE("Platform error while setting restore brightness %d", ret); + LoggerE("Platform error while setting restore brightness %d", ret); throw UnknownException("Platform error while setting restore brightness"); } } @@ -198,7 +197,7 @@ void PowerManager::setScreenBrightness(double brightness){ int maxBrightness; ret = device_get_max_brightness(0, &maxBrightness); if( ret != 0 ){ - LOGE("Platform error while setting restore brightness: %d", ret); + LoggerE("Platform error while setting restore brightness: %d", ret); throw UnknownException("Platform error while getting max brightness"); } int nativeBrightness = (int)(brightness*maxBrightness); @@ -223,7 +222,7 @@ void PowerManager::setScreenState(bool onoff){ ret = pm_change_state(LCD_OFF); if( ret<0 ){ - LOGE("Platform error while changing screen state %d", ret); + LoggerE("Platform error while changing screen state %d", ret); throw UnknownException("Platform error while changing screen state"); } } @@ -232,7 +231,7 @@ void PowerManager::restoreScreenBrightness(){ int ret; ret = device_set_brightness_from_settings(0); if( DEVICE_ERROR_NONE!=ret){ - LOGE("Platform error while restoring brightness %d", ret); + LoggerE("Platform error while restoring brightness %d", ret); throw UnknownException("Platform error while restoring brightness"); } } @@ -266,7 +265,7 @@ void PowerManager::setPlatformBrightness(int brightness){ int ret = device_set_brightness(0, brightness); if( ret != 0){ - LOGE("Platform error while setting %d brightness: %d", brightness, ret); + LoggerE("Platform error while setting %d brightness: %d", brightness, ret); throw UnknownException("Platform error while setting brightness."); } mCurrentBrightness = brightness; @@ -285,10 +284,10 @@ int PowerManager::getPlatformBrightness(){ ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness); if( ret != 0 ){ - LOGE("Platform error while getting brightness: %d", ret); + LoggerE("Platform error while getting brightness: %d", ret); throw UnknownException("Platform error while getting brightness"); } - LOGE("VCONFKEY_SETAPPL_LCD_BRIGHTNESS %d", brightness); + LoggerE("VCONFKEY_SETAPPL_LCD_BRIGHTNESS %d", brightness); return brightness; } @@ -321,7 +320,7 @@ void PowerManager::broadcastScreenState(PowerState current){ restoreSettedBrightness(); } catch( const BasePlatformException& err){ - LOGE("Error restore custom brightness %s", err.getMessage().c_str()); + LoggerE("Error restore custom brightness %s", err.getMessage().c_str()); } } if( mCurrentState.mState == PowerState::SCREENNORMAL && PreviousState.mState == PowerState::SCREENOFF){ diff --git a/src/Power/plugin_initializer.cpp b/src/Power/plugin_initializer.cpp old mode 100755 new mode 100644 index aef48eb..2e9cdb3 --- a/src/Power/plugin_initializer.cpp +++ b/src/Power/plugin_initializer.cpp @@ -33,38 +33,38 @@ using namespace DeviceAPI::Common; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Power] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Power] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch (Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Power] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Power] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Power"); TIME_TRACER_RELEASE(); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch (Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\Power] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\Power] on_frame_load_callback (" << context << ")"); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Power] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\Power] on_frame_unload_callback (" << context << ")"); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/Power/test/main.cpp b/src/Power/test/main.cpp index 6e3683e..385b7b6 100755 --- a/src/Power/test/main.cpp +++ b/src/Power/test/main.cpp @@ -63,7 +63,12 @@ int main(int argc, char** argv){ DPL::Log::LogSystemSingleton::Instance().SetTag("STANDALONE"); //DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler(); - WrtAccessSingleton::Instance().initialize(0); + try{ + WrtAccessSingleton::Instance().initialize(0); + }catch(...){ + printf("ERROR: Cannot init WrtAccessSingleton\n"); + return -1; + } StandaloneConsole console; @@ -72,7 +77,7 @@ int main(int argc, char** argv){ console.registModule("power", JSPowerManager::getClassRef(), NULL); if( argc > 1 ){ - for(unsigned int i = 1 ; i< argc; i++){ + for(unsigned int i = 1 ; i< (unsigned int)argc; i++){ console.RunScript(argv[i]); } } diff --git a/src/Push/JSPushManager.cpp b/src/Push/JSPushManager.cpp index 3abc0e7..2ef763a 100644 --- a/src/Push/JSPushManager.cpp +++ b/src/Push/JSPushManager.cpp @@ -144,11 +144,11 @@ JSValueRef JSPushManager::registerService(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in PushManager.registerService()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -193,11 +193,11 @@ JSValueRef JSPushManager::unregisterService(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in PushManager.unregisterService()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -236,11 +236,11 @@ JSValueRef JSPushManager::connectService(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in PushManager.connectService()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -269,11 +269,11 @@ JSValueRef JSPushManager::disconnectService(JSContextRef context, TIME_TRACER_ITEM_END(__FUNCTION__, 0); return JSValueMakeUndefined(context); } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in PushManager.disconnectService()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } @@ -306,11 +306,11 @@ JSValueRef JSPushManager::getRegistrationId(JSContextRef context, return JSUtil::toJSValueRef(context, ret); } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } catch (...) { DeviceAPI::Common::UnknownException err("Unknown Error in PushManager.getRegistrationId()."); - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } } diff --git a/src/Push/PushManager.cpp b/src/Push/PushManager.cpp index 5880bb0..235c24c 100644 --- a/src/Push/PushManager.cpp +++ b/src/Push/PushManager.cpp @@ -74,7 +74,7 @@ static std::string _get_internal_error(int err) } if (!success) { - LogError("Platform error %d <%s>", err, msg.c_str()); + LoggerE("Platform error %d <%s>", err, msg.c_str()); } return msg; @@ -149,9 +149,9 @@ static void get_param(const char *msg, const char *name, char **value) static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id) { - LogDebug("get_current_pkg_id enter"); + LoggerD("get_current_pkg_id enter"); int parent_pid = getppid(); - LogDebug("parent pid : " << parent_pid); + LoggerD("parent pid : " << parent_pid); char *_app_id = NULL; char *_pkg_id = NULL; @@ -159,29 +159,29 @@ static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id) int ret = app_manager_get_app_id(parent_pid, &_app_id); if ((ret != APP_MANAGER_ERROR_NONE) || (_app_id == NULL)) { - LogDebug("Cannot get app id from pid : " << parent_pid); + LoggerD("Cannot get app id from pid : " << parent_pid); return ret; } else { - LogDebug("app_id : " << _app_id); + LoggerD("app_id : " << _app_id); } ret = app_manager_get_app_info(_app_id, &handle); if (ret != APP_MANAGER_ERROR_NONE) { - LogDebug("Fail to get appinfo by " << _app_id); + LoggerD("Fail to get appinfo by " << _app_id); return ret; } ret = app_info_get_package(handle, &_pkg_id); if ((ret != APP_MANAGER_ERROR_NONE) || (_pkg_id == NULL)) { - LogDebug("Fail to get pkg_id by " << _app_id); + LoggerD("Fail to get pkg_id by " << _app_id); } ret = app_info_destroy(handle); if (ret != APP_MANAGER_ERROR_NONE) { - LogDebug("Fail to get destory appinfo"); + LoggerD("Fail to get destory appinfo"); return ret; } @@ -193,11 +193,11 @@ static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id) static void push_connection_state_cb(push_state_e state, const char *err, void *user_data) { - LogInfo("Push connection state cb with state: "<< state <<", err: "<< err); + LoggerI("Push connection state cb with state: "<< state <<", err: "<< err); PushManager *thisPushManager = static_cast(user_data); if (!thisPushManager) { - LogError("user_data of push_connection_state_cb() is NULL."); + LoggerE("user_data of push_connection_state_cb() is NULL."); } else { thisPushManager->m_connectionState = state; } @@ -211,7 +211,7 @@ static void push_notify_cb(push_notification_h noti, void *user_data) char *alertMessage = NULL; long long int date = -1; - LogInfo("Push notification cb"); + LoggerI("Push notification cb"); try { PushManager *thisPushManager = static_cast(user_data); @@ -221,7 +221,7 @@ static void push_notify_cb(push_notification_h noti, void *user_data) MultiCallbackUserDataPtr callback = thisPushManager->m_notificationCallback; if (!callback) { - LogWarning("notification callback is not set. ignored."); + LoggerW("notification callback is not set. ignored."); return; } @@ -243,7 +243,7 @@ static void push_notify_cb(push_notification_h noti, void *user_data) ret = push_get_notification_time(noti, &date); if (ret != PUSH_ERROR_NONE) { - LogError("Platform error while getting notification date/time. " << _get_internal_error(ret)); + LoggerE("Platform error while getting notification date/time. " << _get_internal_error(ret)); } PushMessage *pushMessage = new PushMessage(); @@ -264,7 +264,7 @@ static void push_notify_cb(push_notification_h noti, void *user_data) callback->invokeCallback("onsuccess", pushMessageObj); } catch (const BasePlatformException &err) { - LogError(err.getMessage()); + LoggerE(err.getMessage()); } } @@ -273,7 +273,7 @@ static void push_registration_result_cb(push_result_e result, const char *msg, v int ret; char *tmp = NULL; - LogInfo("Push registration cb"); + LoggerI("Push registration cb"); try { PushManager *thisPushManager = static_cast(user_data); @@ -302,13 +302,13 @@ static void push_registration_result_cb(push_result_e result, const char *msg, v callback->invokeCallback("onerror", errorObj); } } catch (const BasePlatformException &err) { - LogError(err.getMessage()); + LoggerE(err.getMessage()); } } static void push_unregistration_result_cb(push_result_e result, const char *msg, void *user_data) { - LogInfo("Push unregistration cb"); + LoggerI("Push unregistration cb"); try { PushManager *thisPushManager = static_cast(user_data); @@ -329,7 +329,7 @@ static void push_unregistration_result_cb(push_result_e result, const char *msg, callback->invokeCallback("onerror", errorObj); } } catch (const BasePlatformException &err) { - LogError(err.getMessage()); + LoggerE(err.getMessage()); } } @@ -339,28 +339,28 @@ PushManager::PushManager(): m_connectionState(PUSH_STATE_UNREGISTERED), m_connectionHandle(NULL) { - LogInfo("Connecting to the push service..."); + LoggerI("Connecting to the push service..."); int ret; ret = get_current_app_id_and_pkg_id(&m_appId, &m_pkgId); if (APP_ERROR_NONE != ret) { - LogError("Error while getting app id: "<getUri().compare("") != 0) { ret = service_set_uri(service, appControl->getUri().c_str()); if (ret != SERVICE_ERROR_NONE) { - LogWarning("Platform error while setting uri to appControl. " << _get_internal_error(ret)); + LoggerW("Platform error while setting uri to appControl. " << _get_internal_error(ret)); } } if (appControl->getMime().compare("") != 0) { ret = service_set_mime(service, appControl->getMime().c_str()); if (ret != SERVICE_ERROR_NONE) { - LogWarning("Platform error while setting mime to appControl. " << _get_internal_error(ret)); + LoggerW("Platform error while setting mime to appControl. " << _get_internal_error(ret)); } } @@ -425,7 +425,7 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac for (size_t i = 0; i < controlDataArray.size(); i++) { key = controlDataArray.at(i)->getKey(); if (key.empty()) { - LogWarning("Invalid key for " << i << " in ApplicationControl's data array."); + LoggerW("Invalid key for " << i << " in ApplicationControl's data array."); } else { std::vector valueArray = controlDataArray.at(i)->getValue(); size_t size = valueArray.size(); @@ -442,12 +442,12 @@ void PushManager::registerService(ApplicationControlPtr appControl, MultiCallbac if (size == 1) { ret = service_add_extra_data(service, (const char*)key.c_str(), arr[0]); if (ret != SERVICE_ERROR_NONE) { - LogWarning("Platform error while adding extra data to appControl. " << _get_internal_error(ret)); + LoggerW("Platform error while adding extra data to appControl. " << _get_internal_error(ret)); } } else { ret = service_add_extra_data_array(service, (const char*)key.c_str(), arr, size); if (ret != SERVICE_ERROR_NONE) { - LogWarning("Platform error while adding extra data array to appControl. " << _get_internal_error(ret)); + LoggerW("Platform error while adding extra data array to appControl. " << _get_internal_error(ret)); } } @@ -503,7 +503,7 @@ std::string PushManager::getRegistrationId() ret = push_get_registration_id(m_connectionHandle, ®Id); if (ret != PUSH_ERROR_NONE) { - LogWarning("Platform error while getting registration id. " << _get_internal_error(ret)); + LoggerW("Platform error while getting registration id. " << _get_internal_error(ret)); } else { if (regId) { str = regId; diff --git a/src/Push/config.xml b/src/Push/config.xml old mode 100755 new mode 100644 diff --git a/src/Push/plugin_initializer.cpp b/src/Push/plugin_initializer.cpp index d5e506f..4d7f9dd 100644 --- a/src/Push/plugin_initializer.cpp +++ b/src/Push/plugin_initializer.cpp @@ -35,36 +35,36 @@ namespace Push { void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Push] on_widget_start_callback (%d)", widgetId); + LoggerD("[Tizen\\Push] on_widget_start_callback (%d)", widgetId); TIME_TRACER_INIT(); try { WrtAccessSingleton::Instance().initialize(widgetId); } catch (...) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Push] on_widget_stop_callback (%d)", widgetId); + LoggerD("[Tizen\\Push] on_widget_stop_callback (%d)", widgetId); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"Push"); TIME_TRACER_RELEASE(); try { WrtAccessSingleton::Instance().deinitialize(widgetId); } catch (...) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\Push] on_frame_load_callback (%p)", context); + LoggerD("[Tizen\\Push] on_frame_load_callback (%p)", context); GlobalContextManager::getInstance()->addGlobalContext(static_cast(context)); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\Push] on_frame_unload_callback (%p)", context); + LoggerD("[Tizen\\Push] on_frame_unload_callback (%p)", context); GlobalContextManager::getInstance()->removeGlobalContext(static_cast(context)); } diff --git a/src/SecureElement/JSSEChannel.cpp b/src/SecureElement/JSSEChannel.cpp old mode 100755 new mode 100644 index 21f00a4..9f9fa06 --- a/src/SecureElement/JSSEChannel.cpp +++ b/src/SecureElement/JSSEChannel.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -34,6 +32,7 @@ #include "SEAsyncCallbackManager.h" #include "SEConverter.h" #include "plugin_config.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -84,7 +83,7 @@ JSClassRef JSSEChannel::m_jsClassRef = JSClassCreate(JSSEChannel::getClassInfo() JSValueRef JSSEChannel::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { SEChannelPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); @@ -97,22 +96,22 @@ JSValueRef JSSEChannel::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(channel->isBasicChannel()); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } JSObjectRef JSSEChannel::createJSObject(JSContextRef context, void *channel) { - LogDebug("entered"); + LoggerD("entered"); ISEChannelPtr seChannel = SEFactory::getInstance().createSEChannelObject(channel); @@ -127,15 +126,15 @@ JSObjectRef JSSEChannel::createJSObject(JSContextRef context, void *channel) { void JSSEChannel::initialize(JSContextRef context, JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); } void JSSEChannel::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); SEChannelPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting SecureElement object"); + LoggerD("Deleting SecureElement object"); delete priv; } @@ -168,14 +167,14 @@ JSValueRef JSSEChannel::close(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); SEChannelPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -184,9 +183,9 @@ JSValueRef JSSEChannel::close(JSContextRef context, seChannel->close(); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -198,14 +197,14 @@ JSValueRef JSSEChannel::transmit(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) { /* 1st argument is mandatory. And 1st argument must be Array */ - LogError("data TypeMismatchException!"); + LoggerE("data TypeMismatchException!"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -223,14 +222,14 @@ JSValueRef JSSEChannel::transmit(JSContextRef context, onErrorForCbm = arguments[2]; } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } SEChannelPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -249,12 +248,12 @@ JSValueRef JSSEChannel::transmit(JSContextRef context, return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); diff --git a/src/SecureElement/JSSEReader.cpp b/src/SecureElement/JSSEReader.cpp old mode 100755 new mode 100644 index 5536e90..397e3cc --- a/src/SecureElement/JSSEReader.cpp +++ b/src/SecureElement/JSSEReader.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -34,6 +32,7 @@ #include "JSSEReader.h" #include "SEAsyncCallbackManager.h" #include "plugin_config.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -86,7 +85,7 @@ JSClassRef JSSEReader::m_jsClassRef = JSClassCreate(JSSEReader::getClassInfo()); JSValueRef JSSEReader::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { Converter convert(context); @@ -101,22 +100,22 @@ JSValueRef JSSEReader::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(reader->isPresent()); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } JSObjectRef JSSEReader::createJSObject(JSContextRef context, void *reader) { - LogDebug("entered"); + LoggerD("entered"); ISEReaderPtr seReader = SEFactory::getInstance().createSEReaderObject(reader); @@ -135,10 +134,10 @@ void JSSEReader::initialize(JSContextRef context, JSObjectRef object) void JSSEReader::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); SEReaderPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting SecureElement object"); + LoggerD("Deleting SecureElement object"); delete priv; } @@ -171,14 +170,14 @@ JSValueRef JSSEReader::getName(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); SEReaderPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -194,7 +193,7 @@ JSValueRef JSSEReader::openSession(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -213,13 +212,13 @@ JSValueRef JSSEReader::openSession(JSContextRef context, onErrorForCbm = arguments[1]; } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } SEReaderPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -237,12 +236,12 @@ JSValueRef JSSEReader::openSession(JSContextRef context, return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); @@ -256,14 +255,14 @@ JSValueRef JSSEReader::closeSessions(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); SEReaderPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } diff --git a/src/SecureElement/JSSEService.cpp b/src/SecureElement/JSSEService.cpp old mode 100755 new mode 100644 index 285af13..ff34db2 --- a/src/SecureElement/JSSEService.cpp +++ b/src/SecureElement/JSSEService.cpp @@ -15,9 +15,6 @@ // limitations under the License. // - -#include - #include #include #include @@ -37,6 +34,7 @@ #include "SEListenerManager.h" #include "SEConverter.h" #include "plugin_config.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -87,27 +85,27 @@ void JSSEService::initialize(JSContextRef context, JSObjectRef object) ISEServicePtr seService( SEFactory::getInstance().createSEServiceObject() ); priv = new SEServicePrivObject(context, seService); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } } } void JSSEService::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); SEServicePrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting SEService object"); + LoggerD("Deleting SEService object"); delete priv; } @@ -140,7 +138,7 @@ JSValueRef JSSEService::getReaders(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -159,13 +157,13 @@ JSValueRef JSSEService::getReaders(JSContextRef context, onErrorForCbm = arguments[1]; } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } SEServicePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -181,12 +179,12 @@ JSValueRef JSSEService::getReaders(JSContextRef context, SEAsyncCallbackManagerSingleton::Instance().registerCallbackManager(callbackManager, privateObject->getContext()); return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); @@ -200,7 +198,7 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -220,14 +218,14 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context, seListener = convert.toSEListener(arguments[0]); } else { /* 1st argument must be SEListener. */ - LogError("SEListener must has onSEReady and onSENotReady"); + LoggerE("SEListener must has onSEReady and onSENotReady"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } SEServicePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -246,12 +244,12 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context, return convert.toJSValueRefLong(static_cast(emitter->getId())); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR,"Unknown Error"); @@ -259,7 +257,7 @@ JSValueRef JSSEService::registerSEListener(JSContextRef context, JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); @@ -274,7 +272,7 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o SEServicePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -290,14 +288,14 @@ JSValueRef JSSEService::unregisterSEListener(JSContextRef context, JSObjectRef o return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("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 (WrtDeviceApis::Commons::NotFoundException) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Not Found ID"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -309,14 +307,14 @@ JSValueRef JSSEService::shutdown(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); SEServicePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -325,9 +323,9 @@ JSValueRef JSSEService::shutdown(JSContextRef context, seService->shutdown(); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } diff --git a/src/SecureElement/JSSESession.cpp b/src/SecureElement/JSSESession.cpp old mode 100755 new mode 100644 index ec0230b..29cae58 --- a/src/SecureElement/JSSESession.cpp +++ b/src/SecureElement/JSSESession.cpp @@ -15,8 +15,6 @@ // limitations under the License. // - -#include #include #include #include @@ -35,7 +33,7 @@ #include "SEConverter.h" #include "SEAsyncCallbackManager.h" #include "plugin_config.h" - +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -88,7 +86,7 @@ JSClassRef JSSESession::m_jsClassRef = JSClassCreate(JSSESession::getClassInfo() JSValueRef JSSESession::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { Converter convert(context); @@ -103,22 +101,22 @@ JSValueRef JSSESession::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(seSession->isClosed()); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } JSObjectRef JSSESession::createJSObject(JSContextRef context, void *session) { - LogDebug("entered"); + LoggerD("entered"); ISESessionPtr seSession = SEFactory::getInstance().createSESessionObject(session); @@ -137,10 +135,10 @@ void JSSESession::initialize(JSContextRef context, JSObjectRef object) void JSSESession::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); SESessionPrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; JSObjectSetPrivate(object, NULL); - LogDebug("Deleting SecureElement object"); + LoggerD("Deleting SecureElement object"); delete priv; } @@ -179,7 +177,7 @@ JSValueRef JSSESession::getATR(JSContextRef context, Try { SESessionPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -187,7 +185,7 @@ JSValueRef JSSESession::getATR(JSContextRef context, SEConverter convert(context); return convert.toJSValueRef(seSession->getATR()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -205,7 +203,7 @@ JSValueRef JSSESession::close(JSContextRef context, Try { SESessionPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -213,7 +211,7 @@ JSValueRef JSSESession::close(JSContextRef context, seSession->close(); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -231,7 +229,7 @@ JSValueRef JSSESession::closeChannels(JSContextRef context, Try { SESessionPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -239,7 +237,7 @@ JSValueRef JSSESession::closeChannels(JSContextRef context, seSession->closeChannels(); return JSValueMakeUndefined(context); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -251,14 +249,14 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) { /* 1st argument is mandatory. And 1st argument must be Array. */ - LogError("AID TypeMismatchException!"); + LoggerE("AID TypeMismatchException!"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -276,13 +274,13 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context, onErrorForCbm = arguments[2]; } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } SESessionPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -292,7 +290,7 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context, Try { std::vector aid = convert.toVectorOfUChars(arguments[0]); if ((aid.size() < 5) || (aid.size() > 16)) { - LogError("wrong aid length : " << aid.size()); + LoggerE("wrong aid length : " << aid.size()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Wrong AID length"); } EventSEOpenChannelPtr event(new EventSEOpenChannel(aid, true)); @@ -305,12 +303,12 @@ JSValueRef JSSESession::openBasicChannel(JSContextRef context, return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); @@ -324,14 +322,14 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); AceSecurityStatus status = SECURE_ELEMENT_CHECK_ACCESS(SECUREELEMENT_FUNCTION_API_FUNCS); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); if ((argumentCount < 2) || JSValueIsNull(context, arguments[0]) || JSValueIsUndefined(context, arguments[0]) || !JSIsArrayValue(context, arguments[0])) { /* 1st argument is mandatory. And 1st argument must be Array. */ - LogError("AID TypeMismatchException!"); + LoggerE("AID TypeMismatchException!"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -349,13 +347,13 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context, onErrorForCbm = arguments[2]; } } catch (const BasePlatformException &err) { - LogError(err.getName() << ": " << err.getMessage()); + LoggerE(err.getName() << ": " << err.getMessage()); return JSWebAPIException::throwException(context, exception, err); } SESessionPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -365,7 +363,7 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context, Try { std::vector aid = convert.toVectorOfUChars(arguments[0]); if ((aid.size() < 5) || (aid.size() > 16)) { - LogError("wrong aid length : " << aid.size()); + LoggerE("wrong aid length : " << aid.size()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Wrong AID length"); } EventSEOpenChannelPtr event(new EventSEOpenChannel(aid, false)); @@ -378,12 +376,12 @@ JSValueRef JSSESession::openLogicalChannel(JSContextRef context, return JSValueMakeUndefined(context); } Catch (ConversionException) { - LogError("ConversionException"); + LoggerE("ConversionException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::UnknownException) { - LogError("UnknownException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } callbackManager->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR,"Unknown Error")); diff --git a/src/SecureElement/SEChannel.cpp b/src/SecureElement/SEChannel.cpp index 266cdb5..557a12c 100644 --- a/src/SecureElement/SEChannel.cpp +++ b/src/SecureElement/SEChannel.cpp @@ -15,17 +15,12 @@ // limitations under the License. // - - - -#include - #include #include #include #include "SEChannel.h" #include "SEUtil.h" - +#include using namespace WrtDeviceApis; using namespace smartcard_service_api; @@ -34,7 +29,7 @@ namespace DeviceAPI { namespace SecureElement { namespace { static void transmitCallback(unsigned char *buffer, unsigned int length, int error, void *userParam) { - LogDebug("Callback transmitCallback."); + LoggerD("Callback transmitCallback."); if (userParam) { SEChannel *seChannelPtr = (SEChannel *)((EventSEPtrs *)userParam)->getThisPtr(); @@ -43,14 +38,14 @@ namespace { seChannelPtr->transmitManualAnswer(buffer, length, error, event); } } else { - LogError("Callback private data is NULL."); + LoggerE("Callback private data is NULL."); } } } SEChannel::SEChannel(void *channel) { - LogDebug("entered"); + LoggerD("entered"); if (channel == NULL) ThrowMsg(UnknownException, "SEChannel Handler is Null Pointer."); @@ -60,7 +55,7 @@ SEChannel::SEChannel(void *channel) SEChannel::~SEChannel() { - LogDebug("entered"); + LoggerD("entered"); if (!m_channel->isClosed()) close(); m_channel = NULL; @@ -77,7 +72,7 @@ bool SEChannel::isBasicChannel() { } void SEChannel::transmit(const EventSEChannelTransmitPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); EventRequestReceiver::PostRequest(event); } @@ -97,14 +92,14 @@ void SEChannel::transmitManualAnswer(unsigned char *buffer, unsigned int length, for (it = EventSEChannelTransmits.begin(); it != EventSEChannelTransmits.end(); ++it) { if ((*it)->getEventPtrs() == event) { EventSEChannelTransmits.erase(it); - LogDebug("event is removed. (" << EventSEChannelTransmits.size() << ")"); + LoggerD("event is removed. (" << EventSEChannelTransmits.size() << ")"); break; } } } void SEChannel::OnRequestReceived(const EventSEChannelTransmitPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); try { event->switchToManualAnswer(); @@ -120,7 +115,7 @@ void SEChannel::OnRequestReceived(const EventSEChannelTransmitPtr& event) { free(chrTransmitData); m_channel->transmit(transmitData, transmitCallback, eventData.Get()); } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setResult(false); event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); event->setErrorMessage("Unknown Error"); diff --git a/src/SecureElement/SEConverter.cpp b/src/SecureElement/SEConverter.cpp old mode 100755 new mode 100644 index d262592..57a313c --- a/src/SecureElement/SEConverter.cpp +++ b/src/SecureElement/SEConverter.cpp @@ -15,14 +15,12 @@ // limitations under the License. // - - -#include #include #include #include "SEConverter.h" #include #include +#include using namespace std; using namespace WrtDeviceApis::CommonsJavaScript; @@ -38,12 +36,12 @@ namespace SecureElement { SEConverter::SEConverter(JSContextRef context) : Converter(context) { - LogDebug("entered"); + LoggerD("entered"); } SEConverter::~SEConverter() { - LogDebug("entered"); + LoggerD("entered"); } @@ -65,7 +63,7 @@ JSValueRef SEConverter::toJSValueRef(const std::vector& arg) { } SEListener SEConverter::toSEListener(const JSValueRef& arg) { - LogDebug("Entered"); + LoggerD("Entered"); JSObjectRef object = toJSObjectRef(arg); SEListener result; diff --git a/src/SecureElement/SEListenerManager.h b/src/SecureElement/SEListenerManager.h index 02ca4e1..43ebb99 100644 --- a/src/SecureElement/SEListenerManager.h +++ b/src/SecureElement/SEListenerManager.h @@ -21,11 +21,11 @@ #include #include -#include #include #include #include #include "JSSEService.h" +#include namespace DeviceAPI { namespace SecureElement { @@ -62,7 +62,7 @@ public: { SEServicePrivObject* privateObject = static_cast(JSObjectGetPrivate(m_object)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return; } @@ -71,7 +71,7 @@ public: seService->unregisterSEListener(static_cast(m_watchId)); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/SecureElement/SEReader.cpp b/src/SecureElement/SEReader.cpp old mode 100755 new mode 100644 index 435caf4..209ba75 --- a/src/SecureElement/SEReader.cpp +++ b/src/SecureElement/SEReader.cpp @@ -15,15 +15,11 @@ // limitations under the License. // - - -#include - #include #include #include "SEReader.h" #include "SEUtil.h" - +#include using namespace WrtDeviceApis; using namespace smartcard_service_api; @@ -33,7 +29,7 @@ namespace SecureElement { namespace { static void openSessionCallback(SessionHelper *session, int error, void *userData) { - LogDebug("Callback openSessionCallback."); + LoggerD("Callback openSessionCallback."); if (userData) { SEReader *sePtr = (SEReader *)((EventSEPtrs *)userData)->getThisPtr(); if (sePtr) { @@ -41,7 +37,7 @@ namespace sePtr->openSessionManualAnswer((void *)session, error, event); } } else { - LogError("Callback private data is NULL."); + LoggerE("Callback private data is NULL."); } } @@ -49,7 +45,7 @@ namespace SEReader::SEReader(void *reader) { - LogDebug("entered"); + LoggerD("entered"); if (reader == NULL) ThrowMsg(Commons::UnknownException, "SecureElement Handler is Null Pointer."); @@ -59,28 +55,28 @@ SEReader::SEReader(void *reader) SEReader::~SEReader() { - LogDebug("entered"); + LoggerD("entered"); m_reader->closeSessions(); m_reader = NULL; } std::string SEReader::getName() { - LogDebug("Enter" << m_reader->getName()); + LoggerD("Enter" << m_reader->getName()); return m_reader->getName(); } bool SEReader::isPresent() { - LogDebug("Enter" << m_reader->isSecureElementPresent()); + LoggerD("Enter" << m_reader->isSecureElementPresent()); return m_reader->isSecureElementPresent(); } void SEReader::openSession(const EventSEOpenSessionPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); EventRequestReceiver::PostRequest(event); } void SEReader::closeSessions() { - LogDebug("Enter"); + LoggerD("Enter"); m_reader->closeSessions(); } @@ -104,14 +100,14 @@ void SEReader::openSessionManualAnswer(void *session, int error, const EventSEOp for (it = EventSEOpenSessions.begin(); it != EventSEOpenSessions.end(); ++it) { if ((*it)->getEventPtrs() == event) { EventSEOpenSessions.erase(it); - LogDebug("event is removed. (" << EventSEOpenSessions.size() << ")"); + LoggerD("event is removed. (" << EventSEOpenSessions.size() << ")"); break; } } } void SEReader::OnRequestReceived(const EventSEOpenSessionPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); try { event->switchToManualAnswer(); @@ -121,7 +117,7 @@ void SEReader::OnRequestReceived(const EventSEOpenSessionPtr& event) { m_reader->openSession(openSessionCallback, data.Get()); } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setResult(false); event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); event->setErrorMessage("Unknown Error"); diff --git a/src/SecureElement/SEResponseDispatcher.cpp b/src/SecureElement/SEResponseDispatcher.cpp index 99ddad7..bd1db32 100644 --- a/src/SecureElement/SEResponseDispatcher.cpp +++ b/src/SecureElement/SEResponseDispatcher.cpp @@ -16,7 +16,6 @@ // #include -#include #include #include #include @@ -27,7 +26,7 @@ #include "SEConverter.h" #include "SEResponseDispatcher.h" #include "SEAsyncCallbackManager.h" - +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -48,22 +47,22 @@ SEResponseDispatcher::SEResponseDispatcher() : SEOpenChannelAnswerReceiver(ThreadEnum::NULL_THREAD), SEChannelTransmitAnswerReceiver(ThreadEnum::NULL_THREAD) { - LogDebug("entered"); + LoggerD("entered"); } SEResponseDispatcher::~SEResponseDispatcher() { - LogDebug("entered"); + LoggerD("entered"); } void SEResponseDispatcher::onAnswerReceived(const EventSEStateChangedPtr& event) { - LogDebug("onAnswerReceived Enter"); + LoggerD("onAnswerReceived Enter"); JSCallbackManagerPtr cbm = DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -72,7 +71,7 @@ void SEResponseDispatcher::onAnswerReceived(const EventSEStateChangedPtr& event) else if (event->getSEState() == SE_REMOVED) cbm->callOnError(JSSEReader::createJSObject(cbm->getContext(), event->getReader())); else - LogDebug("not correct state"); + LoggerD("not correct state"); } void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event) @@ -81,7 +80,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event) DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -90,7 +89,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event) JSContextRef context = cbm->getContext(); SEConverter convert(context); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); std::vector readers = event->getListSEs(); std::vector ListSes; for (std::size_t i = 0; i < readers.size(); i++) @@ -99,7 +98,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventListSEsPtr &event) cbm->callOnSuccess(convert.toJSValueRef(ListSes)); return; } - LogDebug("result fail"); + LoggerD("result fail"); cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage())); } @@ -110,7 +109,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenSessionPtr &event) DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -120,11 +119,11 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenSessionPtr &event) SEConverter convert(context); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(convert.toJSValueRef(JSSESession::createJSObject(context, event->getSession()))); return; } - LogDebug("result fail"); + LoggerD("result fail"); cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage())); } @@ -136,7 +135,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenChannelPtr &event) DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -146,11 +145,11 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEOpenChannelPtr &event) SEConverter convert(context); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(convert.toJSValueRef(JSSEChannel::createJSObject(context, event->getChannel()))); return; } - LogDebug("result fail"); + LoggerD("result fail"); cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage())); } @@ -161,7 +160,7 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEChannelTransmitPtr &eve DPL::StaticPointerCast(event->getPrivateData()); if (!cbm) { - LogDebug("no callback manager"); + LoggerD("no callback manager"); return; } @@ -171,11 +170,11 @@ void SEResponseDispatcher::OnAnswerReceived(const EventSEChannelTransmitPtr &eve SEConverter convert(context); if (event->getResult()) { - LogDebug("result success"); + LoggerD("result success"); cbm->callOnSuccess(convert.toJSValueRef(event->getResponse())); return; } - LogDebug("result fail"); + LoggerD("result fail"); cbm->callOnError(convert.makeSeErrorObject(event->getError(), event->getErrorMessage())); } diff --git a/src/SecureElement/SEService.cpp b/src/SecureElement/SEService.cpp old mode 100755 new mode 100644 index 1f583b0..837215c --- a/src/SecureElement/SEService.cpp +++ b/src/SecureElement/SEService.cpp @@ -15,14 +15,9 @@ // limitations under the License. // - - - -#include - #include - #include "SEService.h" +#include namespace DeviceAPI { namespace SecureElement { @@ -36,20 +31,20 @@ class SEServiceEventHandler : public smartcard_service_api::SEServiceListener { void serviceConnected(smartcard_service_api::SEServiceHelper *service, void *context) { - LogDebug("entered"); + LoggerD("entered"); if (context) (static_cast(context))->getSEServiceCompleted(); } void eventHandler(smartcard_service_api::SEServiceHelper *service, char *seName, int event, void *context) { - LogDebug("entered"); + LoggerD("entered"); (static_cast(context))->eventChanged(seName, event); } void errorHandler(smartcard_service_api::SEServiceHelper *service, int error, void *context) { - LogDebug("entered"); + LoggerD("entered"); } }; static SEServiceEventHandler SEEventHandler; @@ -57,7 +52,7 @@ static SEServiceEventHandler SEEventHandler; SEService::SEService() { - LogDebug("entered"); + LoggerD("entered"); bInitialized = false; bReqShutDown = false; m_EventListSEsPtr.Reset(); @@ -67,7 +62,7 @@ SEService::SEService() SEService::~SEService() { - LogDebug("entered"); + LoggerD("entered"); if (m_seService) { m_seService->shutdownSync(); @@ -78,7 +73,7 @@ SEService::~SEService() } void SEService::getSEServiceCompleted() { - LogDebug("getSEServiceCompleted"); + LoggerD("getSEServiceCompleted"); if (bReqShutDown) m_seService->shutdownSync(); @@ -91,7 +86,7 @@ void SEService::getSEServiceCompleted() { } void SEService::getReaders(const EventListSEsPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); if (bInitialized) EventRequestReceiver::PostRequest(event); else @@ -108,7 +103,7 @@ void SEService::unregisterSEListener(unsigned long id) { for (it = m_EventSEStateChangedEmitterPtrs.begin(); it != m_EventSEStateChangedEmitterPtrs.end(); ++it) { if (id == static_cast((*it)->getId())) { m_EventSEStateChangedEmitterPtrs.erase(it); - LogDebug("m_EventSEStateChangedEmitterPtrs is removed. (" << m_EventSEStateChangedEmitterPtrs.size() << ")"); + LoggerD("m_EventSEStateChangedEmitterPtrs is removed. (" << m_EventSEStateChangedEmitterPtrs.size() << ")"); return; } } @@ -126,7 +121,7 @@ void SEService::eventChanged(char *seName, int event) { eventState->setSEState(SE_REMOVED); break; default: - LogDebug("Not correct event"); + LoggerD("Not correct event"); return; } std::vector readers = m_seService->getReaders(); @@ -140,7 +135,7 @@ void SEService::eventChanged(char *seName, int event) { } } if (i == 0) { - LogError("Not found reader"); + LoggerE("Not found reader"); return; } @@ -153,7 +148,7 @@ void SEService::eventChanged(char *seName, int event) { void SEService::OnRequestReceived(const EventListSEsPtr& event) { std::vector readers = m_seService->getReaders(); - LogDebug("readers.size() : " << readers.size()); + LoggerD("readers.size() : " << readers.size()); event->setResult(true); for (std::size_t i = 0; i < readers.size(); i++) { if (readers[i]->isSecureElementPresent()) diff --git a/src/SecureElement/SESession.cpp b/src/SecureElement/SESession.cpp old mode 100755 new mode 100644 index 5ecf8e8..ff69b86 --- a/src/SecureElement/SESession.cpp +++ b/src/SecureElement/SESession.cpp @@ -18,12 +18,12 @@ #include -#include #include #include #include "SESession.h" #include "SEUtil.h" +#include using namespace WrtDeviceApis; @@ -34,7 +34,7 @@ namespace SecureElement { namespace { static void openChannelCallback(Channel *channel, int error, void *userData) { - LogDebug("Callback openChannelCallback."); + LoggerD("Callback openChannelCallback."); if (userData) { SESession *seSessionPtr = (SESession *)((EventSEPtrs *)userData)->getThisPtr(); if (seSessionPtr) { @@ -42,14 +42,14 @@ namespace seSessionPtr->openChannelManualAnswer((void *)channel, error, event); } } else { - LogError("Callback private data is NULL."); + LoggerE("Callback private data is NULL."); } } }//private namespace SESession::SESession(void *session) { - LogDebug("entered"); + LoggerD("entered"); if (session == NULL) ThrowMsg(Commons::UnknownException, "SecureElement Handler is Null Pointer."); @@ -59,36 +59,36 @@ SESession::SESession(void *session) SESession::~SESession() { - LogDebug("entered"); + LoggerD("entered"); if (!isClosed()) close(); m_session = NULL; } bool SESession::isClosed() { - LogDebug("Enter" << m_session->isClosed()); + LoggerD("Enter" << m_session->isClosed()); return m_session->isClosed(); } std::vector SESession::getATR() { - LogDebug("Enter"); + LoggerD("Enter"); ByteArray atrByteArray = m_session->getATRSync(); SEUtil util; return util.toVector(atrByteArray.getBuffer(), atrByteArray.getLength()); } void SESession::close() { - LogDebug("Enter"); + LoggerD("Enter"); m_session->closeSync(); } void SESession::closeChannels() { - LogDebug("Enter"); + LoggerD("Enter"); m_session->closeChannels(); } void SESession::openChannel(const EventSEOpenChannelPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); EventRequestReceiver::PostRequest(event); } @@ -113,14 +113,14 @@ void SESession::openChannelManualAnswer(void * channel, int error, const EventSE for (it = EventSEOpenChannels.begin(); it != EventSEOpenChannels.end(); ++it) { if ((*it)->getEventPtrs() == event) { EventSEOpenChannels.erase(it); - LogDebug("event is removed. (" << EventSEOpenChannels.size() << ")"); + LoggerD("event is removed. (" << EventSEOpenChannels.size() << ")"); break; } } } void SESession::OnRequestReceived(const EventSEOpenChannelPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); try { event->switchToManualAnswer(); @@ -138,7 +138,7 @@ void SESession::OnRequestReceived(const EventSEOpenChannelPtr& event) { if (channelAid) free(channelAid); } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); + LoggerE("Exception: " << ex.GetMessage()); event->setResult(false); event->setError(DeviceAPI::Common::JSTizenException::UNKNOWN_ERROR); event->setErrorMessage("Unknown Error"); diff --git a/src/SecureElement/SEUtil.cpp b/src/SecureElement/SEUtil.cpp old mode 100755 new mode 100644 index d9ec214..65387be --- a/src/SecureElement/SEUtil.cpp +++ b/src/SecureElement/SEUtil.cpp @@ -18,9 +18,9 @@ #include "SEUtil.h" -#include #include #include +#include namespace DeviceAPI { namespace SecureElement { @@ -50,7 +50,7 @@ unsigned char *SEUtil::toCharPtr(std::vector vec) { } std::string SEUtil::getErrorString(const int errorCode) { - LogDebug ("Errorcode : " << errorCode); + LoggerD ("Errorcode : " << errorCode); switch(errorCode) { case SCARD_ERROR_OK: return ""; @@ -76,7 +76,7 @@ std::string SEUtil::getErrorString(const int errorCode) { } std::string SEUtil::getErrorMessage(const int errorCode) { - LogDebug ("Errorcode : " << errorCode); + LoggerD ("Errorcode : " << errorCode); switch(errorCode) { case SCARD_ERROR_OK: return ""; diff --git a/src/SecureElement/plugin_initializer.cpp b/src/SecureElement/plugin_initializer.cpp old mode 100755 new mode 100644 index a91a602..6e9905a --- a/src/SecureElement/plugin_initializer.cpp +++ b/src/SecureElement/plugin_initializer.cpp @@ -15,10 +15,10 @@ // limitations under the License. // -#include #include #include #include "JSSEService.h" +#include namespace DeviceAPI { namespace SecureElement { @@ -28,27 +28,27 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[TIZEN\\SE] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[TIZEN\\SE] on_widget_start_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().initialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[TIZEN\\SE ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[TIZEN\\SE ] on_widget_stop_callback (" << widgetId << ")"); Try { WrtAccessSingleton::Instance().deinitialize(widgetId); } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } diff --git a/src/SecureStorage/JSSecureStorageManager.cpp b/src/SecureStorage/JSSecureStorageManager.cpp index 818f24c..f1d3a51 100644 --- a/src/SecureStorage/JSSecureStorageManager.cpp +++ b/src/SecureStorage/JSSecureStorageManager.cpp @@ -84,7 +84,7 @@ JSClassRef JSSecureStorageManager::m_jsClassRef = JSClassCreate(JSSecureStorageM void JSSecureStorageManager::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("JSSecureStorageManager::initialize "); + LoggerD("JSSecureStorageManager::initialize "); JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(object)); if (priv == NULL) @@ -93,13 +93,13 @@ void JSSecureStorageManager::initialize(JSContextRef context, JSObjectRef object priv = new JSSecureStorageManagerPriv( context, secureStorage); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } else { - LogDebug("JSSecureStorageManager::already exist "); + LoggerD("JSSecureStorageManager::already exist "); } } @@ -107,7 +107,7 @@ void JSSecureStorageManager::finalize(JSObjectRef object) { JSSecureStorageManagerPriv* priv = static_cast(JSObjectGetPrivate(object)); - LogDebug("JSSecureStorageManager::Finalrize"); + LoggerD("JSSecureStorageManager::Finalrize"); if (priv != NULL) { @@ -133,7 +133,7 @@ JSValueRef JSSecureStorageManager::listKeys(JSContextRef context, JSObjectRef ob { if (priv == NULL) { - LogError("priv null"); + LoggerE("priv null"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -149,7 +149,7 @@ JSValueRef JSSecureStorageManager::listKeys(JSContextRef context, JSObjectRef ob } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogDebug("Error message" << ex.GetMessage()); + LoggerD("Error message" << ex.GetMessage()); switch(ex.getCode()) { case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: @@ -188,7 +188,7 @@ JSValueRef JSSecureStorageManager::set(JSContextRef context, JSObjectRef object, { if (priv == NULL) { - LogError("priv null"); + LoggerE("priv null"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -215,7 +215,7 @@ JSValueRef JSSecureStorageManager::set(JSContextRef context, JSObjectRef object, } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogDebug("Error message" << ex.GetMessage()); + LoggerD("Error message" << ex.GetMessage()); switch(ex.getCode()) { case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: @@ -250,7 +250,7 @@ JSValueRef JSSecureStorageManager::get(JSContextRef context, JSObjectRef object, { if (priv == NULL) { - LogError("priv null"); + LoggerE("priv null"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -271,7 +271,7 @@ JSValueRef JSSecureStorageManager::get(JSContextRef context, JSObjectRef object, } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogDebug("Error message" << ex.GetMessage()); + LoggerD("Error message" << ex.GetMessage()); switch(ex.getCode()) { case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: @@ -307,7 +307,7 @@ JSValueRef JSSecureStorageManager::remove(JSContextRef context, JSObjectRef obje { if (priv == NULL) { - LogError("priv null"); + LoggerE("priv null"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -327,7 +327,7 @@ JSValueRef JSSecureStorageManager::remove(JSContextRef context, JSObjectRef obje } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogDebug("Error message" << ex.GetMessage()); + LoggerD("Error message" << ex.GetMessage()); switch(ex.getCode()) { case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: @@ -362,7 +362,7 @@ JSValueRef JSSecureStorageManager::removeAll(JSContextRef context, JSObjectRef o { if (priv == NULL) { - LogError("priv null"); + LoggerE("priv null"); Throw(WrtDeviceApis::Commons::ConversionException); } @@ -377,7 +377,7 @@ JSValueRef JSSecureStorageManager::removeAll(JSContextRef context, JSObjectRef o } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogDebug("Error message" << ex.GetMessage()); + LoggerD("Error message" << ex.GetMessage()); switch(ex.getCode()) { case WrtDeviceApis::Commons::ExceptionCodes::NotFoundException: diff --git a/src/SecureStorage/SecureStorageManager.cpp b/src/SecureStorage/SecureStorageManager.cpp index cb202b5..842b93d 100644 --- a/src/SecureStorage/SecureStorageManager.cpp +++ b/src/SecureStorage/SecureStorageManager.cpp @@ -33,7 +33,7 @@ int SecureStorageManager::m_maxLength = 256; SecureStorageManager::SecureStorageManager() { - LogDebug("OK"); + LoggerD("OK"); try { @@ -41,21 +41,21 @@ SecureStorageManager::SecureStorageManager() } catch (const WrtDeviceApis::Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); - LogDebug("there is no file"); + LoggerE("Exception: " << ex.GetMessage()); + LoggerD("there is no file"); } - LogDebug("initial map size : " << m_securePairData.size()); + LoggerD("initial map size : " << m_securePairData.size()); } SecureStorageManager::~SecureStorageManager() { - LogDebug("OK"); + LoggerD("OK"); } std::string SecureStorageManager::get(std::string key) { - LogDebug("OK"); + LoggerD("OK"); std::map::iterator it = m_securePairData.find(key); @@ -72,7 +72,7 @@ std::vector SecureStorageManager::listKeys() std::vector vector; std::map::iterator it; - LogDebug("OK"); + LoggerD("OK"); for (it = m_securePairData.begin(); it != m_securePairData.end(); ++it) { @@ -85,13 +85,13 @@ void SecureStorageManager::set(std::string key, std::string value) { m_securePairData[key] = value; - LogDebug("Save current data"); + LoggerD("Save current data"); saveSecurePairData(); } void SecureStorageManager::remove(std::string key) { - LogDebug("OK"); + LoggerD("OK"); std::map::iterator it = m_securePairData.find(key); @@ -100,13 +100,13 @@ void SecureStorageManager::remove(std::string key) ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "not found key"); } m_securePairData.erase(it); - LogDebug("Save current data"); + LoggerD("Save current data"); saveSecurePairData(); } void SecureStorageManager::removeAll() { - LogDebug("OK"); + LoggerD("OK"); ssm_flag flag = SSM_FLAG_SECRET_OPERATION; @@ -116,7 +116,7 @@ void SecureStorageManager::removeAll() void SecureStorageManager::saveSecurePairData() { - LogDebug("OK"); + LoggerD("OK"); std::map::iterator it; size_t dataSize = 0; @@ -166,7 +166,7 @@ void SecureStorageManager::saveSecurePairData() { ThrowMsg(WrtDeviceApis::Commons::PlatformException, "ssm write buf error"); } - LogDebug("save result : " << ret); + LoggerD("save result : " << ret); } std::string SecureStorageManager::readStringFromMemory(const char *saveBuf, size_t ¤t, size_t dataSize) @@ -199,7 +199,7 @@ std::string SecureStorageManager::readStringFromMemory(const char *saveBuf, size void SecureStorageManager::loadSecurePairData() { - LogDebug("OK"); + LoggerD("OK"); int ret = -1; size_t num = 0; @@ -235,7 +235,7 @@ void SecureStorageManager::loadSecurePairData() ThrowMsg(WrtDeviceApis::Commons::PlatformException, "read buf error"); } - LogDebug("read result : " << ret << ", length:" << readlen); + LoggerD("read result : " << ret << ", length:" << readlen); memcpy(&num, &saveBuf[index], sizeof(size_t)); index += sizeof(size_t); @@ -243,7 +243,7 @@ void SecureStorageManager::loadSecurePairData() memcpy(&dataSize, &saveBuf[index], sizeof(size_t)); index += sizeof(size_t); - LogDebug("dataSize" << dataSize << "-" << num); + LoggerD("dataSize" << dataSize << "-" << num); for (i = 0; i < num; i++) { @@ -255,7 +255,7 @@ void SecureStorageManager::loadSecurePairData() ThrowMsg(WrtDeviceApis::Commons::PlatformException, "read buf error"); } m_securePairData[key] = value; - LogDebug("contents:" << key << "-" << m_securePairData[key]); + LoggerD("contents:" << key << "-" << m_securePairData[key]); } } diff --git a/src/SecureStorage/plugin_initializer.cpp b/src/SecureStorage/plugin_initializer.cpp index 85b849d..d1e1c6a 100644 --- a/src/SecureStorage/plugin_initializer.cpp +++ b/src/SecureStorage/plugin_initializer.cpp @@ -14,39 +14,37 @@ * limitations under the License. */ -#include #include #include - - #include "JSSecureStorageManager.h" +#include using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Bluetooth ] on_widget_start_callback ("< #include "ConverterSystemSetting.h" #include +#include //#include "JSMessageAttachment.h" //#include "JSConversation.h" //#include "JSMessageFolder.h" @@ -45,7 +46,7 @@ ConverterSystemSetting::~ConverterSystemSetting() SettingType ConverterSystemSetting::toSettingType(JSValueRef arg) { - LogDebug("Enter"); + LoggerD("Enter"); return toSettingType(toJSObjectRef(arg)); } @@ -53,7 +54,7 @@ SettingType ConverterSystemSetting::toSettingType(JSObjectRef arg) { // convert JSvalue to message type enum std::string strSettingType = toString(arg); - LogDebug("Setting Type : " << strSettingType); + LoggerD("Setting Type : " << strSettingType); if ( strSettingType.compare("HOME_SCREEN") == 0 ) { @@ -81,7 +82,7 @@ SettingType ConverterSystemSetting::toSettingType(JSObjectRef arg) /* std::string ConverterMessage::toMessageType( long msgtype ) { - LogDebug("Messasge Type : " << msgtype); + LoggerD("Messasge Type : " << msgtype); switch (msgtype) { @@ -98,7 +99,7 @@ std::string ConverterMessage::toMessageType( long msgtype ) std::string ConverterMessage::toMessageStatusType( long msgstatus ) { - LogDebug("Messasge Status : " << msgstatus); + LoggerD("Messasge Status : " << msgstatus); switch (msgstatus) { diff --git a/src/SystemSetting/ConverterSystemSetting.h b/src/SystemSetting/ConverterSystemSetting.h index 8e0076b..5617a83 100755 --- a/src/SystemSetting/ConverterSystemSetting.h +++ b/src/SystemSetting/ConverterSystemSetting.h @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include "ISystemSettingType.h" diff --git a/src/SystemSetting/JSSystemSetting.cpp b/src/SystemSetting/JSSystemSetting.cpp old mode 100755 new mode 100644 index a11b7ea..1fbd54c --- a/src/SystemSetting/JSSystemSetting.cpp +++ b/src/SystemSetting/JSSystemSetting.cpp @@ -42,13 +42,8 @@ //#include //#include #include - #include "plugin_config.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "TIZEN_N_SYSTEMSETTING" -#endif +#include using namespace std; using namespace DPL; @@ -109,27 +104,27 @@ void JSSystemSetting::initialize(JSContextRef context, JSObjectRef object) if (priv != NULL) { - LogDebug("JSSystemSetting::initialize already"); + LoggerD("JSSystemSetting::initialize already"); return; } Try { priv = new JSSystemSettingPriv(context, SystemSettings); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } Catch (UnsupportedException) { - LogError("UnsupportedException: " << _rethrown_exception.GetMessage()); + LoggerE("UnsupportedException: " << _rethrown_exception.GetMessage()); } Catch (UnknownException) { - LogError("UnknownExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("UnknownExceptionException: " << _rethrown_exception.GetMessage()); } Catch (PlatformException) { - LogError("PlatformExceptionException: " << _rethrown_exception.GetMessage()); + LoggerE("PlatformExceptionException: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } - LogDebug("JSSystemSetting::initialize "); + LoggerD("JSSystemSetting::initialize "); } @@ -138,14 +133,14 @@ void JSSystemSetting::finalize(JSObjectRef object) JSSystemSettingPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting gallery"); + LoggerD("Deleting gallery"); delete priv; } JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); SettingType settingType; std::string settingValue; @@ -155,11 +150,11 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 3) { - LogDebug("Argument is too few"); + LoggerD("Argument is too few"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } if (!check.isCallback(arguments[2])) { @@ -174,7 +169,7 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object if (argumentCount > 3) { if (check.isCallback(arguments[3])) { onErrorForCbm = arguments[3]; - } else if (!JSValueIsNull(context, arguments[3]) && !JSValueIsUndefined(context, arguments[3])) { + } else if (!JSValueIsNull(context, arguments[3])) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } } @@ -196,13 +191,13 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object else settingValue = ""; //set empty string. - LogDebug("real path = " << settingValue); + LoggerD("real path = " << settingValue); } Catch(WrtDeviceApis::Commons::Exception) { - LogDebug("settingValue is not Virtual Path"); + LoggerD("settingValue is not Virtual Path"); } - LogDebug("settingValue = " << settingValue); + LoggerD("settingValue = " << settingValue); ISystemSettingPtr SystemSettings(priv->getObject()); EventSetSettingPtr dplEvent(new EventSetSetting()); @@ -216,26 +211,26 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object } Catch(WrtDeviceApis::Commons::ConversionException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "invalid value error"); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "platform error"); } Catch(WrtDeviceApis::Commons::Exception) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error"); } - LogDebug("end"); + LoggerD("end"); TIME_TRACER_ITEM_END(strSettingType.c_str(), 0); return JSValueMakeUndefined(context); } @@ -243,7 +238,7 @@ JSValueRef JSSystemSetting::setProperty(JSContextRef context, JSObjectRef object JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("enter"); + LoggerD("enter"); JSSystemSettingPriv *priv = static_cast(JSObjectGetPrivate(thisObject)); ConverterSystemSettingFactory::ConverterType converter = ConverterSystemSettingFactory::getConverter(context); @@ -251,12 +246,12 @@ JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 2) { - LogDebug("Argument is too few"); + LoggerD("Argument is too few"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } if (!check.isCallback(arguments[1])) { @@ -273,7 +268,7 @@ JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object if (argumentCount > 2) { if (check.isCallback(arguments[2])) { onErrorForCbm = arguments[2]; - } else if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) { + } else if (!JSValueIsNull(context, arguments[2])) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } } @@ -299,26 +294,26 @@ JSValueRef JSSystemSetting::getProperty(JSContextRef context, JSObjectRef object } Catch(WrtDeviceApis::Commons::ConversionException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "invalid value error"); } Catch(WrtDeviceApis::Commons::PlatformException) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "platform error"); } Catch(WrtDeviceApis::Commons::Exception) { - LogDebug("Exception"); + LoggerD("Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error"); } - LogDebug("end"); + LoggerD("end"); TIME_TRACER_ITEM_BEGIN(strGettingType.c_str(), 0); return JSValueMakeUndefined(context); } diff --git a/src/SystemSetting/SystemSetting.cpp b/src/SystemSetting/SystemSetting.cpp old mode 100755 new mode 100644 index 53ba5cd..21ad6ed --- a/src/SystemSetting/SystemSetting.cpp +++ b/src/SystemSetting/SystemSetting.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include @@ -23,9 +22,8 @@ #include #include #include - - #include +#include using namespace WrtDeviceApis::CommonsJavaScript; using namespace WrtDeviceApis::Commons; @@ -44,31 +42,31 @@ SystemSetting::~SystemSetting() void SystemSetting::setWallpaper(const EventSetWallpaperPtr &event) { - LogDebug("enter"); + LoggerD("enter"); EventRequestReceiver::PostRequest(event); } void SystemSetting::setRingtone(const EventSetRingtonePtr &event) { - LogDebug("enter"); + LoggerD("enter"); EventRequestReceiver::PostRequest(event); } void SystemSetting::setProperty(const EventSetSettingPtr &event) { - LogDebug("enter"); + LoggerD("enter"); EventRequestReceiver::PostRequest(event); } void SystemSetting::getProperty(const EventGetSettingPtr &event) { - LogDebug("enter"); + LoggerD("enter"); EventRequestReceiver::PostRequest(event); } std::string SystemSetting::getProperty(const SettingType settingType) { - LogDebug("enter"); + LoggerD("enter"); int ret = SYSTEM_SETTINGS_ERROR_NONE; char *value = NULL; @@ -76,45 +74,45 @@ std::string SystemSetting::getProperty(const SettingType settingType) if(settingType == HOME_SCREEN ) { - LogDebug("home screen"); + LoggerD("home screen"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, &value); - LogDebug("result : " << ret << " value: "<< value); + LoggerD("result : " << ret << " value: "<< value); } else if(settingType == LOCK_SCREEN ) { - LogDebug("lock screen"); + LoggerD("lock screen"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &value); - LogDebug("result : " << ret << " value: "<< value); + LoggerD("result : " << ret << " value: "<< value); }else if(settingType == INCOMMING_CALL ) { - LogDebug("call"); + LoggerD("call"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &value); - LogDebug("result : " << ret << " value: "<< value); + LoggerD("result : " << ret << " value: "<< value); } else if(settingType == NOTIFICATION_EMAIL ) { - LogDebug("email"); + LoggerD("email"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, &value); - LogDebug("result : " << ret << " value: "<< value); + LoggerD("result : " << ret << " value: "<< value); } if(ret == SYSTEM_SETTINGS_ERROR_NONE) { - LogDebug("success"); + LoggerD("success"); gettingValue = value; return value; } else { - LogDebug("PlatformException"); + LoggerD("PlatformException"); ThrowMsg(WrtDeviceApis::Commons::PlatformException, "PlatformException"); } } void SystemSetting::OnRequestReceived(const EventSetWallpaperPtr &event) { - LogDebug("enter"); + LoggerD("enter"); int ret = SYSTEM_SETTINGS_ERROR_NONE; std::string wallpaperUri = event->getWallpaperURI(); @@ -122,31 +120,31 @@ void SystemSetting::OnRequestReceived(const EventSetWallpaperPtr &event) if(strcmp(wallpaperType.c_str(), "HOME_SCREEN") == 0 ) { - LogDebug("home screen : " << wallpaperUri.c_str()); + LoggerD("home screen : " << wallpaperUri.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, wallpaperUri.c_str()); } else if(strcmp(wallpaperType.c_str(), "LOCK_SCREEN") == 0 ) { - LogDebug("lock screen : " << wallpaperUri.c_str()); + LoggerD("lock screen : " << wallpaperUri.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, wallpaperUri.c_str()); } if(ret == SYSTEM_SETTINGS_ERROR_NONE) { - LogDebug("success"); + LoggerD("success"); event->setExceptionCode(ExceptionCodes::None); } else { - LogDebug("PlatformException"); + LoggerD("PlatformException"); event->setExceptionCode(ExceptionCodes::PlatformException); } - LogDebug("end"); + LoggerD("end"); } void SystemSetting::OnRequestReceived(const EventSetRingtonePtr &event) { - LogDebug("enter"); + LoggerD("enter"); int ret = SYSTEM_SETTINGS_ERROR_NONE; std::string ringtoneUri = event->getRingtoneURI(); @@ -154,32 +152,32 @@ void SystemSetting::OnRequestReceived(const EventSetRingtonePtr &event) if(strcmp(ringtoneType.c_str(), "INCOMING_CALL") == 0 ) { - LogDebug("call : " << ringtoneUri.c_str()); + LoggerD("call : " << ringtoneUri.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, ringtoneUri.c_str()); } else if(strcmp(ringtoneType.c_str(), "NOTIFICATION_EMAIL") == 0 ) { // TODO need manage-api - LogDebug("email : " << ringtoneUri.c_str()); + LoggerD("email : " << ringtoneUri.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, ringtoneUri.c_str()); } if(ret == SYSTEM_SETTINGS_ERROR_NONE) { - LogDebug("success"); + LoggerD("success"); event->setExceptionCode(ExceptionCodes::None); } else { - LogDebug("PlatformException"); + LoggerD("PlatformException"); event->setExceptionCode(ExceptionCodes::PlatformException); } - LogDebug("end"); + LoggerD("end"); } void SystemSetting::OnRequestReceived(const EventSetSettingPtr &event) { - LogDebug("enter"); + LoggerD("enter"); int ret = SYSTEM_SETTINGS_ERROR_NONE; std::string settingValue = event->getSettingValue(); @@ -187,45 +185,45 @@ void SystemSetting::OnRequestReceived(const EventSetSettingPtr &event) if(settingType == HOME_SCREEN ) { - LogDebug("home screen : " << settingValue.c_str()); + LoggerD("home screen : " << settingValue.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, settingValue.c_str()); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } else if(settingType == LOCK_SCREEN ) { - LogDebug("lock screen : " << settingValue.c_str()); + LoggerD("lock screen : " << settingValue.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, settingValue.c_str()); - LogDebug("result : " << ret); + LoggerD("result : " << ret); }else if(settingType == INCOMMING_CALL ) { - LogDebug("call : " << settingValue.c_str()); + LoggerD("call : " << settingValue.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, settingValue.c_str()); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } else if(settingType == NOTIFICATION_EMAIL ) { - LogDebug("email : " << settingValue.c_str()); + LoggerD("email : " << settingValue.c_str()); ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, settingValue.c_str()); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } if(ret == SYSTEM_SETTINGS_ERROR_NONE) { - LogDebug("success"); + LoggerD("success"); event->setExceptionCode(ExceptionCodes::None); } else { - LogDebug("PlatformException"); + LoggerD("PlatformException"); event->setExceptionCode(ExceptionCodes::PlatformException); } - LogDebug("end"); + LoggerD("end"); } void SystemSetting::OnRequestReceived(const EventGetSettingPtr &event) { - LogDebug("enter"); + LoggerD("enter"); int ret = SYSTEM_SETTINGS_ERROR_NONE; std::string settingValue; @@ -234,44 +232,44 @@ void SystemSetting::OnRequestReceived(const EventGetSettingPtr &event) if(settingType == HOME_SCREEN ) { - LogDebug("home screen"); + LoggerD("home screen"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, &value); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } else if(settingType == LOCK_SCREEN ) { - LogDebug("lock screen"); + LoggerD("lock screen"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &value); - LogDebug("result : " << ret); + LoggerD("result : " << ret); }else if(settingType == INCOMMING_CALL ) { - LogDebug("call"); + LoggerD("call"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &value); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } else if(settingType == NOTIFICATION_EMAIL ) { - LogDebug("email"); + LoggerD("email"); ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, &value); - LogDebug("result : " << ret); + LoggerD("result : " << ret); } if(ret == SYSTEM_SETTINGS_ERROR_NONE) { - LogDebug("success"); + LoggerD("success"); event->setExceptionCode(ExceptionCodes::None); } else { - LogDebug("PlatformException"); + LoggerD("PlatformException"); event->setExceptionCode(ExceptionCodes::PlatformException); } settingValue = value; event->setSettingValue(settingValue); - LogDebug("end"); + LoggerD("end"); } diff --git a/src/SystemSetting/SystemSettingResponseDispatcher.cpp b/src/SystemSetting/SystemSettingResponseDispatcher.cpp old mode 100755 new mode 100644 index 8f3ea60..ab68770 --- a/src/SystemSetting/SystemSettingResponseDispatcher.cpp +++ b/src/SystemSetting/SystemSettingResponseDispatcher.cpp @@ -16,14 +16,12 @@ // #include "SystemSettingResponseDispatcher.h" -#include #include #include #include - #include - #include "SystemSettingAsyncCallbackManager.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -52,11 +50,11 @@ SystemSettingResponseDispatcher::~SystemSettingResponseDispatcher() void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetWallpaperPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -83,22 +81,22 @@ void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetWallpaperPt error = JSTizenExceptionFactory::makeErrorObject(gContext, JSTizenException::UNKNOWN_ERROR, "Unknown error"); break; } - LogDebug("callOnError"); + LoggerD("callOnError"); callbackManager->callOnError(error); return; } - LogDebug("callOnSuccess"); + LoggerD("callOnSuccess"); callbackManager->callOnSuccess(); } void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetRingtonePtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -134,11 +132,11 @@ void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetRingtonePtr void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetSettingPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -176,11 +174,11 @@ void SystemSettingResponseDispatcher::OnAnswerReceived(const EventSetSettingPtr void SystemSettingResponseDispatcher::OnAnswerReceived(const EventGetSettingPtr &event) { - LogDebug("entered"); + LoggerD("entered"); JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); if (!callbackManager) { - LogError("No listener callback!"); + LoggerE("No listener callback!"); return; } @@ -215,19 +213,19 @@ void SystemSettingResponseDispatcher::OnAnswerReceived(const EventGetSettingPtr callbackManager->callOnError(error); return; } - LogDebug("gettingValue : " << event->getSettingValue()); + LoggerD("gettingValue : " << event->getSettingValue()); std::string settingPath = event->getSettingValue(); - LogDebug("RealSettingPath : " << settingPath); + LoggerD("RealSettingPath : " << settingPath); Try { settingPath = DeviceAPI::Filesystem::Utils::toVirtualPath(gContext, settingPath); - LogDebug("VirtualSettingPath : " << settingPath); + LoggerD("VirtualSettingPath : " << settingPath); } Catch(WrtDeviceApis::Commons::ConversionException) { - LogDebug("not the virtual path"); - LogDebug("RealSettingSettingPath : " << settingPath); + LoggerD("not the virtual path"); + LoggerD("RealSettingSettingPath : " << settingPath); } if (settingPath.size() == 0) diff --git a/src/SystemSetting/config.xml b/src/SystemSetting/config.xml old mode 100755 new mode 100644 diff --git a/src/SystemSetting/plugin_initializer.cpp b/src/SystemSetting/plugin_initializer.cpp old mode 100755 new mode 100644 index 450076c..f75119e --- a/src/SystemSetting/plugin_initializer.cpp +++ b/src/SystemSetting/plugin_initializer.cpp @@ -15,12 +15,12 @@ // limitations under the License. // -#include #include #include #include #include "JSSystemSetting.h" #include "SystemSettingAsyncCallbackManager.h" +#include //#include "MessageListenerManager.h" namespace DeviceAPI { @@ -33,7 +33,7 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\SystemSetting ] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\SystemSetting ] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { @@ -41,13 +41,13 @@ void on_widget_start_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\SystemSetting ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\SystemSetting ] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"SystemSetting"); TIME_TRACER_RELEASE(); Try @@ -56,18 +56,18 @@ void on_widget_stop_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\contact] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\contact] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\contact] on_frame_unload_callback (" << context << ")"); DeviceAPI::SystemSetting::SystemSettingAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); // TizenApis::Tizen1_0::MessageListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/Systeminfo/BaseProperties.h b/src/Systeminfo/BaseProperties.h index e9ab8e0..ce039df 100755 --- a/src/Systeminfo/BaseProperties.h +++ b/src/Systeminfo/BaseProperties.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "JSNetworkInfo.h" @@ -36,8 +35,8 @@ #include "JSBuildInfo.h" #include "JSLocaleInfo.h" #include "JSPeripheralInfo.h" - #include "SysteminfoPropertyInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { diff --git a/src/Systeminfo/EventGetSysteminfo.cpp b/src/Systeminfo/EventGetSysteminfo.cpp old mode 100755 new mode 100644 index 9f153be..e302b9d --- a/src/Systeminfo/EventGetSysteminfo.cpp +++ b/src/Systeminfo/EventGetSysteminfo.cpp @@ -50,14 +50,14 @@ const char * EventGetSysteminfo::getProperty() const void EventGetSysteminfo::processGetValue(void* handle) { - LogDebug("enter"); + LoggerD("enter"); if (!m_BaseProperty) { - LogError("property is not set"); + LoggerE("property is not set"); setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::ConversionException); } else { WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr m_callbackManager = DPL::StaticPointerCast(getPrivateData()); if (!m_callbackManager) { - LogError("property is not set"); + LoggerE("property is not set"); setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::NullPointerException); } else { JSContextRef context = m_callbackManager->getContext(); diff --git a/src/Systeminfo/EventWatchSysteminfo.cpp b/src/Systeminfo/EventWatchSysteminfo.cpp index 894f173..fb338ef 100755 --- a/src/Systeminfo/EventWatchSysteminfo.cpp +++ b/src/Systeminfo/EventWatchSysteminfo.cpp @@ -30,7 +30,7 @@ namespace { static Eina_Bool timeout_timer_cb(void* data) { - LogDebug("enter"); + LoggerD("enter"); EventWatchSysteminfo *event = static_cast (data); event->timeoutWatch(); return ECORE_CALLBACK_RENEW; @@ -41,15 +41,14 @@ static Eina_Bool timeout_timer_cb(void* data) #define MAX_STORAGE_CNT 3 DPL::Atomic EventWatchSysteminfo::m_uniqId = 1; -EventWatchSysteminfo::EventWatchSysteminfo() : - m_initTimer(NULL), - m_id(m_uniqId), - m_canceled(false), - m_lastValue(NULL), - m_storageCnt(0), - m_tmpStorageCnt(0), - m_Systeminfo(NULL) +EventWatchSysteminfo::EventWatchSysteminfo() : m_id(m_uniqId) { + m_initTimer = NULL; + m_canceled = false; + m_lastValue = NULL; + m_storageCnt = 0; + m_tmpStorageCnt = 0; + m_Systeminfo = NULL; ++m_uniqId; } @@ -60,7 +59,7 @@ EventWatchSysteminfo::~EventWatchSysteminfo() JSCallbackManagerPtr m_cbm = DPL::StaticPointerCast< JSCallbackManager >(getPrivateData()); JSValueUnprotect(m_cbm->getContext(), m_lastValue); } - LogDebug("destroy event data, id=" << m_id); + LoggerD("destroy event data, id=" << m_id); removeTimer(); } @@ -98,7 +97,7 @@ const int EventWatchSysteminfo::getWatchType() const { void EventWatchSysteminfo::getWatchValue(int cnt) { - LogDebug("enter"); + LoggerD("enter"); m_tmpStorageCnt = cnt; processGetValue(); } @@ -127,13 +126,13 @@ JSValueRef EventWatchSysteminfo::getPropertyValue(JSContextRef context, JSValueR void EventWatchSysteminfo::processGetValue() { - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); if(m_canceled) { - LogDebug("Watch event is cancelled aleardy."); + LoggerD("Watch event is cancelled aleardy."); return; } if (m_Systeminfo == NULL) { - LogError("systeminfo pointer is not set"); + LoggerE("systeminfo pointer is not set"); return; } @@ -160,7 +159,7 @@ void EventWatchSysteminfo::processGetValue() if (!tmpValue) { return; } - LogDebug("watchType : " << m_BaseProperty->getWatchType()); + LoggerD("watchType : " << m_BaseProperty->getWatchType()); if (m_BaseProperty->getWatchType() == WATCH_TYPE_BATTERY) { std::string key = "level"; @@ -315,9 +314,9 @@ void EventWatchSysteminfo::processGetValue() } if (m_tmpStorageCnt == m_storageCnt) { - LogDebug("enter"); + LoggerD("enter"); for (int i=0; icallOnSuccess(tmpValue); setTimer(); } m_lastValue = tmpValue; } } else { - LogDebug("enter"); + LoggerD("enter"); m_cbm->callOnSuccess(tmpValue); m_storageCnt = m_tmpStorageCnt; m_lastValue = tmpValue; @@ -366,9 +365,9 @@ void EventWatchSysteminfo::processGetValue() double status = JSValueToNumber(context, propertyStatus, exception); propertyStatus = getPropertyValue(context, m_lastValue, key); double prevStatus = JSValueToNumber(context, propertyStatus, exception); - LogDebug("status : " << status << "prevStatus : " << prevStatus); + LoggerD("status : " << status << "prevStatus : " << prevStatus); if (status != prevStatus) { - LogDebug("make callback"); + LoggerD("make callback"); m_cbm->callOnSuccess(tmpValue); setTimer(); } @@ -379,9 +378,9 @@ void EventWatchSysteminfo::processGetValue() JSStringRef networkType = JSValueToStringCopy(context, propertyNetworkType, exception); propertyNetworkType = getPropertyValue(context, m_lastValue, key); JSStringRef prevNetworkType = JSValueToStringCopy(context, propertyNetworkType, exception); - LogDebug("networkType : " << networkType << "prevNetworkType : " << prevNetworkType); + LoggerD("networkType : " << networkType << "prevNetworkType : " << prevNetworkType); if (!JSStringIsEqual(networkType ,prevNetworkType)) { - LogDebug("make callback"); + LoggerD("make callback"); m_cbm->callOnSuccess(tmpValue); setTimer(); } @@ -392,17 +391,17 @@ void EventWatchSysteminfo::processGetValue() JSStringRef country = JSValueToStringCopy(context, propertyCountry, exception); propertyCountry = getPropertyValue(context, m_lastValue, key); JSStringRef prevCountry = JSValueToStringCopy(context, propertyCountry, exception); - LogDebug("country : " << country << " prevCountry : " << prevCountry); + LoggerD("country : " << country << " prevCountry : " << prevCountry); key = "language"; JSValueRef propertyLanguage = getPropertyValue(context, tmpValue, key); JSStringRef language = JSValueToStringCopy(context, propertyLanguage, exception); propertyLanguage = getPropertyValue(context, m_lastValue, key); JSStringRef prevLanguage = JSValueToStringCopy(context, propertyLanguage, exception); - LogDebug("language : " << language << " prevLanguage : " << prevLanguage); + LoggerD("language : " << language << " prevLanguage : " << prevLanguage); if (!JSStringIsEqual(language, prevLanguage) || !JSStringIsEqual(country, prevCountry)) { - LogDebug("make callback"); + LoggerD("make callback"); m_cbm->callOnSuccess(tmpValue); setTimer(); } diff --git a/src/Systeminfo/JSBatteryInfo.cpp b/src/Systeminfo/JSBatteryInfo.cpp old mode 100755 new mode 100644 index a1e69dc..d430faf --- a/src/Systeminfo/JSBatteryInfo.cpp +++ b/src/Systeminfo/JSBatteryInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSBatteryInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -76,10 +76,10 @@ void JSBatteryInfo::Initialize(JSContextRef context, JSObjectRef object) void JSBatteryInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSBatteryPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting batteryInfo object"); + LoggerD("Deleting batteryInfo object"); delete priv; } @@ -90,17 +90,17 @@ bool JSBatteryInfo::hasProperty(JSContextRef context, JSObjectRef object, JSStri JSObjectRef JSBatteryInfo::createJSObject(JSContextRef context, const BatteryPropertiesPtr batteryInfo) { - LogDebug("test"); + LoggerD("test"); JSBatteryPriv *priv = new JSBatteryPriv(context, batteryInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSBatteryInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSBatteryPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -117,7 +117,7 @@ JSValueRef JSBatteryInfo::getProperty(JSContextRef context, JSObjectRef object, } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSBuildInfo.cpp b/src/Systeminfo/JSBuildInfo.cpp old mode 100755 new mode 100644 index e3805cb..b1289e4 --- a/src/Systeminfo/JSBuildInfo.cpp +++ b/src/Systeminfo/JSBuildInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSBuildInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -77,10 +77,10 @@ void JSBuildInfo::Initialize(JSContextRef context, JSObjectRef object) void JSBuildInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSBuildPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting buildInfo object"); + LoggerD("Deleting buildInfo object"); delete priv; } @@ -97,10 +97,10 @@ JSObjectRef JSBuildInfo::createJSObject(JSContextRef context, const BuildPropert JSValueRef JSBuildInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSBuildPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -117,7 +117,7 @@ JSValueRef JSBuildInfo::getProperty(JSContextRef context, JSObjectRef object, JS } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSCellularNetworkInfo.cpp b/src/Systeminfo/JSCellularNetworkInfo.cpp old mode 100755 new mode 100644 index 1e80682..75d5506 --- a/src/Systeminfo/JSCellularNetworkInfo.cpp +++ b/src/Systeminfo/JSCellularNetworkInfo.cpp @@ -16,12 +16,12 @@ // #include -#include #include #include #include #include "JSCellularNetworkInfo.h" #include "plugin_config.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -99,10 +99,10 @@ void JSCellularNetworkInfo::Initialize(JSContextRef context, JSObjectRef object) void JSCellularNetworkInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSCellularNetworkPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting CellularNetworkInfo object"); + LoggerD("Deleting CellularNetworkInfo object"); delete priv; } @@ -113,17 +113,17 @@ bool JSCellularNetworkInfo::hasProperty(JSContextRef context, JSObjectRef object JSObjectRef JSCellularNetworkInfo::createJSObject(JSContextRef context, const CellularNetworkPropertiesPtr cellularNetworkInfo) { - LogDebug("Enter"); + LoggerD("Enter"); JSCellularNetworkPriv *priv = new JSCellularNetworkPriv(context, cellularNetworkInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSCellularNetworkInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSCellularNetworkPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -160,7 +160,7 @@ JSValueRef JSCellularNetworkInfo::getProperty(JSContextRef context, JSObjectRef } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSCpuInfo.cpp b/src/Systeminfo/JSCpuInfo.cpp old mode 100755 new mode 100644 index 63f3f56..36cf77d --- a/src/Systeminfo/JSCpuInfo.cpp +++ b/src/Systeminfo/JSCpuInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSCpuInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -74,10 +74,10 @@ void JSCpuInfo::Initialize(JSContextRef context, JSObjectRef object) void JSCpuInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSCpuPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting CpuInfo object"); + LoggerD("Deleting CpuInfo object"); delete priv; } @@ -88,17 +88,17 @@ bool JSCpuInfo::hasProperty(JSContextRef context, JSObjectRef object, JSStringRe JSObjectRef JSCpuInfo::createJSObject(JSContextRef context, const CpuPropertiesPtr cpuInfo) { - LogDebug("Enter"); + LoggerD("Enter"); JSCpuPriv *priv = new JSCpuPriv(context, cpuInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSCpuInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSCpuPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -113,7 +113,7 @@ JSValueRef JSCpuInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp index 3be346c..43270db 100755 --- a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp +++ b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include "JSDeviceCapabilitiesInfo.h" #include "plugin_config.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -216,10 +216,10 @@ void JSDeviceCapabilitiesInfo::Initialize(JSContextRef context, JSObjectRef obje void JSDeviceCapabilitiesInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSDeviceCapabilitiesPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting DeviceCapabilitiesInfo object"); + LoggerD("Deleting DeviceCapabilitiesInfo object"); delete priv; } @@ -230,17 +230,17 @@ bool JSDeviceCapabilitiesInfo::hasProperty(JSContextRef context, JSObjectRef obj JSObjectRef JSDeviceCapabilitiesInfo::createJSObject(JSContextRef context, const DeviceCapabilitiesPropertiesPtr deviceCapabilitiesInfo) { - LogDebug("Enter"); + LoggerD("Enter"); JSDeviceCapabilitiesPriv *priv = new JSDeviceCapabilitiesPriv(context, deviceCapabilitiesInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSDeviceCapabilitiesPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -252,14 +252,14 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BLUETOOTH)) { bool bluetooth = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetooth) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("bluetooth : " << bluetooth); + LoggerD("bluetooth : " << bluetooth); deviceCapabilitiesInfo->bluetooth = bluetooth; } return convert.toJSValueRef(deviceCapabilitiesInfo->bluetooth); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_NFC)) { bool nfc = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfc) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("nfc : " << nfc); + LoggerD("nfc : " << nfc); deviceCapabilitiesInfo->nfc = nfc; } return convert.toJSValueRef(deviceCapabilitiesInfo->nfc); @@ -268,7 +268,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MULTITOUCHCOUNT)) { int multiTouchCount = 0; if (system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiTouchCount) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("multiTouchCount : " << multiTouchCount); + LoggerD("multiTouchCount : " << multiTouchCount); deviceCapabilitiesInfo->multiTouchCount = multiTouchCount; } return convert.toJSValueRef(deviceCapabilitiesInfo->multiTouchCount); @@ -276,8 +276,12 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* inputKeyboard = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &inputKeyboard) == SYSTEM_INFO_ERROR_NONE) { if (inputKeyboard != NULL) { - LogDebug("inputKeyboard : " << inputKeyboard); - deviceCapabilitiesInfo->inputKeyboard = inputKeyboard; + LoggerD("inputKeyboard : " << inputKeyboard); + if (strcmp(inputKeyboard, "NULL") == 0) { + deviceCapabilitiesInfo->inputKeyboard = false; + } else { + deviceCapabilitiesInfo->inputKeyboard = true; + } free(inputKeyboard); } } @@ -287,14 +291,14 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFI)) { bool wifi = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifi) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("wifi : " << wifi); + LoggerD("wifi : " << wifi); deviceCapabilitiesInfo->wifi = wifi; } return convert.toJSValueRef(deviceCapabilitiesInfo->wifi); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_WIFIDIRECT)) { bool wifiDirect = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirect) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("wifiDirect : " << wifiDirect); + LoggerD("wifiDirect : " << wifiDirect); deviceCapabilitiesInfo->wifiDirect = wifiDirect; } return convert.toJSValueRef(deviceCapabilitiesInfo->wifiDirect); @@ -306,7 +310,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* openglesVersion = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) { if (openglesVersion!= NULL) { - LogDebug("openglesVersion : " << openglesVersion); + LoggerD("openglesVersion : " << openglesVersion); if (strcmp(openglesVersion, "1.0") == 0) { deviceCapabilitiesInfo->openglesVersion1_1 = true; } else if (strcmp(openglesVersion, "1.0/2.0") == 0) { @@ -320,7 +324,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* openglesVersion = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &openglesVersion) == SYSTEM_INFO_ERROR_NONE) { if (openglesVersion!= NULL) { - LogDebug("openglesVersion : " << openglesVersion); + LoggerD("openglesVersion : " << openglesVersion); if (strcmp(openglesVersion, "2.0") == 0) { deviceCapabilitiesInfo->openglesVersion2_0 = true; } else if (strcmp(openglesVersion, "1.0/2.0") == 0) { @@ -333,7 +337,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_FMRADIO)) { bool fmRadio = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadio) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("fmRadio : " << fmRadio); + LoggerD("fmRadio : " << fmRadio); deviceCapabilitiesInfo->fmRadio = fmRadio; } return convert.toJSValueRef(deviceCapabilitiesInfo->fmRadio); @@ -343,7 +347,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* platformVersion = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &platformVersion) == SYSTEM_INFO_ERROR_NONE) { if (platformVersion) { - LogDebug("platformVersion : " << platformVersion); + LoggerD("platformVersion : " << platformVersion); deviceCapabilitiesInfo->platformVersion = platformVersion; free(platformVersion); } @@ -353,7 +357,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* platformName = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platformName) == SYSTEM_INFO_ERROR_NONE) { if (platformName) { - LogDebug("platformName : " << platformName); + LoggerD("platformName : " << platformName); deviceCapabilitiesInfo->platformName = platformName; free(platformName); } @@ -369,14 +373,14 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR std::string webApiVersionMinor = ""; if(!file) { - LogDebug("api/native version info file not found"); + LoggerD("api/native version info file not found"); } else { while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) { if (pcrecpp::RE("platform.web.api.version=(\\w+).(\\w+)").PartialMatch(line, &webApiVersionMajor, &webApiVersionMinor)) { deviceCapabilitiesInfo->webApiVersion = webApiVersionMajor; deviceCapabilitiesInfo->webApiVersion += "."; deviceCapabilitiesInfo->webApiVersion += webApiVersionMinor; - LogDebug("web api version : " << deviceCapabilitiesInfo->webApiVersion); + LoggerD("web api version : " << deviceCapabilitiesInfo->webApiVersion); break; } } @@ -394,14 +398,14 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR std::string nativeApiVersionMinor = ""; if(!file) { - LogDebug("api/native version info file not found"); + LoggerD("api/native version info file not found"); } else { while ((std::getline(file, line).rdstate() & (std::ifstream::failbit | std::ifstream::eofbit)) == 0) { if (pcrecpp::RE("platform.native.api.version=(\\w+).(\\w+)").PartialMatch(line, &nativeApiVersionMajor, &nativeApiVersionMinor )) { deviceCapabilitiesInfo->nativeApiVersion = nativeApiVersionMajor; deviceCapabilitiesInfo->nativeApiVersion += "."; deviceCapabilitiesInfo->nativeApiVersion += nativeApiVersionMinor; - LogDebug("native api version : " << deviceCapabilitiesInfo->nativeApiVersion); + LoggerD("native api version : " << deviceCapabilitiesInfo->nativeApiVersion); break; } } @@ -412,7 +416,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONT)) { bool cameraFront = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &cameraFront) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("cameraFront : " << cameraFront); + LoggerD("cameraFront : " << cameraFront); deviceCapabilitiesInfo->cameraFront = cameraFront; } return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFront); @@ -421,77 +425,77 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERAFRONTFLASH)) { bool cameraFrontFlash = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &cameraFrontFlash) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("cameraFrontFlash : " << cameraFrontFlash); + LoggerD("cameraFrontFlash : " << cameraFrontFlash); deviceCapabilitiesInfo->cameraFrontFlash = cameraFrontFlash; } return convert.toJSValueRef(deviceCapabilitiesInfo->cameraFrontFlash); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACK)) { bool cameraBack = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &cameraBack) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("cameraBack : " << cameraBack); + LoggerD("cameraBack : " << cameraBack); deviceCapabilitiesInfo->cameraBack = cameraBack; } return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBack); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_CAMERABACKFLASH)) { bool cameraBackFlash = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &cameraBackFlash) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("cameraBackFlash : " << cameraBackFlash); + LoggerD("cameraBackFlash : " << cameraBackFlash); deviceCapabilitiesInfo->cameraBackFlash = cameraBackFlash; } return convert.toJSValueRef(deviceCapabilitiesInfo->cameraBackFlash); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATION)) { bool location = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_CPS_SUPPORTED, &location) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("location : " << location); + LoggerD("location : " << location); deviceCapabilitiesInfo->location = location; } return convert.toJSValueRef(deviceCapabilitiesInfo->location); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONGPS)) { bool locationGps = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &locationGps) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("locationGps : " << locationGps); + LoggerD("locationGps : " << locationGps); deviceCapabilitiesInfo->locationGps = locationGps; } return convert.toJSValueRef(deviceCapabilitiesInfo->locationGps); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_LOCATIONWPS)) { bool locationWps = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_WPS_SUPPORTED, &locationWps) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("locationWps : " << locationWps); + LoggerD("locationWps : " << locationWps); deviceCapabilitiesInfo->locationWps = locationWps; } return convert.toJSValueRef(deviceCapabilitiesInfo->locationWps); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MICROPHONE)) { bool microphone = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, µphone) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("microphone : " << microphone); + LoggerD("microphone : " << microphone); deviceCapabilitiesInfo->microphone = microphone; } return convert.toJSValueRef(deviceCapabilitiesInfo->microphone); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBHOST)) { bool usbHost = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHost) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("usbHost : " << usbHost); + LoggerD("usbHost : " << usbHost); deviceCapabilitiesInfo->usbHost = usbHost; } return convert.toJSValueRef(deviceCapabilitiesInfo->usbHost); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_USBACCESSORY)) { bool usbAccessory = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessory) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("usbAccessory : " << usbAccessory); + LoggerD("usbAccessory : " << usbAccessory); deviceCapabilitiesInfo->usbAccessory = usbAccessory; } return convert.toJSValueRef(deviceCapabilitiesInfo->usbAccessory); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTRCA)) { bool screenOutputRca = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &screenOutputRca) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("screenOutputRca : " << screenOutputRca); + LoggerD("screenOutputRca : " << screenOutputRca); deviceCapabilitiesInfo->screenOutputRca = screenOutputRca; } return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputRca); } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SCREENOUTPUTHDMI)) { bool screenOutputHdmi = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &screenOutputHdmi) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("screenOutputHdmi : " << screenOutputHdmi); + LoggerD("screenOutputHdmi : " << screenOutputHdmi); deviceCapabilitiesInfo->screenOutputHdmi = screenOutputHdmi; } return convert.toJSValueRef(deviceCapabilitiesInfo->screenOutputHdmi); @@ -499,7 +503,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* platformCoreCpuArch = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &platformCoreCpuArch) == SYSTEM_INFO_ERROR_NONE) { if (platformCoreCpuArch) { - LogDebug("platformCoreCpuArch : " << platformCoreCpuArch); + LoggerD("platformCoreCpuArch : " << platformCoreCpuArch); deviceCapabilitiesInfo->platformCoreCpuArch = platformCoreCpuArch; free(platformCoreCpuArch); } @@ -509,7 +513,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* platformCoreFpuArch = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &platformCoreFpuArch) == SYSTEM_INFO_ERROR_NONE) { if (platformCoreFpuArch) { - LogDebug("platformCoreFpuArch : " << platformCoreFpuArch); + LoggerD("platformCoreFpuArch : " << platformCoreFpuArch); deviceCapabilitiesInfo->platformCoreFpuArch = platformCoreFpuArch; free(platformCoreFpuArch); } @@ -518,7 +522,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SIPVOIP)) { bool sipVoip = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoip) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("sipVoip : " << sipVoip); + LoggerD("sipVoip : " << sipVoip); deviceCapabilitiesInfo->sipVoip = sipVoip; } return convert.toJSValueRef(deviceCapabilitiesInfo->sipVoip); @@ -526,7 +530,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR char* duid = NULL; if (system_info_get_value_string(SYSTEM_INFO_KEY_DEVICE_UUID, &duid) == SYSTEM_INFO_ERROR_NONE) { if (duid) { - LogDebug("duid : " << duid); + LoggerD("duid : " << duid); deviceCapabilitiesInfo->duid = duid; free(duid); } @@ -535,7 +539,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_SPEECH_ROCOGNITION)) { bool speechRecognition = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognition) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("speechRecognition : " << speechRecognition); + LoggerD("speechRecognition : " << speechRecognition); deviceCapabilitiesInfo->speechRecognition = speechRecognition; } return convert.toJSValueRef(deviceCapabilitiesInfo->speechRecognition); @@ -544,7 +548,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_ACCELEROMETER)) { bool isAccelerometer = false; if (sensor_is_supported(SENSOR_ACCELEROMETER, &isAccelerometer) == SENSOR_ERROR_NONE) { - LogDebug("accelerometer : " << isAccelerometer); + LoggerD("accelerometer : " << isAccelerometer); deviceCapabilitiesInfo->accelerometer = isAccelerometer; } return convert.toJSValueRef(deviceCapabilitiesInfo->accelerometer); @@ -553,7 +557,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_BAROMETER)) { bool isBarometer = false; if (system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &isBarometer) == SYSTEM_INFO_ERROR_NONE) { - LogDebug("barometer : " << isBarometer); + LoggerD("barometer : " << isBarometer); deviceCapabilitiesInfo->barometer = isBarometer; } return convert.toJSValueRef(deviceCapabilitiesInfo->barometer); @@ -562,7 +566,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_GYROSCOPE)) { bool isGyroscope = false; if (sensor_is_supported(SENSOR_GYROSCOPE, &isGyroscope) == SENSOR_ERROR_NONE) { - LogDebug("gyroscope : " << isGyroscope); + LoggerD("gyroscope : " << isGyroscope); deviceCapabilitiesInfo->gyroscope = isGyroscope; } return convert.toJSValueRef(deviceCapabilitiesInfo->gyroscope); @@ -571,7 +575,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_MAGNETOMETER)) { bool isMagnetometer = false; if (sensor_is_supported(SENSOR_MAGNETIC, &isMagnetometer) == SENSOR_ERROR_NONE) { - LogDebug("magnetometer : " << isMagnetometer); + LoggerD("magnetometer : " << isMagnetometer); deviceCapabilitiesInfo->magnetometer = isMagnetometer; } return convert.toJSValueRef(deviceCapabilitiesInfo->magnetometer); @@ -584,7 +588,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } else if (JSStringIsEqualToUTF8CString(propertyName, DEVICE_CAPABILITIES_PROXIMITY)) { bool isProximity = false; if (sensor_is_supported(SENSOR_PROXIMITY, &isProximity) == SENSOR_ERROR_NONE) { - LogDebug("proximity : " << isProximity); + LoggerD("proximity : " << isProximity); deviceCapabilitiesInfo->proximity = isProximity; } return convert.toJSValueRef(deviceCapabilitiesInfo->proximity); @@ -632,7 +636,7 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSDeviceOrientationInfo.cpp b/src/Systeminfo/JSDeviceOrientationInfo.cpp old mode 100755 new mode 100644 index 0b402c3..ffaee4f --- a/src/Systeminfo/JSDeviceOrientationInfo.cpp +++ b/src/Systeminfo/JSDeviceOrientationInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSDeviceOrientationInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -74,10 +74,10 @@ void JSDeviceOrientationInfo::Initialize(JSContextRef context, JSObjectRef objec void JSDeviceOrientationInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSDeviceOrientationPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting deviceOrientationInfo object"); + LoggerD("Deleting deviceOrientationInfo object"); delete priv; } @@ -94,10 +94,10 @@ JSObjectRef JSDeviceOrientationInfo::createJSObject(JSContextRef context, const JSValueRef JSDeviceOrientationInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSDeviceOrientationPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -112,7 +112,7 @@ JSValueRef JSDeviceOrientationInfo::getProperty(JSContextRef context, JSObjectRe } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSDisplayInfo.cpp b/src/Systeminfo/JSDisplayInfo.cpp old mode 100755 new mode 100644 index 5130620..1667562 --- a/src/Systeminfo/JSDisplayInfo.cpp +++ b/src/Systeminfo/JSDisplayInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSDisplayInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -86,10 +86,10 @@ void JSDisplayInfo::Initialize(JSContextRef context, JSObjectRef object) void JSDisplayInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSDisplayPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting DisplayInfo object"); + LoggerD("Deleting DisplayInfo object"); delete priv; } @@ -106,10 +106,10 @@ JSObjectRef JSDisplayInfo::createJSObject(JSContextRef context, const DisplayPro JSValueRef JSDisplayInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSDisplayPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -135,7 +135,7 @@ JSValueRef JSDisplayInfo::getProperty(JSContextRef context, JSObjectRef object, } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSLocaleInfo.cpp b/src/Systeminfo/JSLocaleInfo.cpp old mode 100755 new mode 100644 index e8dab73..61310e4 --- a/src/Systeminfo/JSLocaleInfo.cpp +++ b/src/Systeminfo/JSLocaleInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSLocaleInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -76,10 +76,10 @@ void JSLocaleInfo::Initialize(JSContextRef context, JSObjectRef object) void JSLocaleInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSLocalePriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting localeInfo object"); + LoggerD("Deleting localeInfo object"); delete priv; } @@ -96,10 +96,10 @@ JSObjectRef JSLocaleInfo::createJSObject(JSContextRef context, const LocalePrope JSValueRef JSLocaleInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSLocalePriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -116,7 +116,7 @@ JSValueRef JSLocaleInfo::getProperty(JSContextRef context, JSObjectRef object, J } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSNetworkInfo.cpp b/src/Systeminfo/JSNetworkInfo.cpp old mode 100755 new mode 100644 index 692346d..83cf4db --- a/src/Systeminfo/JSNetworkInfo.cpp +++ b/src/Systeminfo/JSNetworkInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSNetworkInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -74,10 +74,10 @@ void JSNetworkInfo::Initialize(JSContextRef context, JSObjectRef object) void JSNetworkInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSNetworkPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting networkInfo object"); + LoggerD("Deleting networkInfo object"); delete priv; } @@ -94,10 +94,10 @@ JSObjectRef JSNetworkInfo::createJSObject(JSContextRef context, const NetworkPro JSValueRef JSNetworkInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSNetworkPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -112,7 +112,7 @@ JSValueRef JSNetworkInfo::getProperty(JSContextRef context, JSObjectRef object, } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSPeripheralInfo.cpp b/src/Systeminfo/JSPeripheralInfo.cpp old mode 100755 new mode 100644 index b9ae256..826cf7b --- a/src/Systeminfo/JSPeripheralInfo.cpp +++ b/src/Systeminfo/JSPeripheralInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSPeripheralInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -74,10 +74,10 @@ void JSPeripheralInfo::Initialize(JSContextRef context, JSObjectRef object) void JSPeripheralInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSPeripheralPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting peripheralInfo object"); + LoggerD("Deleting peripheralInfo object"); delete priv; } @@ -94,10 +94,10 @@ JSObjectRef JSPeripheralInfo::createJSObject(JSContextRef context, const Periphe JSValueRef JSPeripheralInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSPeripheralPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -112,7 +112,7 @@ JSValueRef JSPeripheralInfo::getProperty(JSContextRef context, JSObjectRef objec } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSSIMInfo.cpp b/src/Systeminfo/JSSIMInfo.cpp index 7092ab9..8b6e534 100755 --- a/src/Systeminfo/JSSIMInfo.cpp +++ b/src/Systeminfo/JSSIMInfo.cpp @@ -16,13 +16,13 @@ // #include -#include #include #include #include #include #include "JSSIMInfo.h" #include "plugin_config.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -31,6 +31,7 @@ using namespace WrtDeviceApis::Commons; using namespace DeviceAPI::Common; namespace { +const char* SIM_STATE_PROPERTY = "state"; const char* SIM_OPERATORNAME_PROPERTY = "operatorName"; const char* SIM_MSISDN_PROPERTY = "msisdn"; const char* SIM_ICCID_PROPERTY = "iccid"; @@ -63,6 +64,7 @@ JSClassDefinition JSSIMInfo::m_classInfo = { }; JSStaticValue JSSIMInfo::m_properties[] = { + { SIM_STATE_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly }, { SIM_OPERATORNAME_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly }, { SIM_MSISDN_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly }, { SIM_ICCID_PROPERTY, getProperty, NULL, kJSPropertyAttributeReadOnly }, @@ -92,10 +94,10 @@ void JSSIMInfo::Initialize(JSContextRef context, JSObjectRef object) void JSSIMInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSSIMPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting SIM Info object"); + LoggerD("Deleting SIM Info object"); delete priv; } @@ -106,18 +108,18 @@ bool JSSIMInfo::hasProperty(JSContextRef context, JSObjectRef object, JSStringRe JSObjectRef JSSIMInfo::createJSObject(JSContextRef context, const SIMPropertiesPtr SIMInfo) { - LogDebug("Enter"); + LoggerD("Enter"); JSSIMPriv *priv = new JSSIMPriv(context, SIMInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSSIMPriv *priv = static_cast(JSObjectGetPrivate(object)); int ret = SIM_ERROR_NONE; if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -125,8 +127,24 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt { SIMPropertiesPtr SIMInfo = priv->getObject(); Converter convert(context); - - if (JSStringIsEqualToUTF8CString(propertyName, SIM_OPERATORNAME_PROPERTY)) { + if (JSStringIsEqualToUTF8CString(propertyName, SIM_STATE_PROPERTY)) { + AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + sim_state_e state; + ret = sim_get_state(&state); + if (ret == SIM_ERROR_NONE) { + if (state == SIM_STATE_UNAVAILABLE) { + SIMInfo->state = "ABSENT"; + } else if (state == SIM_STATE_LOCKED) { + SIMInfo->state = "PIN_REQUIRED"; + } else if (state == SIM_STATE_AVAILABLE) { + SIMInfo->state = "READY"; + } else if (state == SIM_STATE_UNKNOWN) { + SIMInfo->state = "INITIALIZING"; + } + } + return convert.toJSValueRef(SIMInfo->state); + } else if (JSStringIsEqualToUTF8CString(propertyName, SIM_OPERATORNAME_PROPERTY)) { AceSecurityStatus status = SYSTEMINFO_CHECK_ACCESS(SYSTEMINFO_FUNCTION_API_GET_PROPERTY_SIM_VALUE); TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); char* fullName = NULL; @@ -135,11 +153,11 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (fullName) { SIMInfo->operatorName = fullName; - LogDebug("operatorName : " << SIMInfo->operatorName); + LoggerD("operatorName : " << SIMInfo->operatorName); free(fullName); } else if (shortName) { SIMInfo->operatorName = shortName; - LogDebug("operatorName : " << SIMInfo->operatorName); + LoggerD("operatorName : " << SIMInfo->operatorName); free(shortName); } } @@ -152,7 +170,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (msisdn) { SIMInfo->msisdn = msisdn; - LogDebug("msisdn : " << SIMInfo->msisdn); + LoggerD("msisdn : " << SIMInfo->msisdn); free(msisdn); } } @@ -165,7 +183,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (iccId) { SIMInfo->iccid = iccId; - LogDebug("iccid : " << SIMInfo->iccid); + LoggerD("iccid : " << SIMInfo->iccid); free(iccId); } } @@ -178,7 +196,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (mcc) { SIMInfo->mcc = atoi(mcc); - LogDebug("mcc : " << SIMInfo->mcc); + LoggerD("mcc : " << SIMInfo->mcc); free(mcc); } } @@ -191,7 +209,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (mnc) { SIMInfo->mnc = atoi(mnc); - LogDebug("mnc : " << SIMInfo->mnc); + LoggerD("mnc : " << SIMInfo->mnc); free(mnc); } } @@ -204,7 +222,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (msin) { SIMInfo->msin = msin; - LogDebug("msin : " << SIMInfo->msin); + LoggerD("msin : " << SIMInfo->msin); free(msin); } } @@ -217,7 +235,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt if (ret == SIM_ERROR_NONE) { if (spn) { SIMInfo->spn = spn; - LogDebug("spn : " << SIMInfo->spn); + LoggerD("spn : " << SIMInfo->spn); free(spn); } } @@ -226,7 +244,7 @@ JSValueRef JSSIMInfo::getProperty(JSContextRef context, JSObjectRef object, JSSt } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSStorageInfo.cpp b/src/Systeminfo/JSStorageInfo.cpp old mode 100755 new mode 100644 index e6e605a..f75fcd5 --- a/src/Systeminfo/JSStorageInfo.cpp +++ b/src/Systeminfo/JSStorageInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSStorageInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -82,10 +82,10 @@ void JSStorageInfo::Initialize(JSContextRef context, JSObjectRef object) void JSStorageInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSStoragePriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting StorageInfo object"); + LoggerD("Deleting StorageInfo object"); delete priv; } @@ -102,10 +102,10 @@ JSObjectRef JSStorageInfo::createJSObject(JSContextRef context, const StoragePro JSValueRef JSStorageInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSStoragePriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -127,7 +127,7 @@ JSValueRef JSStorageInfo::getProperty(JSContextRef context, JSObjectRef object, } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/JSSysteminfo.cpp b/src/Systeminfo/JSSysteminfo.cpp old mode 100644 new mode 100755 index a05df24..0339b0c --- a/src/Systeminfo/JSSysteminfo.cpp +++ b/src/Systeminfo/JSSysteminfo.cpp @@ -91,13 +91,13 @@ void JSSysteminfo::initialize(JSContextRef context, JSObjectRef object) ISysteminfoPtr Systeminfos(SysteminfoFactory::getInstance().getSysteminfos()); JSSysteminfoPriv* priv = new JSSysteminfoPriv(context, Systeminfos); if (!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } - LogDebug("JSSysteminfo::initialize "); + LoggerD("JSSysteminfo::initialize "); } else { - LogDebug("Private object already set."); + LoggerD("Private object already set."); } } @@ -106,7 +106,7 @@ void JSSysteminfo::finalize(JSObjectRef object) JSSysteminfoPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting gallery"); + LoggerD("Deleting gallery"); delete priv; } @@ -119,7 +119,7 @@ JSValueRef JSSysteminfo::getCapabilities(JSContextRef context, JSObjectRef objec Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } Try @@ -153,7 +153,7 @@ JSValueRef JSSysteminfo::getPropertyValue(JSContextRef context, JSObjectRef obje std::string property; if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 2) { @@ -168,7 +168,7 @@ JSValueRef JSSysteminfo::getPropertyValue(JSContextRef context, JSObjectRef obje if (argumentCount == 3) { if (check.isCallback(arguments[2])) { onErrorForCbm = arguments[2]; - } else if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) { + } else if (!JSValueIsNull(context, arguments[2])) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } } @@ -178,9 +178,10 @@ JSValueRef JSSysteminfo::getPropertyValue(JSContextRef context, JSObjectRef obje Try { ISysteminfoPtr Systeminfos(priv->getObject()); + BasePropertyPtr baseProperty = Systeminfos->getBasePropertyPtr(priv->getContext(), arguments[0]); EventGetSysteminfoPtr event(new EventGetSysteminfo()); - event->setBasePropertyPtr(Systeminfos->getBasePropertyPtr(priv->getContext(), arguments[0])); + event->setBasePropertyPtr(baseProperty); TIME_TRACER_ITEM_BEGIN(event->getProperty(), 0); event->setPrivateData(StaticPointerCast(cbm)); @@ -193,14 +194,8 @@ JSValueRef JSSysteminfo::getPropertyValue(JSContextRef context, JSObjectRef obje return JSValueMakeUndefined(context); } - Catch(WrtDeviceApis::Commons::PendingOperationException) { - cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Unknown error")); - } Catch(WrtDeviceApis::Commons::ConversionException) { - cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error")); - } - Catch(WrtDeviceApis::Commons::InvalidArgumentException){ - cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error")); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } Catch(WrtDeviceApis::Commons::Exception) { cbm->callOnError(JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Unknown error")); @@ -218,7 +213,7 @@ JSValueRef JSSysteminfo::addPropertyValueChangeListener(JSContextRef context, JS Validator check(context, exception); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 2) { @@ -239,22 +234,23 @@ JSValueRef JSSysteminfo::addPropertyValueChangeListener(JSContextRef context, JS option.timeout = converter.toULong(JSUtils::getJSProperty(context, arguments[2], "timeout", exception)); option.highThreshold = converter.toDouble(JSUtils::getJSProperty(context, arguments[2], "highThreshold", exception)); option.lowThreshold = converter.toDouble(JSUtils::getJSProperty(context, arguments[2], "lowThreshold", exception)); - } else if (!JSValueIsNull(context, arguments[2]) && !JSValueIsUndefined(context, arguments[2])) { + } else if (!JSValueIsNull(context, arguments[2])) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } } ISysteminfoPtr Systeminfos(priv->getObject()); + BasePropertyPtr baseProperty = Systeminfos->getBasePropertyPtr(priv->getContext(), arguments[0]); EventWatchSysteminfoPtr event(new EventWatchSysteminfo); event->setWatchOption(option); - event->setBasePropertyPtr(Systeminfos->getBasePropertyPtr(priv->getContext(), arguments[0])); + event->setBasePropertyPtr(baseProperty); event->setPrivateData(StaticPointerCast(cbm)); SysteminfoListener& listener = SysteminfoListener::getInstance(); event->setForAsynchronousCall(&listener); Systeminfos->watch(event); - LogDebug("event->getId()" << event->getId()); + LoggerD("event->getId()" << event->getId()); SysteminfoListenerCancellerPtr canceller = SysteminfoListenerCancellerPtr(new SysteminfoListenerCanceller(priv->getContext(), thisObject, event->getId())); DeviceAPI::Common::IListenerItemPtr listenerItem = DPL::StaticPointerCast(canceller); @@ -264,7 +260,7 @@ JSValueRef JSSysteminfo::addPropertyValueChangeListener(JSContextRef context, JS } Catch(WrtDeviceApis::Commons::ConversionException) { - return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error"); + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type missmatch error"); } Catch(WrtDeviceApis::Commons::InvalidArgumentException) { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error"); @@ -282,7 +278,7 @@ JSValueRef JSSysteminfo::removePropertyValueChangeListener(JSContextRef context, Converter converter(context); if (!priv) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Wrong Object"); } if (argumentCount < 1) { @@ -293,7 +289,7 @@ JSValueRef JSSysteminfo::removePropertyValueChangeListener(JSContextRef context, ISysteminfoPtr Systeminfos(priv->getObject()); id = static_cast(converter.toLong(arguments[0])); - LogDebug("clearWatch id = " << id ); + LoggerD("clearWatch id = " << id ); Systeminfos->clearWatch(id); SysteminfoListenerCancellerPtr canceller = SysteminfoListenerCancellerPtr(new SysteminfoListenerCanceller(priv->getContext(), thisObject, id)); diff --git a/src/Systeminfo/JSWifiNetworkInfo.cpp b/src/Systeminfo/JSWifiNetworkInfo.cpp old mode 100755 new mode 100644 index b9343e3..aa5c6da --- a/src/Systeminfo/JSWifiNetworkInfo.cpp +++ b/src/Systeminfo/JSWifiNetworkInfo.cpp @@ -16,8 +16,8 @@ // #include -#include #include "JSWifiNetworkInfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -82,10 +82,10 @@ void JSWifiNetworkInfo::Initialize(JSContextRef context, JSObjectRef object) void JSWifiNetworkInfo::Finalize(JSObjectRef object) { - LogDebug("Entered"); + LoggerD("Entered"); JSWifiNetworkPriv* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting WifiNetworkInfo object"); + LoggerD("Deleting WifiNetworkInfo object"); delete priv; } @@ -96,17 +96,17 @@ bool JSWifiNetworkInfo::hasProperty(JSContextRef context, JSObjectRef object, JS JSObjectRef JSWifiNetworkInfo::createJSObject(JSContextRef context, const WifiNetworkPropertiesPtr wifiNetworkInfo) { - LogDebug("Enter"); + LoggerD("Enter"); JSWifiNetworkPriv *priv = new JSWifiNetworkPriv(context, wifiNetworkInfo); return JSObjectMake(context, getClassRef(), priv); } JSValueRef JSWifiNetworkInfo::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); JSWifiNetworkPriv *priv = static_cast(JSObjectGetPrivate(object)); if (NULL == priv) { - LogError("Private object not set."); + LoggerE("Private object not set."); return JSValueMakeUndefined(context); } @@ -129,7 +129,7 @@ JSValueRef JSWifiNetworkInfo::getProperty(JSContextRef context, JSObjectRef obje } Catch(Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } diff --git a/src/Systeminfo/Systeminfo.cpp b/src/Systeminfo/Systeminfo.cpp index 12bf614..a76549d 100755 --- a/src/Systeminfo/Systeminfo.cpp +++ b/src/Systeminfo/Systeminfo.cpp @@ -17,13 +17,13 @@ #include #include -#include #include #include #include #include #include #include "Systeminfo.h" +#include using namespace WrtDeviceApis::CommonsJavaScript; using namespace WrtDeviceApis::Commons; @@ -94,7 +94,7 @@ static Eina_Bool CpuValueCallback(void* event_ptr) void OrientationValueCallback(unsigned int event_type, sensor_event_data_t *event , void *event_ptr) { - LogDebug("enter"); + LoggerD("enter"); if(event_ptr) { ((Systeminfo*)event_ptr)->getWatchValue(WATCH_TYPE_DEVICE_ORIENTATION); } @@ -102,7 +102,7 @@ void OrientationValueCallback(unsigned int event_type, sensor_event_data_t *even void localeChangedCallback(runtime_info_key_e key, void* event_ptr) { - LogDebug("enter"); + LoggerD("enter"); if(event_ptr) { ((Systeminfo*)event_ptr)->getWatchValue(WATCH_TYPE_LOCALE); } @@ -156,20 +156,20 @@ Systeminfo::Systeminfo() : m_networkRegist(REGIST_NOT), int ret = connection_create(&m_connectionHandle); if (CONNECTION_ERROR_NONE == ret) { - LogDebug("Network Client registration success"); + LoggerD("Network Client registration success"); } else { - LogDebug("Network Client registration success"); + LoggerD("Network Client registration success"); m_connectionHandle = NULL; } m_sensorHandle = sf_connect(ACCELEROMETER_SENSOR); if (m_sensorHandle < 0) { - LogDebug ("sensor attach fail"); + LoggerD ("sensor attach fail"); } else { - LogDebug("m_sensorHandle : " << m_sensorHandle); + LoggerD("m_sensorHandle : " << m_sensorHandle); int state = sf_start(m_sensorHandle, 0); if(state < 0) { - LogDebug("failed"); + LoggerD("failed"); } } } @@ -190,22 +190,22 @@ Systeminfo::~Systeminfo() m_EventMgrPtr->clearAllEvent(); if(m_connectionHandle != NULL) { - LogDebug("Network Client deregistration success"); + LoggerD("Network Client deregistration success"); connection_destroy(m_connectionHandle); } else { - LogDebug("Network Client deregistration failed"); + LoggerD("Network Client deregistration failed"); } state = sf_stop(m_sensorHandle); - LogDebug("handle 1 state = " << state); + LoggerD("handle 1 state = " << state); state = sf_disconnect(m_sensorHandle); - LogDebug("handle state =" << state); + LoggerD("handle state =" << state); } DeviceCapabilitiesPropertiesPtr Systeminfo::getCapabilities() { - LogDebug("enter"); + LoggerD("enter"); DeviceCapabilitiesPropertiesPtr deviceCapabilities(new DeviceCapabilitiesProperties()); return deviceCapabilities; } @@ -218,7 +218,7 @@ void Systeminfo::get(const EventGetSysteminfoPtr& event) void Systeminfo::watch(const EventWatchSysteminfoPtr& event) { if(event->getWatchType() == WATCH_TYPE_UNKNOWN) { - LogDebug("watch method is not supported"); + LoggerD("watch method is not supported"); event->setId(-1); return; } @@ -232,7 +232,7 @@ void Systeminfo::watch(const EventWatchSysteminfoPtr& event) void Systeminfo::clearWatch(const long id) { if (id < 1) { - Throw(InvalidArgumentException); + Throw(WrtDeviceApis::Commons::InvalidArgumentException); } else { int watchType = m_EventMgrPtr->getWatchType(id); switch(watchType) { @@ -295,14 +295,20 @@ void Systeminfo::clearWatch(const long id) if ((m_EventMgrPtr->getEventDeviceOrientationList()).size() == 1) { int state = sf_unregister_event(m_sensorHandle, ACCELEROMETER_EVENT_ROTATION_CHECK); if (state < 0) { - LogDebug("sf_unregister_event fail to gather data\n"); + LoggerD("sf_unregister_event fail to gather data\n"); } } break; case WATCH_TYPE_LOCALE: if ((m_EventMgrPtr->getEventLocaleList()).size() == 1) { - runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_LANGUAGE); - runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_REGION); + if (runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_LANGUAGE) != RUNTIME_INFO_ERROR_NONE) { + LoggerE("regist failed"); + Throw(WrtDeviceApis::Commons::Exception); + } + if (runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_REGION) != RUNTIME_INFO_ERROR_NONE) { + LoggerE("regist failed"); + Throw(WrtDeviceApis::Commons::Exception); + } } break; case WATCH_TYPE_PERIPHERAL: @@ -312,7 +318,7 @@ void Systeminfo::clearWatch(const long id) } break; case WATCH_TYPE_UNKNOWN: - Throw(InvalidArgumentException); + Throw(WrtDeviceApis::Commons::InvalidArgumentException); break; } m_EventMgrPtr->removeEvent(id, watchType); @@ -325,8 +331,8 @@ BasePropertyPtr Systeminfo::getBasePropertyPtr(JSContextRef context, JSValueRef std::string l_property = converter.toString(property); mapProperties::iterator it = (*m_Property).find(l_property); if (it == (*m_Property).end()) { - LogError("not existing property"); - Throw(InvalidArgumentException); + LoggerE("not existing property"); + Throw(WrtDeviceApis::Commons::ConversionException); return BasePropertyPtr(NULL); } @@ -384,7 +390,7 @@ void Systeminfo::getWatchValue(const int watchType) storageCnt++; } } - LogDebug("storage cnt : " << storageCnt); + LoggerD("storage cnt : " << storageCnt); (*it)->getWatchValue(storageCnt); } }else if (watchType == WATCH_TYPE_DEVICE_ORIENTATION) { @@ -419,12 +425,12 @@ connection_h Systeminfo::getConnectionHandle() JSValueRef Systeminfo::getCpuValue(JSContextRef context) { - LogDebug("enter"); + LoggerD("enter"); Converter converter(context); CpuPropertiesPtr cpuPtr(new CpuProperties()); FILE *fp = NULL; - unsigned long long usr = 0, nice = 0, system = 0, idle = 0, cpuUsage = 0, diffIdle = 0, total = 0; + long long usr = 0, nice = 0, system = 0, idle = 0, cpuUsage = 0, diffIdle = 0, total = 0; fp = fopen("/proc/stat", "r"); if(fp == NULL) { @@ -434,14 +440,14 @@ JSValueRef Systeminfo::getCpuValue(JSContextRef context) if (fscanf(fp, "%*s %lld %lld %lld %lld", &usr, &system, &nice, &idle) > 0) { total = usr + nice + system + idle - m_cpuInfo.usr - m_cpuInfo.nice - m_cpuInfo.system - m_cpuInfo.idle; diffIdle = idle-m_cpuInfo.idle; - if ((total > 0ULL) && (diffIdle > 0ULL)) { - cpuUsage = diffIdle * 100ULL / total; + if ((total > 0LL) && (diffIdle > 0LL)) { + cpuUsage = diffIdle * 100LL / total; cpuPtr->load = (double)cpuUsage / 100.0; m_cpuInfo.usr = usr; m_cpuInfo.system = system; m_cpuInfo.nice = nice; m_cpuInfo.idle = idle; - LogDebug("cpu load : " << cpuPtr->load); + LoggerD("cpu load : " << cpuPtr->load); } } @@ -451,7 +457,7 @@ JSValueRef Systeminfo::getCpuValue(JSContextRef context) void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event) { - LogDebug("enter"); + LoggerD("enter"); event->processGetValue((void *)m_connectionHandle); } @@ -517,22 +523,28 @@ void Systeminfo::OnRequestReceived(const EventWatchSysteminfoPtr& event) } break; case WATCH_TYPE_DEVICE_ORIENTATION: - LogDebug("regist sensor"); + LoggerD("regist sensor"); if ((m_EventMgrPtr->getEventDeviceOrientationList()).size() == 1) { int state = sf_register_event(m_sensorHandle, ACCELEROMETER_EVENT_ROTATION_CHECK, NULL, OrientationValueCallback, (void *)this); if (state < 0) { - LogDebug("sensor_register_cb fail to gather data"); + LoggerD("sensor_register_cb fail to gather data"); } else if (state == 0) { - LogDebug("sensor_register_cb success to gather data"); + LoggerD("sensor_register_cb success to gather data"); } } else { - LogDebug("already regist"); + LoggerD("already regist"); } break; case WATCH_TYPE_LOCALE: if ((m_EventMgrPtr->getEventLocaleList()).size() == 1) { - runtime_info_set_changed_cb(RUNTIME_INFO_KEY_REGION, localeChangedCallback, (void *)this); - runtime_info_set_changed_cb(RUNTIME_INFO_KEY_LANGUAGE, localeChangedCallback, (void *)this); + if (runtime_info_set_changed_cb(RUNTIME_INFO_KEY_REGION, localeChangedCallback, (void *)this) != RUNTIME_INFO_ERROR_NONE) { + LoggerE("regist failed"); + Throw(WrtDeviceApis::Commons::Exception); + } + if (runtime_info_set_changed_cb(RUNTIME_INFO_KEY_LANGUAGE, localeChangedCallback, (void *)this) != RUNTIME_INFO_ERROR_NONE) { + LoggerE("regist failed"); + Throw(WrtDeviceApis::Commons::Exception); + } } break; case WATCH_TYPE_PERIPHERAL: @@ -562,61 +574,61 @@ void Systeminfo::EventMgr::clearAllEvent() while (!m_eventBatteryList.empty()) { EventWatchSysteminfoPtr event = m_eventBatteryList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventBatteryList.pop_front(); } while (!m_eventDisplayList.empty()) { EventWatchSysteminfoPtr event = m_eventDisplayList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventDisplayList.pop_front(); } while (!m_eventWifiNetworkList.empty()) { EventWatchSysteminfoPtr event = m_eventWifiNetworkList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventWifiNetworkList.pop_front(); } while (!m_eventCelluarNetworkList.empty()) { EventWatchSysteminfoPtr event = m_eventCelluarNetworkList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventCelluarNetworkList.pop_front(); } while (!m_eventStorageList.empty()) { EventWatchSysteminfoPtr event = m_eventStorageList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventStorageList.pop_front(); } while (!m_eventCpuList.empty()) { EventWatchSysteminfoPtr event = m_eventCpuList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventCpuList.pop_front(); } while (!m_eventSimList.empty()) { EventWatchSysteminfoPtr event = m_eventSimList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventSimList.pop_front(); } while (!m_eventDeviceOrientationList.empty()) { EventWatchSysteminfoPtr event = m_eventDeviceOrientationList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventDeviceOrientationList.pop_front(); } while (!m_eventLocaleList.empty()) { EventWatchSysteminfoPtr event = m_eventLocaleList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventLocaleList.pop_front(); } while (!m_eventPeripheralList.empty()) { EventWatchSysteminfoPtr event = m_eventPeripheralList.front(); - LogDebug("removing EventId=" << event->getId()); + LoggerD("removing EventId=" << event->getId()); event->clearWatch(); m_eventPeripheralList.pop_front(); } @@ -628,48 +640,48 @@ void Systeminfo::EventMgr::addEvent(const EventWatchSysteminfoPtr& arg, const in if (watchType == WATCH_TYPE_BATTERY){ m_eventBatteryList.push_back(arg); - LogDebug("Event Battery list size=" << m_eventBatteryList.size()); + LoggerD("Event Battery list size=" << m_eventBatteryList.size()); } else if (watchType == WATCH_TYPE_DISPLAY) { m_eventDisplayList.push_back(arg); - LogDebug("Event display list size=" << m_eventDisplayList.size()); + LoggerD("Event display list size=" << m_eventDisplayList.size()); } else if (watchType == WATCH_TYPE_WIFINETWORK) { m_eventWifiNetworkList.push_back(arg); - LogDebug("Event wifi network list size=" << m_eventWifiNetworkList.size()); + LoggerD("Event wifi network list size=" << m_eventWifiNetworkList.size()); } else if (watchType == WATCH_TYPE_CELLULARNETWORK) { m_eventCelluarNetworkList.push_back(arg); - LogDebug("Event cellular network list size=" << m_eventCelluarNetworkList.size()); + LoggerD("Event cellular network list size=" << m_eventCelluarNetworkList.size()); } else if (watchType == WATCH_TYPE_STORAGE) { m_eventStorageList.push_back(arg); - LogDebug("Event storage list size=" << m_eventStorageList.size()); + LoggerD("Event storage list size=" << m_eventStorageList.size()); } else if (watchType == WATCH_TYPE_CPU) { m_eventCpuList.push_back(arg); - LogDebug("Event cpu list size=" << m_eventCpuList.size()); + LoggerD("Event cpu list size=" << m_eventCpuList.size()); } else if (watchType == WATCH_TYPE_SIM) { m_eventSimList.push_back(arg); - LogDebug("Event sim list size=" << m_eventSimList.size()); + LoggerD("Event sim list size=" << m_eventSimList.size()); } else if (watchType == WATCH_TYPE_DEVICE_ORIENTATION) { m_eventDeviceOrientationList.push_back(arg); - LogDebug("Event device orientation list size=" << m_eventDeviceOrientationList.size()); + LoggerD("Event device orientation list size=" << m_eventDeviceOrientationList.size()); } else if (watchType == WATCH_TYPE_NETWORK) { m_eventNetworkList.push_back(arg); - LogDebug("Event network list size=" << m_eventNetworkList.size()); + LoggerD("Event network list size=" << m_eventNetworkList.size()); } else if (watchType == WATCH_TYPE_LOCALE) { m_eventLocaleList.push_back(arg); - LogDebug("Event Locale list size=" << m_eventLocaleList.size()); + LoggerD("Event Locale list size=" << m_eventLocaleList.size()); } else if (watchType == WATCH_TYPE_PERIPHERAL) { m_eventPeripheralList.push_back(arg); - LogDebug("Event peripheral list size=" << m_eventPeripheralList.size()); + LoggerD("Event peripheral list size=" << m_eventPeripheralList.size()); } } void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) { DPL::Mutex::ScopedLock lock(&m_synchro); - LogDebug("Event id : " << id); + LoggerD("Event id : " << id); EventWatchSysteminfoPtr event(NULL); - LogDebug("trying to delete event, id=" << id); + LoggerD("trying to delete event, id=" << id); if (watchType == WATCH_TYPE_BATTERY) { for (EventBatteryList::iterator it = m_eventBatteryList.begin(); it != m_eventBatteryList.end(); it++) { @@ -679,13 +691,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event Battery list size=" << m_eventBatteryList.size()); + LoggerD("event Battery list size=" << m_eventBatteryList.size()); m_eventBatteryList.remove(event); - LogDebug( "event removed, event Battery list size=" << m_eventBatteryList.size()); + LoggerD( "event removed, event Battery list size=" << m_eventBatteryList.size()); } else if (watchType == WATCH_TYPE_DISPLAY) { for (EventDisplayList::iterator it = m_eventDisplayList.begin(); it != m_eventDisplayList.end(); it++) { if (id == (*it)->getId()) { @@ -694,13 +706,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event display list size=" << m_eventDisplayList.size()); + LoggerD("event display list size=" << m_eventDisplayList.size()); m_eventDisplayList.remove(event); - LogDebug( "event removed, event display list size=" << m_eventDisplayList.size()); + LoggerD( "event removed, event display list size=" << m_eventDisplayList.size()); } else if (watchType == WATCH_TYPE_WIFINETWORK) { for (EventWifiNetworkList::iterator it = m_eventWifiNetworkList.begin(); it != m_eventWifiNetworkList.end(); it++) { if (id == (*it)->getId()) { @@ -709,13 +721,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event wifi network list size=" << m_eventWifiNetworkList.size()); + LoggerD("event wifi network list size=" << m_eventWifiNetworkList.size()); m_eventWifiNetworkList.remove(event); - LogDebug( "event removed, event wifi network list size=" << m_eventCelluarNetworkList.size()); + LoggerD( "event removed, event wifi network list size=" << m_eventCelluarNetworkList.size()); } else if (watchType == WATCH_TYPE_CELLULARNETWORK) { for (EventCellularNetworkList::iterator it = m_eventCelluarNetworkList.begin(); it != m_eventCelluarNetworkList.end(); it++) { if (id == (*it)->getId()) { @@ -724,13 +736,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event cellular network list size=" << m_eventCelluarNetworkList.size()); + LoggerD("event cellular network list size=" << m_eventCelluarNetworkList.size()); m_eventCelluarNetworkList.remove(event); - LogDebug( "event removed, event cellular network list size=" << m_eventCelluarNetworkList.size()); + LoggerD( "event removed, event cellular network list size=" << m_eventCelluarNetworkList.size()); } else if (watchType == WATCH_TYPE_STORAGE) { for (EventStorageList::iterator it = m_eventStorageList.begin(); it != m_eventStorageList.end(); it++) { if (id == (*it)->getId()) { @@ -739,13 +751,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event storage list size=" << m_eventStorageList.size()); + LoggerD("event storage list size=" << m_eventStorageList.size()); m_eventStorageList.remove(event); - LogDebug( "event removed, event storage list size=" << m_eventStorageList.size()); + LoggerD( "event removed, event storage list size=" << m_eventStorageList.size()); } else if (watchType == WATCH_TYPE_CPU) { for (EventCpuList::iterator it = m_eventCpuList.begin(); it != m_eventCpuList.end(); it++) { if (id == (*it)->getId()) { @@ -754,13 +766,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event cpu list size=" << m_eventCpuList.size()); + LoggerD("event cpu list size=" << m_eventCpuList.size()); m_eventCpuList.remove(event); - LogDebug( "event removed, event cpu list size=" << m_eventCpuList.size()); + LoggerD( "event removed, event cpu list size=" << m_eventCpuList.size()); } else if (watchType == WATCH_TYPE_SIM) { for (EventSimList::iterator it = m_eventSimList.begin(); it != m_eventSimList.end(); it++) { if (id == (*it)->getId()) { @@ -769,13 +781,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event sim list size=" << m_eventSimList.size()); + LoggerD("event sim list size=" << m_eventSimList.size()); m_eventSimList.remove(event); - LogDebug( "event removed, event sim list size=" << m_eventSimList.size()); + LoggerD( "event removed, event sim list size=" << m_eventSimList.size()); } else if (watchType == WATCH_TYPE_DEVICE_ORIENTATION) { for (EventDeviceOrientationList::iterator it = m_eventDeviceOrientationList.begin(); it != m_eventDeviceOrientationList.end(); it++) { if (id == (*it)->getId()) { @@ -784,13 +796,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event device orientation list size=" << m_eventDeviceOrientationList.size()); + LoggerD("event device orientation list size=" << m_eventDeviceOrientationList.size()); m_eventDeviceOrientationList.remove(event); - LogDebug( "event removed, event device orientation list size=" << m_eventDeviceOrientationList.size()); + LoggerD( "event removed, event device orientation list size=" << m_eventDeviceOrientationList.size()); } else if (watchType == WATCH_TYPE_NETWORK) { for (EventNetworkList::iterator it = m_eventNetworkList.begin(); it != m_eventNetworkList.end(); it++) { if (id == (*it)->getId()) { @@ -799,13 +811,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event network list size=" << m_eventNetworkList.size()); + LoggerD("event network list size=" << m_eventNetworkList.size()); m_eventNetworkList.remove(event); - LogDebug( "event removed, event network list size=" << m_eventNetworkList.size()); + LoggerD( "event removed, event network list size=" << m_eventNetworkList.size()); } else if (watchType == WATCH_TYPE_LOCALE) { for (EventLocaleList::iterator it = m_eventLocaleList.begin(); it != m_eventLocaleList.end(); it++) { if (id == (*it)->getId()) { @@ -814,13 +826,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event Locale list size=" << m_eventLocaleList.size()); + LoggerD("event Locale list size=" << m_eventLocaleList.size()); m_eventLocaleList.remove(event); - LogDebug( "event removed, event Locale list size=" << m_eventLocaleList.size()); + LoggerD( "event removed, event Locale list size=" << m_eventLocaleList.size()); } else if (watchType == WATCH_TYPE_PERIPHERAL) { for (EventPeripheralList::iterator it = m_eventPeripheralList.begin(); it != m_eventPeripheralList.end(); it++) { if (id == (*it)->getId()) { @@ -829,13 +841,13 @@ void Systeminfo::EventMgr::removeEvent(WatchId id, const int watchType) } } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return; } - LogDebug("event peripheral list size=" << m_eventPeripheralList.size()); + LoggerD("event peripheral list size=" << m_eventPeripheralList.size()); m_eventPeripheralList.remove(event); - LogDebug( "event removed, event peripheral list size=" << m_eventPeripheralList.size()); + LoggerD( "event removed, event peripheral list size=" << m_eventPeripheralList.size()); } } @@ -930,7 +942,7 @@ const int Systeminfo::EventMgr::getWatchType(const long id) } if (!event) { - LogError("event id not in the list, nothing to do"); + LoggerE("event id not in the list, nothing to do"); return WATCH_TYPE_UNKNOWN; } @@ -1019,7 +1031,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Cpu) { CpuPropertiesPtr cpuPtr(new CpuProperties()); FILE *fp = NULL; - unsigned long long usr = 0, nice = 0, system = 0, idle = 0, total = 0, cpuUsage = 0; + long long usr = 0, nice = 0, system = 0, idle = 0, total = 0, cpuUsage = 0; fp = fopen("/proc/stat", "r"); if(fp == NULL) { @@ -1028,10 +1040,10 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Cpu) { if (fscanf(fp, "%*s %lld %lld %lld %lld", &usr, &system, &nice, &idle) > 0) { total = usr + nice + system + idle; - if ((total > 0ULL) && (idle > 0ULL)) { - cpuUsage = idle * 100ULL / total; + if ((total > 0LL) && (idle > 0LL)) { + cpuUsage = idle * 100LL / total; cpuPtr->load = (double)cpuUsage / 100.0; - LogDebug("cpu load : " << cpuPtr->load); + LoggerD("cpu load : " << cpuPtr->load); } } @@ -1103,39 +1115,39 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Display) { if(vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &brightness) == 0) { display->brightness = (double)(brightness)/DISPLAY_BRIGHTNESS_DIVIDE_VALUE; - LogDebug("brightness : " << display->brightness); + LoggerD("brightness : " << display->brightness); } if (system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &resolutionW) == SYSTEM_INFO_ERROR_NONE) { display->resolutionWidth = resolutionW; - LogDebug("resolutionWidth : " << display->resolutionWidth); + LoggerD("resolutionWidth : " << display->resolutionWidth); } if (system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &resolutionH) == SYSTEM_INFO_ERROR_NONE) { display->resolutionHeight = resolutionH; - LogDebug("resolutionHeight : " << display->resolutionHeight); + LoggerD("resolutionHeight : " << display->resolutionHeight); } if (system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &dotsPerInchX) == SYSTEM_INFO_ERROR_NONE) { display->dotsPerInchWidth = dotsPerInchX; - LogDebug("dotsPerInchWidth : " << display->dotsPerInchWidth); + LoggerD("dotsPerInchWidth : " << display->dotsPerInchWidth); } if (system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &dotsPerInchY) == SYSTEM_INFO_ERROR_NONE) { display->dotsPerInchHeight = dotsPerInchY; - LogDebug("dotsPerInchHeight : " << display->dotsPerInchHeight); + LoggerD("dotsPerInchHeight : " << display->dotsPerInchHeight); } if (system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, &physicalH) == SYSTEM_INFO_ERROR_NONE) { display->physicalHeight = physicalH; - LogDebug("physicalHeight : " << display->physicalHeight); + LoggerD("physicalHeight : " << display->physicalHeight); } if (system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, &physicalW) == SYSTEM_INFO_ERROR_NONE) { display->physicalWidth = physicalW; - LogDebug("physicalWidth : " << display->physicalWidth); + LoggerD("physicalWidth : " << display->physicalWidth); } return JSDisplayInfo::createJSObject(context, display); } PROPERTY_GET_SYSTEMINFO_DEFINITION(Network) { - LogDebug("enter"); + LoggerD("enter"); Converter converter(context); NetworkPropertiesPtr Network(new NetworkProperties()); connection_h connectionHandle = (connection_h)handle; @@ -1143,12 +1155,12 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Network) { int networkType = 0; if (connection_get_type(connectionHandle, &connectionType) != CONNECTION_ERROR_NONE) { - LogDebug("get connection type is failed"); + LoggerD("get connection type is failed"); return JSNetworkInfo::createJSObject(context, Network); } if (connectionType == CONNECTION_TYPE_WIFI) { - LogDebug("wifi network"); + LoggerD("wifi network"); Network->networkType= "WIFI"; } else if (connectionType == CONNECTION_TYPE_CELLULAR) { if (vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &networkType) == 0) { @@ -1305,7 +1317,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(CellularNetwork) { TIME_TRACER_ITEM_BEGIN("(cellular)imei", 0); if (system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &imei) == SYSTEM_INFO_ERROR_NONE) { if (imei) { - LogDebug("imei : " << imei); + LoggerD("imei : " << imei); cellularNetwork->imei = imei; free(imei); } @@ -1322,7 +1334,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(SIM) { } PROPERTY_GET_SYSTEMINFO_DEFINITION(DeviceOrientation) { - LogDebug("enter"); + LoggerD("enter"); Converter converter(context); DeviceOrientationPropertiesPtr deviceOrientation(new DeviceOrientationProperties()); @@ -1330,57 +1342,57 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(DeviceOrientation) { int handleOrientaion = 0; handleOrientaion = sf_connect(ACCELEROMETER_SENSOR); - LogDebug("handleOrientaion : " << handleOrientaion); + LoggerD("handleOrientaion : " << handleOrientaion); if (handleOrientaion < 0) { - LogDebug ("sensor attach fail"); + LoggerD ("sensor attach fail"); return JSDeviceOrientationInfo::createJSObject(context, deviceOrientation); } int state = sf_start(handleOrientaion, 0); if(state < 0) { - LogDebug("start failed"); + LoggerD("start failed"); } int ret_val = sf_check_rotation(&rotation); if (ret_val < 0) { - LogDebug("sf_check_rotation fail to gather data\n"); + LoggerD("sf_check_rotation fail to gather data\n"); } - LogDebug(" rotation value = " << rotation); + LoggerD(" rotation value = " << rotation); switch (rotation) { case 0: case ROTATION_EVENT_0: - LogDebug("my_callback_func received data (PORTRAIT_TOP|HEAD_CENTER)\n"); + LoggerD("my_callback_func received data (PORTRAIT_TOP|HEAD_CENTER)\n"); deviceOrientation->status = "PORTRAIT_PRIMARY"; break; case ROTATION_EVENT_90: - LogDebug("my_callback_func received data (LANDSCAPE|HEAD_RIGHT)\n"); + LoggerD("my_callback_func received data (LANDSCAPE|HEAD_RIGHT)\n"); deviceOrientation->status = "LANDSCAPE_PRIMARY"; break; case ROTATION_EVENT_180: - LogDebug("my_callback_func received data (PORTRAIT_BTM|HEAD_CENTER)\n"); + LoggerD("my_callback_func received data (PORTRAIT_BTM|HEAD_CENTER)\n"); deviceOrientation->status = "PORTRAIT_SECONDARY"; break; case ROTATION_EVENT_270: - LogDebug("my_callback_func received data (LANDSCAPE|HEAD_LEFT)\n"); + LoggerD("my_callback_func received data (LANDSCAPE|HEAD_LEFT)\n"); deviceOrientation->status = "LANDSCAPE_SECONDARY"; break; default: - LogDebug(" received data unexpected\n"); + LoggerD(" received data unexpected\n"); break; } state = sf_stop(handleOrientaion); - LogDebug("handleOrientaion 1 state = " << state); + LoggerD("handleOrientaion 1 state = " << state); state = sf_disconnect(handleOrientaion); - LogDebug("handleOrientaion state =" << state); + LoggerD("handleOrientaion state =" << state); return JSDeviceOrientationInfo::createJSObject(context, deviceOrientation); } PROPERTY_GET_SYSTEMINFO_DEFINITION(Build) { - LogDebug("enter"); + LoggerD("enter"); Converter converter(context); BuildPropertiesPtr Build(new BuildProperties()); @@ -1389,7 +1401,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Build) { if (system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &model) == SYSTEM_INFO_ERROR_NONE) { if (model != NULL) { - LogDebug("model : " << model); + LoggerD("model : " << model); Build->model = model; free(model); } @@ -1397,7 +1409,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Build) { if (system_info_get_value_string(SYSTEM_INFO_KEY_MANUFACTURER, &manufacturer) == SYSTEM_INFO_ERROR_NONE) { if (manufacturer != NULL) { - LogDebug("manufacturer : " << manufacturer); + LoggerD("manufacturer : " << manufacturer); Build->manufacturer = manufacturer; free(manufacturer); } @@ -1407,7 +1419,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Build) { } PROPERTY_GET_SYSTEMINFO_DEFINITION(Locale) { - LogDebug("enter"); + LoggerD("enter"); Converter converter(context); LocalePropertiesPtr Locale(new LocaleProperties()); @@ -1416,14 +1428,14 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Locale) { if (runtime_info_get_value_string(RUNTIME_INFO_KEY_LANGUAGE, &language) == RUNTIME_INFO_ERROR_NONE) { if (language != NULL) { - LogDebug("language : " << language); + LoggerD("language : " << language); Locale->language = language; free(language); } } if (runtime_info_get_value_string(RUNTIME_INFO_KEY_REGION, &country) == RUNTIME_INFO_ERROR_NONE) { - LogDebug("country : " << country); + LoggerD("country : " << country); char* token = NULL; char* countryTemp = NULL; token = strtok(country, "."); @@ -1455,7 +1467,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Peripheral) { peripheral->isVideoOutputOn = true; break; default: - LogDebug("VideOutput status is off"); + LoggerD("VideOutput status is off"); break; } } @@ -1466,7 +1478,7 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Peripheral) { peripheral->isVideoOutputOn = true; break; default: - LogDebug("VideOutput status is off"); + LoggerD("VideOutput status is off"); break; } } diff --git a/src/Systeminfo/SysteminfoListener.cpp b/src/Systeminfo/SysteminfoListener.cpp old mode 100755 new mode 100644 index 1399c5c..287d13f --- a/src/Systeminfo/SysteminfoListener.cpp +++ b/src/Systeminfo/SysteminfoListener.cpp @@ -15,12 +15,12 @@ // limitations under the License. // -#include #include #include "SysteminfoListener.h" #include #include "SysteminfoAsyncCallbackManager.h" #include +#include using namespace std; @@ -45,9 +45,9 @@ SysteminfoListener::~SysteminfoListener() void SysteminfoListener::OnAnswerReceived(const EventGetSysteminfoPtr& event) { - LogDebug("Enter"); + LoggerD("Enter"); WrtDeviceApis::CommonsJavaScript::JSCallbackManagerPtr callbackManager = DPL::StaticPointerCast(event->getPrivateData()); - LogDebug("thread=" << DPL::Thread::GetCurrentThread()); + LoggerD("thread=" << DPL::Thread::GetCurrentThread()); SysteminfoAsyncCallbackManagerSingleton::Instance().unregisterCallbackManager(callbackManager); diff --git a/src/Systeminfo/SysteminfoListenerManager.h b/src/Systeminfo/SysteminfoListenerManager.h old mode 100755 new mode 100644 index d18e440..1051f70 --- a/src/Systeminfo/SysteminfoListenerManager.h +++ b/src/Systeminfo/SysteminfoListenerManager.h @@ -20,11 +20,11 @@ #include #include -#include #include #include #include #include "JSSysteminfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -59,7 +59,7 @@ public: JSSysteminfoPriv *priv = static_cast(JSObjectGetPrivate(m_object)); if (!priv) { - LogWarning("Object has no private object"); + LoggerW("Object has no private object"); return; } @@ -67,7 +67,7 @@ public: ISysteminfoPtr Systeminfos(priv->getObject()); Systeminfos->clearWatch(m_watchId); } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error on platform : " << _rethrown_exception.GetMessage()); + LoggerE("Error on platform : " << _rethrown_exception.GetMessage()); } } }; diff --git a/src/Systeminfo/SysteminfoPropertyInfo.h b/src/Systeminfo/SysteminfoPropertyInfo.h index 1f6a011..a29577c 100755 --- a/src/Systeminfo/SysteminfoPropertyInfo.h +++ b/src/Systeminfo/SysteminfoPropertyInfo.h @@ -41,7 +41,7 @@ struct DeviceCapabilitiesProperties bool nfc; bool nfcReservedPush; unsigned short multiTouchCount; - std::string inputKeyboard; + bool inputKeyboard; bool inputKeyboardLayout; bool wifi; bool wifiDirect; @@ -110,7 +110,7 @@ struct DeviceCapabilitiesProperties nfc(false), nfcReservedPush(false), multiTouchCount(0), - inputKeyboard(""), + inputKeyboard(false), inputKeyboardLayout(false), wifi(false), wifiDirect(false), @@ -299,6 +299,7 @@ struct CellularNetworkProperties struct SIMProperties { + std::string state; std::string operatorName; std::string msisdn; std::string iccid; @@ -308,6 +309,7 @@ struct SIMProperties std::string spn; SIMProperties() : + state(""), operatorName(""), msisdn(""), iccid(""), diff --git a/src/Systeminfo/plugin_initializer.cpp b/src/Systeminfo/plugin_initializer.cpp old mode 100755 new mode 100644 index 228ccca..3c3465e --- a/src/Systeminfo/plugin_initializer.cpp +++ b/src/Systeminfo/plugin_initializer.cpp @@ -15,14 +15,13 @@ // limitations under the License. // -#include #include #include #include - #include "SysteminfoAsyncCallbackManager.h" #include "SysteminfoListenerManager.h" #include "JSSysteminfo.h" +#include namespace DeviceAPI { namespace Systeminfo { @@ -34,7 +33,7 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\Systeminfo ] on_widget_start_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Systeminfo ] on_widget_start_callback (" << widgetId << ")"); TIME_TRACER_INIT(); Try { @@ -42,13 +41,13 @@ void on_widget_start_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess initialization failed"); + LoggerE("WrtAccess initialization failed"); } } void on_widget_stop_callback(int widgetId) { - LogDebug("[Tizen\\Systeminfo ] on_widget_stop_callback (" << widgetId << ")"); + LoggerD("[Tizen\\Systeminfo ] on_widget_stop_callback (" << widgetId << ")"); TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"SystemInfo"); TIME_TRACER_RELEASE(); Try @@ -57,18 +56,18 @@ void on_widget_stop_callback(int widgetId) } Catch(Commons::Exception) { - LogError("WrtAccess deinitialization failed"); + LoggerE("WrtAccess deinitialization failed"); } } void on_frame_load_callback(const void * context) { - LogDebug("[Tizen\\systeminfo] on_frame_load_callback (" << context << ")"); + LoggerD("[Tizen\\systeminfo] on_frame_load_callback (" << context << ")"); } void on_frame_unload_callback(const void * context) { - LogDebug("[Tizen\\systeminfo] on_frame_unload_callback (" << context << ")"); + LoggerD("[Tizen\\systeminfo] on_frame_unload_callback (" << context << ")"); DeviceAPI::Systeminfo::SysteminfoAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast(context)); DeviceAPI::Systeminfo::SysteminfoListenerManagerSingleton::Instance().unregisterContext(static_cast(context)); diff --git a/src/TimeUtil/JSTZDate.cpp b/src/TimeUtil/JSTZDate.cpp old mode 100755 new mode 100644 index ba02ef4..2f8cee1 --- a/src/TimeUtil/JSTZDate.cpp +++ b/src/TimeUtil/JSTZDate.cpp @@ -15,12 +15,8 @@ // limitations under the License. // - - - #include #include -#include #include #include @@ -31,9 +27,9 @@ #include #include "DurationProperties.h" - #include "JSTZDate.h" #include "TimeUtilConverter.h" +#include using namespace DeviceAPI::Common; using namespace WrtDeviceApis::Commons; @@ -131,7 +127,7 @@ JSStaticFunction JSTZDate::m_function[] = { JSClassRef JSTZDate::m_jsClassRef = JSClassCreate(JSTZDate::getClassInfo()); JSObjectRef JSTZDate::createJSObject(JSContextRef context) { - LogDebug("entered"); + LoggerD("entered"); TZDatePtr tzDate(new TZDate()); TZDatePrivObject *priv = new TZDatePrivObject(context, tzDate); if (!priv) { @@ -142,7 +138,7 @@ JSObjectRef JSTZDate::createJSObject(JSContextRef context) { } JSObjectRef JSTZDate::createJSObject(JSContextRef context, const std::string &timezone) { - LogDebug("entered"); + LoggerD("entered"); if (timezone == "") return createJSObject(context); @@ -156,7 +152,7 @@ JSObjectRef JSTZDate::createJSObject(JSContextRef context, const std::string &ti } JSObjectRef JSTZDate::createJSObject(JSContextRef context, const double milliseconds, const std::string &timezone) { - LogDebug("entered"); + LoggerD("entered"); TZDatePtr tzDate; if (timezone == "") tzDate = TZDatePtr(new TZDate()); @@ -175,7 +171,7 @@ JSObjectRef JSTZDate::createJSObject(JSContextRef context, const double millisec } JSObjectRef JSTZDate::createJSObject(JSContextRef context, const TZDateProperties &properties) { - LogDebug("entered"); + LoggerD("entered"); TZDatePtr tzDate(new TZDate(properties)); TZDatePrivObject *priv = new TZDatePrivObject(context, tzDate); @@ -187,7 +183,7 @@ JSObjectRef JSTZDate::createJSObject(JSContextRef context, const TZDatePropertie } JSObjectRef JSTZDate::createJSObject(JSContextRef context, const long year, const long month, const long day, const long hours, const long minutes, const long seconds, const long milliseconds, const std::string &timezone) { - LogDebug("entered"); + LoggerD("entered"); TZDateProperties props; props.year = year; @@ -205,12 +201,12 @@ JSObjectRef JSTZDate::createJSObject(JSContextRef context, const long year, cons void JSTZDate::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered Nothing to do."); + LoggerD("entered Nothing to do."); } void JSTZDate::finalize(JSObjectRef object) { - LogDebug( "entered" ); + LoggerD( "entered" ); TZDatePrivObject *priv = static_cast( JSObjectGetPrivate( object ) ) ; delete priv; @@ -218,7 +214,7 @@ void JSTZDate::finalize(JSObjectRef object) JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TZDateProperties prop; TimeUtilConverter converter(ctx); @@ -237,9 +233,9 @@ JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, siz tzDate = createJSObject(ctx, timezone); } else { struct tm date = converter.toDateTm(arguments[0]); - LogDebug("date = " << date.tm_year << "." << date.tm_mon << "." << date.tm_mday); - LogDebug(date.tm_hour << ":" << date.tm_min << ":" << date.tm_sec); - LogDebug("isdst?" << date.tm_isdst); + LoggerD("date = " << date.tm_year << "." << date.tm_mon << "." << date.tm_mday); + LoggerD(date.tm_hour << ":" << date.tm_min << ":" << date.tm_sec); + LoggerD("isdst?" << date.tm_isdst); prop.timezone = timezone; prop.year = date.tm_year + 1900; @@ -256,7 +252,7 @@ JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, siz JSObjectRef function = JSValueToObject(ctx, getMiliSecFuction, exception); JSValueRef result = JSObjectCallAsFunction(ctx, function, converter.toJSObjectRef(arguments[0]), 0, NULL, exception); prop.milliseconds = converter.toLong(result); - LogDebug("getMilliseconds = " << prop.milliseconds); + LoggerD("getMilliseconds = " << prop.milliseconds); } tzDate = createJSObject(ctx, prop); } @@ -297,19 +293,19 @@ JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, siz return tzDate; } } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -330,12 +326,12 @@ const JSClassDefinition* JSTZDate::getClassInfo() JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -345,15 +341,15 @@ JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function, return converter.toJSValueRef(timezone); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -361,7 +357,7 @@ JSValueRef JSTZDate::getTimezone(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); try { ArgumentValidator validator(context, argumentCount, arguments); @@ -369,7 +365,7 @@ JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function, TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -378,25 +374,25 @@ JSValueRef JSTZDate::toTimezone(JSContextRef context, JSObjectRef function, } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::diffTZDate(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception, CompareType type) { - LogDebug("entered"); + LoggerD("entered"); ArgumentValidator validator(context, argumentCount, arguments); if (!validator.toObject(0, JSTZDate::getClassRef(), false)) @@ -404,7 +400,7 @@ JSValueRef JSTZDate::diffTZDate(JSContextRef context, JSObjectRef thisObject, si TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } TimeUtilConverter converter(context); @@ -441,25 +437,25 @@ JSValueRef JSTZDate::diffTZDate(JSContextRef context, JSObjectRef thisObject, si JSValueRef JSTZDate::difference(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { return diffTZDate(context, thisObject, argumentCount, arguments, exception, DIFFERENCE); } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -467,50 +463,50 @@ JSValueRef JSTZDate::difference(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::equalsTo(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { return diffTZDate(context, thisObject, argumentCount, arguments, exception, EQUALSTO); } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::earlierThan(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("earlierThan entered"); + LoggerD("earlierThan entered"); Try { return diffTZDate(context, thisObject, argumentCount, arguments, exception, EARLIERTHAN); } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -519,25 +515,25 @@ JSValueRef JSTZDate::earlierThan(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::laterThan(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("laterThan entered"); + LoggerD("laterThan entered"); Try { return diffTZDate(context, thisObject, argumentCount, arguments, exception, LATERTHAN); } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -546,7 +542,7 @@ JSValueRef JSTZDate::laterThan(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("addDuration entered"); + LoggerD("addDuration entered"); Try { TimeUtilConverter converter(context); @@ -556,10 +552,10 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function, else duration= converter.getDurationPropertis(arguments[0]); - LogDebug("unit : " << duration.unit << " Length:" << duration.length); + LoggerD("unit : " << duration.unit << " Length:" << duration.length); TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -568,20 +564,20 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function, return (static_cast(createJSObject(context, result))); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (OutOfRangeException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "The result is beyond the scope that TZDate can handle."); } @@ -591,26 +587,26 @@ JSValueRef JSTZDate::addDuration(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toUTC(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("toUTC entered"); + LoggerD("toUTC entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } TZDatePtr tzDate(privateObject->getObject()); return createJSObject(context, tzDate->getTime(), tzDate->getUTCTimezoneName()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -619,37 +615,37 @@ JSValueRef JSTZDate::toUTC(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toLocalTimezone(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("toLocalTimezone entered"); + LoggerD("toLocalTimezone entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } TZDatePtr tzDate(privateObject->getObject()); return createJSObject(context, tzDate->getTime(), tzDate->getLocalTimezoneName()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -659,15 +655,15 @@ JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef functi std::string result = tzDate->toDateString(true); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -675,11 +671,11 @@ JSValueRef JSTZDate::toLocaleDateString(JSContextRef context, JSObjectRef functi JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -689,15 +685,15 @@ JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef functi std::string result = tzDate->toTimeString(true); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -705,11 +701,11 @@ JSValueRef JSTZDate::toLocaleTimeString(JSContextRef context, JSObjectRef functi JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -719,15 +715,15 @@ JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function, std::string result = tzDate->toString(true); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -735,11 +731,11 @@ JSValueRef JSTZDate::toLocaleString(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -749,15 +745,15 @@ JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function, std::string result = tzDate->toDateString(); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -765,11 +761,11 @@ JSValueRef JSTZDate::toDateString(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -779,15 +775,15 @@ JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function, std::string result = tzDate->toTimeString(); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -796,11 +792,11 @@ JSValueRef JSTZDate::toTimeString(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -810,15 +806,15 @@ JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function, std::string result = tzDate->toString(); return converter.toJSValueRef(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -826,7 +822,7 @@ JSValueRef JSTZDate::toString(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::getDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_DATE; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -834,7 +830,7 @@ JSValueRef JSTZDate::getDate(JSContextRef context, JSObjectRef function, JSObjec JSValueRef JSTZDate::getDay(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_DAY_OF_WEEK; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -842,7 +838,7 @@ JSValueRef JSTZDate::getDay(JSContextRef context, JSObjectRef function, JSObject JSValueRef JSTZDate::getFullYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_YEAR; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -850,7 +846,7 @@ JSValueRef JSTZDate::getFullYear(JSContextRef context, JSObjectRef function, JSO JSValueRef JSTZDate::getHours(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_HOUR_OF_DAY; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -858,7 +854,7 @@ JSValueRef JSTZDate::getHours(JSContextRef context, JSObjectRef function, JSObje JSValueRef JSTZDate::getMilliseconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MILLISECOND; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -866,7 +862,7 @@ JSValueRef JSTZDate::getMilliseconds(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::getMinutes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MINUTE; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -874,14 +870,14 @@ JSValueRef JSTZDate::getMinutes(JSContextRef context, JSObjectRef function, JSOb JSValueRef JSTZDate::getMonth(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MONTH; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); } //getMonth() JSValueRef JSTZDate::getSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_SECOND; return getTZDateValue(context, thisObject, argumentCount, arguments, exception, dateFields); @@ -893,7 +889,7 @@ JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject TZDatePrivObject* privateObject = static_cast (JSObjectGetPrivate(thisObject)); if (privateObject == NULL) { - LogError(">>> NULL Exception"); + LoggerE(">>> NULL Exception"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -901,18 +897,18 @@ JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject long retVal = tzDate->get(dateFields); TimeUtilConverter converter(context); - LogDebug(">>> retVal:" << retVal); + LoggerD(">>> retVal:" << retVal); return converter.toJSValueRef(static_cast (retVal)); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -920,7 +916,7 @@ JSValueRef JSTZDate::getTZDateValue(JSContextRef context, JSObjectRef thisObject JSValueRef JSTZDate::setDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_DATE; @@ -929,19 +925,19 @@ JSValueRef JSTZDate::setDate(JSContextRef context, JSObjectRef function, JSObjec } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -950,7 +946,7 @@ JSValueRef JSTZDate::setDate(JSContextRef context, JSObjectRef function, JSObjec JSValueRef JSTZDate::setFullYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_YEAR; @@ -959,19 +955,19 @@ JSValueRef JSTZDate::setFullYear(JSContextRef context, JSObjectRef function, JSO } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -980,7 +976,7 @@ JSValueRef JSTZDate::setFullYear(JSContextRef context, JSObjectRef function, JSO JSValueRef JSTZDate::setHours(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_HOUR_OF_DAY; @@ -989,19 +985,19 @@ JSValueRef JSTZDate::setHours(JSContextRef context, JSObjectRef function, JSObje } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); }Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -1010,7 +1006,7 @@ JSValueRef JSTZDate::setHours(JSContextRef context, JSObjectRef function, JSObje JSValueRef JSTZDate::setMilliseconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MILLISECOND; @@ -1019,19 +1015,19 @@ JSValueRef JSTZDate::setMilliseconds(JSContextRef context, JSObjectRef function, } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); }Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -1040,7 +1036,7 @@ JSValueRef JSTZDate::setMilliseconds(JSContextRef context, JSObjectRef function, JSValueRef JSTZDate::setMinutes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MINUTE; @@ -1049,19 +1045,19 @@ JSValueRef JSTZDate::setMinutes(JSContextRef context, JSObjectRef function, JSOb } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); }Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -1070,7 +1066,7 @@ JSValueRef JSTZDate::setMinutes(JSContextRef context, JSObjectRef function, JSOb JSValueRef JSTZDate::setMonth(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_MONTH; @@ -1079,19 +1075,19 @@ JSValueRef JSTZDate::setMonth(JSContextRef context, JSObjectRef function, JSObje } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); }Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -1100,7 +1096,7 @@ JSValueRef JSTZDate::setMonth(JSContextRef context, JSObjectRef function, JSObje JSValueRef JSTZDate::setSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("<<<"); + LoggerD("<<<"); TZDate::TZDateFields dateFields = TZDate::TZDATE_SECOND; @@ -1109,19 +1105,19 @@ JSValueRef JSTZDate::setSeconds(JSContextRef context, JSObjectRef function, JSOb } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); }Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -1140,7 +1136,7 @@ JSValueRef JSTZDate::setTZDateValue(JSContextRef context, JSObjectRef thisObject TZDatePrivObject* privateObject = static_cast (JSObjectGetPrivate(thisObject)); if (privateObject == NULL) { - LogError(">>> NULL Exception"); + LoggerE(">>> NULL Exception"); ThrowMsg(NullPointerException, "privateObject is NULL"); } @@ -1152,58 +1148,58 @@ JSValueRef JSTZDate::setTZDateValue(JSContextRef context, JSObjectRef thisObject JSValueRef JSTZDate::getUTCDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_DATE, exception); } JSValueRef JSTZDate::getUTCDay(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_DAY_OF_WEEK, exception); } JSValueRef JSTZDate::getUTCFullYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_YEAR, exception); } JSValueRef JSTZDate::getUTCHours(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_HOUR_OF_DAY, exception); } JSValueRef JSTZDate::getUTCMilliseconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_MILLISECOND, exception); } JSValueRef JSTZDate::getUTCMinutes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_MINUTE, exception); } JSValueRef JSTZDate::getUTCMonth(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_MONTH, exception); } JSValueRef JSTZDate::getUTCSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return getUTCTZDateValue(context, thisObject, argumentCount, TZDate::TZDATE_SECOND, exception); } JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, TZDate::TZDateFields DateFields, JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1214,15 +1210,15 @@ JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObj return converter.toJSValueRefLong(result); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -1230,56 +1226,56 @@ JSValueRef JSTZDate::getUTCTZDateValue(JSContextRef context, JSObjectRef thisObj JSValueRef JSTZDate::setUTCDate(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_DATE, exception); } JSValueRef JSTZDate::setUTCFullYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_YEAR, exception); } JSValueRef JSTZDate::setUTCHours(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_HOUR_OF_DAY, exception); } JSValueRef JSTZDate::setUTCMilliseconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_MILLISECOND, exception); } JSValueRef JSTZDate::setUTCMinutes(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_MINUTE, exception); } JSValueRef JSTZDate::setUTCMonth(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_MONTH, exception); } JSValueRef JSTZDate::setUTCSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); return setUTCTZDateValue(context, thisObject, argumentCount, arguments, TZDate::TZDATE_SECOND, exception); } JSValueRef JSTZDate::setUTCTZDateValue(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], TZDate::TZDateFields dateFields, JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { TimeUtilConverter converter(context); @@ -1294,7 +1290,7 @@ JSValueRef JSTZDate::setUTCTZDateValue(JSContextRef context, JSObjectRef thisObj TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1303,29 +1299,29 @@ JSValueRef JSTZDate::setUTCTZDateValue(JSContextRef context, JSObjectRef thisObj return JSValueMakeNull(context); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::getTimezoneAbbreviation(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1337,26 +1333,26 @@ JSValueRef JSTZDate::getTimezoneAbbreviation(JSContextRef context, JSObjectRef f return converter.toJSValueRef(tzDate->getTimezoneAbbreviation()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::secondsFromUTC(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1366,24 +1362,24 @@ JSValueRef JSTZDate::secondsFromUTC(JSContextRef context, JSObjectRef function, return converter.toJSValueRefLong(tzDate->secondsFromUTC()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::isDST(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1393,26 +1389,26 @@ JSValueRef JSTZDate::isDST(JSContextRef context, JSObjectRef function, JSObjectR return converter.toJSValueRef(tzDate->isDST()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::getPreviousDSTTransition(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1426,26 +1422,26 @@ JSValueRef JSTZDate::getPreviousDSTTransition(JSContextRef context, JSObjectRef return createJSObject(context, resultDate); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTZDate::getNextDSTTransition(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -1459,15 +1455,15 @@ JSValueRef JSTZDate::getNextDSTTransition(JSContextRef context, JSObjectRef func return createJSObject(context, resultDate); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch(WrtDeviceApis::Commons::UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } diff --git a/src/TimeUtil/JSTimeDuration.cpp b/src/TimeUtil/JSTimeDuration.cpp old mode 100755 new mode 100644 index ac3db79..f425e1d --- a/src/TimeUtil/JSTimeDuration.cpp +++ b/src/TimeUtil/JSTimeDuration.cpp @@ -15,19 +15,17 @@ // limitations under the License. // - #include #include -#include #include #include #include #include #include #include - #include "JSTimeDuration.h" #include "TimeUtilConverter.h" +#include namespace DeviceAPI { namespace Time { @@ -93,26 +91,26 @@ JSClassRef JSTimeDuration::m_jsClassRef = JSClassCreate(JSTimeDuration::getClass void JSTimeDuration::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered Nothing to do."); + LoggerD("entered Nothing to do."); } void JSTimeDuration::finalize(JSObjectRef object) { TimeDurationPrivObject* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting TimeDuration"); + LoggerD("Deleting TimeDuration"); delete priv; } JSValueRef JSTimeDuration::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { TimeUtilConverter convert(context); - LogDebug("propertyName : " << convert.toString(propertyName)); + LoggerD("propertyName : " << convert.toString(propertyName)); if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_LENGTH)) { return convert.toJSValueRef(static_cast(convert.getDurationLength(object))); } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_TIMEDURATION_UNIT)) { @@ -122,11 +120,11 @@ JSValueRef JSTimeDuration::getProperty(JSContextRef context, JSObjectRef object, return convert.toJSValueRef(strUnit); } } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSValueMakeUndefined(context); } @@ -134,12 +132,12 @@ JSValueRef JSTimeDuration::getProperty(JSContextRef context, JSObjectRef object, bool JSTimeDuration::setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - LogDebug("Enter"); + LoggerD("Enter"); Try { TimeDurationPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(NullPointerException, "Private object not initialized"); } @@ -158,16 +156,16 @@ bool JSTimeDuration::setProperty(JSContextRef context, JSObjectRef object, return true; } Catch (NullPointerException) { - LogError("NullPointerException: " << _rethrown_exception.GetMessage()); + LoggerE("NullPointerException: " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (ConversionException) { - LogError("ConversionException: " << _rethrown_exception.GetMessage()); + LoggerE("ConversionException: " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("InvalidArgumentException: " << _rethrown_exception.GetMessage()); + LoggerE("InvalidArgumentException: " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); *exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } return false; @@ -186,7 +184,7 @@ JSObjectRef JSTimeDuration::createJSObject(JSContextRef context, } JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); TimeUtilConverter convert(ctx); Try { DurationProperties duration; @@ -212,27 +210,27 @@ JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructo return timeDuration; } } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch(UnknownException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; return error; } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); *exception = error; return error; } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); *exception = error; return error; } Catch (WrtDeviceApis::Commons::Exception) { - LogWarning("Trying to get incorrect value"); + LoggerW("Trying to get incorrect value"); } JSObjectRef error = JSTizenExceptionFactory::makeErrorObject(ctx, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); *exception = error; @@ -241,11 +239,11 @@ JSObjectRef JSTimeDuration::constructor(JSContextRef ctx, JSObjectRef constructo } JSValueRef JSTimeDuration::diffTimeDuration(JSContextRef context, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception, CompareType type) { - LogDebug("entered"); + LoggerD("entered"); TimeDurationPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } @@ -299,88 +297,88 @@ JSValueRef JSTimeDuration::diffTimeDuration(JSContextRef context, JSObjectRef th JSValueRef JSTimeDuration::difference(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, DIFFERENCE); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTimeDuration::equalsTo(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, EQUALSTO); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTimeDuration::lessThan(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, LESSTHAN); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTimeDuration::greaterThan(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); Try { return diffTimeDuration(context, thisObject, argumentCount, arguments, exception, GREATERTHAN); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } diff --git a/src/TimeUtil/JSTimeUtil.cpp b/src/TimeUtil/JSTimeUtil.cpp old mode 100755 new mode 100644 index 0db40e5..9c8c581 --- a/src/TimeUtil/JSTimeUtil.cpp +++ b/src/TimeUtil/JSTimeUtil.cpp @@ -15,10 +15,8 @@ // limitations under the License. // - #include #include -#include #include #include @@ -31,6 +29,7 @@ #include "JSTimeUtil.h" #include "JSTZDate.h" #include "TimeUtilConverter.h" +#include namespace DeviceAPI { namespace Time { @@ -91,19 +90,19 @@ void JSTimeUtil::initialize(JSContextRef context, JSObjectRef object) TimeUtilPtr timeutil(new TimeUtil()); priv = new TimeUtilPrivObject( context, timeutil); if(!JSObjectSetPrivate(object, static_cast(priv))) { - LogError("Object can't store private data."); + LoggerE("Object can't store private data."); delete priv; } } - LogDebug("JSTimeUtil::initialize "); + LoggerD("JSTimeUtil::initialize "); } void JSTimeUtil::finalize(JSObjectRef object) { TimeUtilPrivObject* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); - LogDebug("Deleting timeutil"); + LoggerD("Deleting timeutil"); delete priv; } @@ -122,22 +121,22 @@ JSValueRef JSTimeUtil::getCurrentDateTime(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); Try { TimeUtilPrivObject* privateObject = static_cast(JSObjectGetPrivate(thisObject)); if (NULL == privateObject) { - LogError("private object is null"); + LoggerE("private object is null"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } return JSTZDate::createJSObject(context); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -150,7 +149,7 @@ JSValueRef JSTimeUtil::getLocalTimezone(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("Entered "); + LoggerD("Entered "); Try { TimeUtilPrivObject* privateObject = static_cast(JSObjectGetPrivate( @@ -166,12 +165,12 @@ JSValueRef JSTimeUtil::getLocalTimezone(JSContextRef context, return converter.toJSValueRef(localTimezone); } Catch(NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); @@ -184,7 +183,7 @@ JSValueRef JSTimeUtil::getAvailableTimezones(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TimeUtilPrivObject* privateObject = static_cast(JSObjectGetPrivate( @@ -206,18 +205,18 @@ JSValueRef JSTimeUtil::getAvailableTimezones(JSContextRef context, return converter.toJSValueRef(timezonesArray); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");; } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -229,7 +228,7 @@ JSValueRef JSTimeUtil::getDateFormat(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { TimeUtilConverter converter(context); @@ -250,21 +249,21 @@ JSValueRef JSTimeUtil::getDateFormat(JSContextRef context, } catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values");; } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } @@ -276,7 +275,7 @@ JSValueRef JSTimeUtil::getTimeFormat(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TimeUtilPrivObject* privateObject = static_cast(JSObjectGetPrivate( @@ -292,25 +291,25 @@ JSValueRef JSTimeUtil::getTimeFormat(JSContextRef context, return converter.toJSValueRef(timeFormat); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (NullPointerException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } JSValueRef JSTimeUtil::isLeapYear(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { - LogDebug("Entered"); + LoggerD("Entered"); try{ TimeUtilConverter converter(context); ArgumentValidator validator(context, argumentCount, arguments); @@ -327,18 +326,18 @@ JSValueRef JSTimeUtil::isLeapYear(JSContextRef context, JSObjectRef function, }catch(const BasePlatformException& err){ return JSWebAPIException::throwException(context, exception, err); } Catch(ConversionException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR, "Type Mismatch"); } Catch (InvalidArgumentException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid Values"); } Catch (UnsupportedException) { - LogError("JSTimeUtil::hasInstance NotSupportedException"); + LoggerE("JSTimeUtil::hasInstance NotSupportedException"); return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR , "Not Support"); } Catch (PlatformException) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } Catch (WrtDeviceApis::Commons::Exception) { - LogError("Exception: " << _rethrown_exception.GetMessage()); + LoggerE("Exception: " << _rethrown_exception.GetMessage()); } return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown Error"); } diff --git a/src/TimeUtil/TZDate.cpp b/src/TimeUtil/TZDate.cpp old mode 100755 new mode 100644 index 17b5108..93da136 --- a/src/TimeUtil/TZDate.cpp +++ b/src/TimeUtil/TZDate.cpp @@ -15,19 +15,13 @@ // limitations under the License. // - - - -#include - #include - #include #include #include - #include "TZDate.h" #include "TimeUtilTools.h" +#include using namespace WrtDeviceApis; @@ -36,7 +30,7 @@ namespace Time { TZDate::TZDate(const bool isNotNull) { - LogDebug("entered"); + LoggerD("entered"); if (isNotNull == FALSE) { myCalendar = NULL; @@ -57,7 +51,7 @@ TZDate::TZDate(const bool isNotNull) TZDate::TZDate(const std::string &timezone) { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; TimeUtilTools util; @@ -79,7 +73,7 @@ TZDate::TZDate(const std::string &timezone) TZDate::TZDate(const TZDateProperties &properties) { - LogDebug("entered"); + LoggerD("entered"); TimeUtilTools util; myCalendar = _makeCalendar(properties); @@ -95,7 +89,7 @@ TZDate::TZDate(const TZDateProperties &properties) TZDate::~TZDate() { - LogDebug("entered"); + LoggerD("entered"); if (myCalendar != NULL) delete myCalendar; @@ -113,7 +107,7 @@ bool TZDate::isNull() Calendar *TZDate::_makeCalendar(const TZDateProperties &properties) { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; TimeUtilTools util; @@ -140,7 +134,7 @@ std::string TZDate::_getTimezoneName(Calendar *cal) cal->getTimeZone().getID(id); std::string s_result = util.toString(id); - LogDebug(s_result); + LoggerD(s_result); return s_result; } @@ -247,10 +241,10 @@ TZDateProperties TZDate::toTimezone(const std::string timezone) { long TZDate::_get(const TZDateFields field, Calendar *cal) { - LogDebug("<<<"); + LoggerD("<<<"); if (_convertDateField(field) == UCAL_FIELD_COUNT){ - LogDebug(">>> UCAL_FIELD_COUNT"); + LoggerD(">>> UCAL_FIELD_COUNT"); return -1; } @@ -260,14 +254,14 @@ long TZDate::_get(const TZDateFields field, Calendar *cal) if (U_SUCCESS(ec)) { long result = util.tolong(value); - LogDebug(">>> result:" << result); + LoggerD(">>> result:" << result); return result; } ThrowMsg(Commons::PlatformException, "Can't get Calendar value"); } long TZDate::get(const TZDateFields field) { - LogDebug("<<<"); + LoggerD("<<<"); long result = _get(field, myCalendar); if (field == TZDATE_DAY_OF_WEEK) @@ -282,7 +276,7 @@ void TZDate::set(const TZDateFields field, const long value) TimeUtilTools util; myCalendar->set(_convertDateField(field), util.toint32_t(value)); - LogDebug("Field : " << field << " value : " << get(field)); + LoggerD("Field : " << field << " value : " << get(field)); } long TZDate::getUTC(const TZDateFields field) @@ -303,7 +297,7 @@ long TZDate::getUTC(const TZDateFields field) long result = util.tolong(value); if (field == TZDATE_DAY_OF_WEEK) result--; - LogDebug("result : " << result); + LoggerD("result : " << result); return result; } @@ -330,7 +324,7 @@ void TZDate::setUTC(const TZDateFields field, const long value) } long long TZDate::difference(const TZDateProperties &prop) { - LogDebug("entered"); + LoggerD("entered"); TimeUtilTools util; UErrorCode ec = U_ZERO_ERROR; @@ -347,14 +341,14 @@ long long TZDate::difference(const TZDateProperties &prop) { if (U_SUCCESS(ec)) { UDate otherTime = otherCalendar->getTime(ec); if (U_SUCCESS(ec)) { - LogDebug("myCalendar"); + LoggerD("myCalendar"); util.printDate(myCalendar); - LogDebug("otherCalendar"); + LoggerD("otherCalendar"); util.printDate(otherCalendar); delete otherCalendar; - LogDebug("myTime : " <(myTime - otherTime); } @@ -364,7 +358,7 @@ long long TZDate::difference(const TZDateProperties &prop) { } TZDateProperties TZDate::addDuration(const DurationProperties &duration) { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; TimeUtilTools util; @@ -396,7 +390,7 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) { unit = DAYS_UNIT; } day = length; - LogDebug("day:"<add(UCAL_MILLISECOND, util.toint32_t(msec), ec); @@ -424,7 +418,7 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) { Throw(Commons::PlatformException); while (day != 0) { - LogDebug("1st day : " << day); + LoggerD("1st day : " << day); int amount = 0; if (day < INT_MIN) @@ -435,8 +429,8 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) { amount = day; day -= amount; - LogDebug("amount : " << amount); - LogDebug("2nd day : " << day); + LoggerD("amount : " << amount); + LoggerD("2nd day : " << day); cal->add(UCAL_DATE, util.toint32_t(amount), ec); if (!U_SUCCESS(ec)) Throw(Commons::PlatformException); @@ -446,7 +440,7 @@ TZDateProperties TZDate::addDuration(const DurationProperties &duration) { Throw(Commons::PlatformException); int diff = static_cast((newValue - oldValue) / 24 / 60 / 60 / 1000); - LogDebug("diff : " << diff); + LoggerD("diff : " << diff); if (diff != amount) { Throw(Commons::OutOfRangeException); } @@ -475,7 +469,7 @@ std::string TZDate::getUTCTimezoneName() { TimeZone::getGMT()->getID(id); std::string s_result = util.toString(id); - LogDebug(s_result); + LoggerD(s_result); return s_result; } @@ -485,12 +479,12 @@ std::string TZDate::getLocalTimezoneName() { TimeZone::createDefault()->getID(id); std::string s_result = util.toString(id); - LogDebug(s_result); + LoggerD(s_result); return s_result; } double TZDate::getTime() { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; UDate date = myCalendar->getTime(ec); @@ -501,7 +495,7 @@ double TZDate::getTime() { } bool TZDate::setTime(const double time) { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; myCalendar->setTime(static_cast(time), ec); @@ -526,7 +520,7 @@ bool TZDate::setTime(const double time) { std::string result = util.toString(str); str.remove(); - LogDebug (result); + LoggerD (result); return result; } } @@ -548,7 +542,7 @@ bool TZDate::setTime(const double time) { if (U_SUCCESS(ec)) { std::string result = util.toString(str); str.remove(); - LogDebug (result); + LoggerD (result); return result; } } @@ -557,7 +551,7 @@ bool TZDate::setTime(const double time) { } std::string TZDate::toString(bool bLocale) { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; UnicodeString str; @@ -572,7 +566,7 @@ bool TZDate::setTime(const double time) { if (U_SUCCESS(ec)) { std::string result = util.toString(str); str.remove(); - LogDebug (result); + LoggerD (result); return result; } } @@ -580,7 +574,7 @@ bool TZDate::setTime(const double time) { } std::string TZDate::getTimezoneAbbreviation() { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; UnicodeString str; @@ -596,7 +590,7 @@ std::string TZDate::getTimezoneAbbreviation() { std::string result = util.toString(str); str.remove(); - LogDebug (result); + LoggerD (result); return result; } @@ -605,7 +599,7 @@ std::string TZDate::getTimezoneAbbreviation() { } long TZDate::secondsFromUTC() { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; TimeUtilTools util; @@ -619,12 +613,12 @@ long TZDate::secondsFromUTC() { long result = -((util.tolong(zoneOffset + dstOffset)) / MILLISTOSEC); - LogDebug("result : " << result); + LoggerD("result : " << result); return result; } bool TZDate::isDST() { - LogDebug("entered"); + LoggerD("entered"); UErrorCode ec = U_ZERO_ERROR; TimeUtilTools util; UBool result = myCalendar->inDaylightTime(ec); @@ -636,7 +630,7 @@ bool TZDate::isDST() { } TZDateProperties TZDate::getDSTTransition(DSTTransition trans) { - LogDebug("entered"); + LoggerD("entered"); TimeUtilTools util; UErrorCode ec = U_ZERO_ERROR; TZDateProperties props; @@ -656,7 +650,7 @@ TZDateProperties TZDate::getDSTTransition(DSTTransition trans) { else result = vtz->getPreviousTransition(dstTransitionDate, FALSE, tzTrans); if (result == TRUE) { - LogDebug("result is TRUE"); + LoggerD("result is TRUE"); dstTransitionDate = tzTrans.getTime(); } } diff --git a/src/TimeUtil/TimeUtil.cpp b/src/TimeUtil/TimeUtil.cpp old mode 100755 new mode 100644 index 2264afc..e3c936a --- a/src/TimeUtil/TimeUtil.cpp +++ b/src/TimeUtil/TimeUtil.cpp @@ -15,24 +15,18 @@ // limitations under the License. // - - - -#include #include #include - #include - #include #include #include #include #include - #include "TZDateProperties.h" #include "TimeUtil.h" #include "TimeUtilTools.h" +#include using namespace WrtDeviceApis; @@ -41,11 +35,11 @@ namespace Time { namespace { static void changedTimezoneCallback(keynode_t* node, void* user_data) { - LogDebug("entered KeyName:" << vconf_keynode_get_name(node)); + LoggerD("entered KeyName:" << vconf_keynode_get_name(node)); if (!strcmp(vconf_keynode_get_name(node), VCONFKEY_SETAPPL_TIMEZONE_ID) && (vconf_keynode_get_type(node) == VCONF_TYPE_STRING)) { char *timezoneID = vconf_keynode_get_str(node); if (timezoneID != NULL) { - LogDebug("Changed Timezone : " << timezoneID); + LoggerD("Changed Timezone : " << timezoneID); TimeUtilTools util; UnicodeString *id = util.toUnicodeString(timezoneID); TimeZone *tz = TimeZone::createTimeZone(*id); @@ -59,24 +53,24 @@ namespace { TimeUtil::TimeUtil() { - LogDebug("entered"); + LoggerD("entered"); bRegisteredChangedTimezone = false; if (vconf_notify_key_changed(VCONFKEY_SETAPPL_TIMEZONE_ID, changedTimezoneCallback, NULL) == 0) { - LogDebug("Success to register changedTimezoneCallback"); + LoggerD("Success to register changedTimezoneCallback"); bRegisteredChangedTimezone = true; } } TimeUtil::~TimeUtil() { - LogDebug("entered"); + LoggerD("entered"); if (bRegisteredChangedTimezone) { vconf_ignore_key_changed(VCONFKEY_SETAPPL_TIMEZONE_ID, changedTimezoneCallback); } } std::string TimeUtil::getLocalTimezone() { - LogDebug("entered"); + LoggerD("entered"); UnicodeString idResult; TimeZone* zone = TimeZone::createDefault(); @@ -88,11 +82,11 @@ std::string TimeUtil::getLocalTimezone() { try { TimeUtilTools util; std::string s_result = util.toString(id); - LogDebug("result : " << s_result); + LoggerD("result : " << s_result); return s_result; } catch (Commons::PlatformException) { - LogError("can't get the local timezone's name"); + LoggerE("can't get the local timezone's name"); } ThrowMsg(Commons::PlatformException, "Can't get Local Timezone"); @@ -100,7 +94,7 @@ std::string TimeUtil::getLocalTimezone() { std::string TimeUtil::getUTCTimezone() { - LogDebug("entered"); + LoggerD("entered"); UnicodeString id; const TimeZone *utcTimezone = TimeZone::getGMT(); @@ -110,11 +104,11 @@ std::string TimeUtil::getUTCTimezone() { TimeUtilTools util; std::string s_result = util.toString(id); - LogDebug("result : " << s_result); + LoggerD("result : " << s_result); return s_result; } catch(Commons::PlatformException) { - LogError("can't get the UTC timezone's name"); + LoggerE("can't get the UTC timezone's name"); } ThrowMsg(Commons::PlatformException, "Can't get UTC Timezone"); @@ -127,7 +121,7 @@ std::vector TimeUtil::getAvailableTimezones(){ int32_t count = tzen->count(ec); std::vector timezones; - LogDebug("count: " << count); + LoggerD("count: " << count); if (U_SUCCESS(ec)) { int i = 0; @@ -149,7 +143,7 @@ std::vector TimeUtil::getAvailableTimezones(){ } std::string TimeUtil::getDateFormat(const bool b_shortFormat) { - LogDebug("entered"); + LoggerD("entered"); TimeUtilTools util; UnicodeString timeFormat = util.getDateTimeFormat((b_shortFormat ? TimeUtilTools::DATE_SHORT_FORMAT : TimeUtilTools::DATE_FORMAT), true); timeFormat = timeFormat.findAndReplace("E", "D"); @@ -171,12 +165,12 @@ std::string TimeUtil::getDateFormat(const bool b_shortFormat) { else i++; } - LogDebug("result : " << util.toString(timeFormat)); + LoggerD("result : " << util.toString(timeFormat)); return util.toString(timeFormat); } std::string TimeUtil::getTimeFormat(){ - LogDebug("entered"); + LoggerD("entered"); TimeUtilTools util; UnicodeString timeFormat = util.getDateTimeFormat(TimeUtilTools::TIME_FORMAT, true); timeFormat = timeFormat.findAndReplace("H", "h"); @@ -192,7 +186,7 @@ std::string TimeUtil::getTimeFormat(){ else i++; } - LogDebug("result : " << util.toString(timeFormat)); + LoggerD("result : " << util.toString(timeFormat)); return util.toString(timeFormat); } diff --git a/src/TimeUtil/TimeUtilConverter.cpp b/src/TimeUtil/TimeUtilConverter.cpp old mode 100755 new mode 100644 index 9ec245b..417c6c7 --- a/src/TimeUtil/TimeUtilConverter.cpp +++ b/src/TimeUtil/TimeUtilConverter.cpp @@ -15,10 +15,6 @@ // limitations under the License. // - - - -#include #include #include #include @@ -29,6 +25,7 @@ #include "TimeUtilConverter.h" #include "JSTZDate.h" #include "JSTimeDuration.h" +#include using namespace WrtDeviceApis; @@ -59,14 +56,14 @@ TZDateProperties TimeUtilConverter::getPropertiesInTZDate(JSValueRef arg) { TZDateProperties TimeUtilConverter::getPropertiesInTZDate(JSObjectRef arg) { - LogDebug("TZDate object=" << arg); + LoggerD("TZDate object=" << arg); if (!arg) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(arg)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } @@ -120,7 +117,7 @@ long long TimeUtilConverter::getDurationLength(JSValueRef value) { long long TimeUtilConverter::getDurationLength(JSObjectRef object) { TimeDurationPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } @@ -141,7 +138,7 @@ short TimeUtilConverter::getDurationUnit(JSValueRef value) { short TimeUtilConverter::getDurationUnit(JSObjectRef object) { TimeDurationPrivObject* privateObject = static_cast(JSObjectGetPrivate(object)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } @@ -231,13 +228,13 @@ double TimeUtilConverter::getTimeInMilliseconds(JSValueRef arg) { double TimeUtilConverter::getTimeInMilliseconds(JSObjectRef arg) { if (!arg) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(arg)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } @@ -258,13 +255,13 @@ tm TimeUtilConverter::toTZDateTime(JSValueRef arg) { tm TimeUtilConverter::toTZDateTime(JSObjectRef arg) { if (!arg) { - LogError("Object is null"); + LoggerE("Object is null"); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } TZDatePrivObject* privateObject = static_cast(JSObjectGetPrivate(arg)); if (!privateObject) { - LogError("Private object is not set."); + LoggerE("Private object is not set."); ThrowMsg(Commons::ConversionException, "Private object not initialized"); } diff --git a/src/TimeUtil/TimeUtilTools.cpp b/src/TimeUtil/TimeUtilTools.cpp old mode 100755 new mode 100644 index 4820612..73a6d1b --- a/src/TimeUtil/TimeUtilTools.cpp +++ b/src/TimeUtil/TimeUtilTools.cpp @@ -15,20 +15,14 @@ // limitations under the License. // - - - #include #include #include - #include #include - #include - #include "TimeUtilTools.h" -#include +#include namespace DeviceAPI { namespace Time { @@ -76,13 +70,13 @@ std::string TimeUtilTools::toString(UnicodeString uniStr) std::string str(resultBuffer); free(resultBuffer); - LogDebug(str); + LoggerD(str); return str; } TimeZone *TimeUtilTools::makeTimeZone(const std::string &name) { - LogDebug("entered timezone name : " << name); + LoggerD("entered timezone name : " << name); UnicodeString *id = toUnicodeString(name); @@ -108,7 +102,7 @@ UnicodeString TimeUtilTools::getDateTimeFormat(DateTimeFormatType type, bool bLo DateTimePatternGenerator *dateTimepatten = DateTimePatternGenerator::createInstance((bLocale ? Locale::getDefault() : Locale::getEnglish()), ec); if (U_SUCCESS(ec)) { UnicodeString patten; - LogDebug("Type : " << type); + LoggerD("Type : " << type); if (type == DATE_FORMAT) patten = dateTimepatten->getBestPattern(UDAT_YEAR_MONTH_WEEKDAY_DAY, ec); else if (type == DATE_SHORT_FORMAT) @@ -137,7 +131,7 @@ UnicodeString TimeUtilTools::getDateTimeFormat(DateTimeFormatType type, bool bLo if (!bLocale) patten += " 'GMT'Z v'"; } - LogDebug("pattern : " << toString(patten)); + LoggerD("pattern : " << toString(patten)); return patten; } @@ -152,19 +146,19 @@ void TimeUtilTools::printDate(Calendar *cal) if (cal == NULL) return; - LogDebug("year : " << tolong(cal->get(UCAL_YEAR, ec))); - LogDebug("month : " << tolong(cal->get(UCAL_MONTH, ec))); - LogDebug("day : " << tolong(cal->get(UCAL_DATE, ec))); - LogDebug("hours : " << tolong(cal->get(UCAL_HOUR, ec))); - LogDebug("hours of day : " << tolong(cal->get(UCAL_HOUR_OF_DAY, ec))); - LogDebug("AM/PM : " << tolong(cal->get(UCAL_AM_PM, ec))); - LogDebug("dayofweek : " << tolong(cal->get(UCAL_DAY_OF_WEEK, ec))); - LogDebug("minues : " << tolong(cal->get(UCAL_MINUTE, ec))); - LogDebug("seconds : " << tolong(cal->get(UCAL_SECOND, ec))); - LogDebug("miliseconds : " << tolong(cal->get(UCAL_MILLISECOND, ec))); - LogDebug("zone offset : " << tolong(cal->get(UCAL_ZONE_OFFSET, ec))); - LogDebug("dst offset : " << tolong(cal->get(UCAL_DST_OFFSET, ec))); - LogDebug("is leap month? : " << tolong(cal->get(UCAL_IS_LEAP_MONTH, ec))); + LoggerD("year : " << tolong(cal->get(UCAL_YEAR, ec))); + LoggerD("month : " << tolong(cal->get(UCAL_MONTH, ec))); + LoggerD("day : " << tolong(cal->get(UCAL_DATE, ec))); + LoggerD("hours : " << tolong(cal->get(UCAL_HOUR, ec))); + LoggerD("hours of day : " << tolong(cal->get(UCAL_HOUR_OF_DAY, ec))); + LoggerD("AM/PM : " << tolong(cal->get(UCAL_AM_PM, ec))); + LoggerD("dayofweek : " << tolong(cal->get(UCAL_DAY_OF_WEEK, ec))); + LoggerD("minues : " << tolong(cal->get(UCAL_MINUTE, ec))); + LoggerD("seconds : " << tolong(cal->get(UCAL_SECOND, ec))); + LoggerD("miliseconds : " << tolong(cal->get(UCAL_MILLISECOND, ec))); + LoggerD("zone offset : " << tolong(cal->get(UCAL_ZONE_OFFSET, ec))); + LoggerD("dst offset : " << tolong(cal->get(UCAL_DST_OFFSET, ec))); + LoggerD("is leap month? : " << tolong(cal->get(UCAL_IS_LEAP_MONTH, ec))); } } diff --git a/src/TimeUtil/plugin_initializer.cpp b/src/TimeUtil/plugin_initializer.cpp old mode 100755 new mode 100644 index 7b8f3aa..6039056 --- a/src/TimeUtil/plugin_initializer.cpp +++ b/src/TimeUtil/plugin_initializer.cpp @@ -15,13 +15,12 @@ // limitations under the License. // - -#include #include #include #include "JSTimeUtil.h" #include "JSTZDate.h" #include "JSTimeDuration.h" +#include namespace DeviceAPI { namespace Time { @@ -41,26 +40,26 @@ class_definition_options_t ConstructorClassOptions = }; void on_widget_start_callback(int widgetId) { - LogDebug("[TIZEN\\TimeUtil] on_widget_start_callback ("< #include #include #include #include #include #include +#include namespace DeviceAPI { namespace Tizen { @@ -162,7 +161,7 @@ std::string PrivateAny::toJSON(JSContextRef context, JSValueRef value) const JSStringRef jsStrJson = JSValueCreateJSONString(context, value, 0, &jsError); if(jsError != NULL || jsStrJson == NULL) { - LogError("Fail to create JSON string"); + LoggerE("Fail to create JSON string"); return std::string(""); } @@ -240,7 +239,7 @@ AnyPtr AnyFactory::createAnyNoException(JSContextRef context, JSValueRef value, } catch(BasePlatformException &e) { - LogError("Error while converting (" << e.getName() << ") : " << e.getMessage()); + LoggerE("Error while converting (" << e.getName() << ") : " << e.getMessage()); } return AnyPtr(new PrivateAny()); diff --git a/src/Tizen/CMakeLists.txt b/src/Tizen/CMakeLists.txt index 64db127..a488127 100644 --- a/src/Tizen/CMakeLists.txt +++ b/src/Tizen/CMakeLists.txt @@ -34,8 +34,6 @@ SET(SRCS_IMPL JSSortMode.cpp FilterConverter.cpp JSSimpleCoordinates.cpp - JSFeature.cpp - JSFeatureParam.cpp PluginOnDemandPriv.cpp JSTizen.cpp ) diff --git a/src/Tizen/FilterConverter.cpp b/src/Tizen/FilterConverter.cpp index e7d24d9..7b168bb 100644 --- a/src/Tizen/FilterConverter.cpp +++ b/src/Tizen/FilterConverter.cpp @@ -22,7 +22,6 @@ * @description Reference from CalendarConverter.cpp */ -#include #include #include #include @@ -32,6 +31,7 @@ #include "JSSortMode.h" #include "FilterConverter.h" #include "AnyFactory.h" +#include #define TIZEN_FILTER_CONVERTER_ATTRIBUTE_TYPE "type" #define TIZEN_FILTER_CONVERTER_ATTRIBUTE_ORDER "order" @@ -54,12 +54,12 @@ using namespace std; BaseFilterConverter::BaseFilterConverter(JSContextRef context) : Converter(context) { - LogDebug("entered"); + LoggerD("entered"); } BaseFilterConverter::~BaseFilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } JSValueRef BaseFilterConverter::toJSValueRef(const SortModePtr& arg) @@ -258,12 +258,12 @@ FilterConverter::FilterConverter(JSContextRef context, PropertyStructArray prope IFilterProperties(properties), m_exception(exception) { - LogDebug("entered"); + LoggerD("entered"); } FilterConverter::~FilterConverter() { - LogDebug("entered"); + LoggerD("entered"); } JSValueRef FilterConverter::toJSValueRef(FilterPtr arg) @@ -360,7 +360,7 @@ FilterArrayPtr FilterConverter::toFilterArray(const JSValueRef& arg) JSValueRef value = JSGetArrayElement(m_context, obj, i); if(value == NULL) { - LogWarning("value is NULL (" << i << ")"); + LoggerW("value is NULL (" << i << ")"); continue; } @@ -368,7 +368,7 @@ FilterArrayPtr FilterConverter::toFilterArray(const JSValueRef& arg) filter = toFilter(value); if(filter == NULL) { - LogWarning("Element is not an AbstractFilter (" << i << ")"); + LoggerW("Element is not an AbstractFilter (" << i << ")"); continue; } diff --git a/src/Tizen/IFilterVisitor.cpp b/src/Tizen/IFilterVisitor.cpp index e9af497..9f97752 100644 --- a/src/Tizen/IFilterVisitor.cpp +++ b/src/Tizen/IFilterVisitor.cpp @@ -23,9 +23,9 @@ */ #include -#include #include #include "IFilterVisitor.h" +#include namespace DeviceAPI { namespace Tizen { diff --git a/src/Tizen/JSAttributeFilter.cpp b/src/Tizen/JSAttributeFilter.cpp index 5cc449c..85251bf 100644 --- a/src/Tizen/JSAttributeFilter.cpp +++ b/src/Tizen/JSAttributeFilter.cpp @@ -25,16 +25,15 @@ #include "JSAttributeFilter.h" #include -#include #include #include #include #include #include #include "AnyFactory.h" +#include #define ATTRIBUTE_FILTER_CLASS_NAME "AttributeFilter" - #define ATTRIBUTE_FILTER_ATTR_ATTRIBUTE_NAME "attributeName" #define ATTRIBUTE_FILTER_ATTR_MATCH_FLAG "matchFlag" #define ATTRIBUTE_FILTER_ATTR_MATCH_VALUE "matchValue" @@ -117,7 +116,7 @@ JSObjectRef JSAttributeFilter::createJSObject(JSContextRef context, JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } @@ -135,7 +134,7 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); std::string attributeName; MatchFlag matchFlag; @@ -204,7 +203,7 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException( context, TypeMismatchException("Error occurred while creating object")); *exception = exceptionObj; @@ -241,7 +240,7 @@ void JSAttributeFilter::Finalize(JSObjectRef object) AttributeFilterPtr JSAttributeFilter::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSAttributeFilterPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -258,7 +257,7 @@ JSValueRef JSAttributeFilter::getAttributeName(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -267,7 +266,7 @@ JSValueRef JSAttributeFilter::getAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -279,7 +278,7 @@ bool JSAttributeFilter::setAttributeName(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -288,7 +287,7 @@ bool JSAttributeFilter::setAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; @@ -299,7 +298,7 @@ JSValueRef JSAttributeFilter::getMatchFlag(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -325,7 +324,7 @@ JSValueRef JSAttributeFilter::getMatchFlag(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -337,7 +336,7 @@ bool JSAttributeFilter::setMatchFlag(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -365,7 +364,7 @@ bool JSAttributeFilter::setMatchFlag(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; diff --git a/src/Tizen/JSAttributeRangeFilter.cpp b/src/Tizen/JSAttributeRangeFilter.cpp index 59b099e..dda8b0b 100644 --- a/src/Tizen/JSAttributeRangeFilter.cpp +++ b/src/Tizen/JSAttributeRangeFilter.cpp @@ -23,14 +23,13 @@ */ #include "JSAttributeRangeFilter.h" - -#include #include #include #include #include #include #include "AnyFactory.h" +#include #define ATTRIBUTE_RANGE_FILTER_CLASS_NAME "AttributeRangeFilter" @@ -116,7 +115,7 @@ JSObjectRef JSAttributeRangeFilter::createJSObject(JSContextRef context, JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } @@ -135,7 +134,7 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); std::string attributeName; AnyPtr initialValue(NULL); @@ -180,7 +179,7 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException( context, TypeMismatchException("Error occurred while creating object")); *exception = exceptionObj; @@ -218,7 +217,7 @@ void JSAttributeRangeFilter::Finalize(JSObjectRef object) AttributeRangeFilterPtr JSAttributeRangeFilter::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSAttributeRangeFilterPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -235,7 +234,7 @@ JSValueRef JSAttributeRangeFilter::getAttributeName(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -244,7 +243,7 @@ JSValueRef JSAttributeRangeFilter::getAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -256,7 +255,7 @@ bool JSAttributeRangeFilter::setAttributeName(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -265,7 +264,7 @@ bool JSAttributeRangeFilter::setAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; diff --git a/src/Tizen/JSCompositeFilter.cpp b/src/Tizen/JSCompositeFilter.cpp index f4920b8..e29d443 100644 --- a/src/Tizen/JSCompositeFilter.cpp +++ b/src/Tizen/JSCompositeFilter.cpp @@ -23,17 +23,15 @@ */ #include "JSCompositeFilter.h" - #include -#include #include #include #include #include #include +#include #define ATTRIBUTE_FILTER_CLASS_NAME "CompositeFilter" - #define ATTRIBUTE_FILTER_ATTR_TYPE "type" #define ATTRIBUTE_FILTER_ATTR_FILTERS "filters" @@ -114,7 +112,7 @@ JSObjectRef JSCompositeFilter::createJSObject(JSContextRef context, JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } @@ -131,7 +129,7 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); FilterType type; JSValueRef jsValueFilters = NULL; @@ -184,7 +182,7 @@ JSObjectRef JSCompositeFilter::constructor(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException( context, TypeMismatchException("Error occurred while creating object")); *exception = exceptionObj; @@ -221,7 +219,7 @@ void JSCompositeFilter::Finalize(JSObjectRef object) CompositeFilterPtr JSCompositeFilter::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSCompositeFilterPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -239,7 +237,7 @@ bool JSCompositeFilter::setProperty(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -255,7 +253,7 @@ bool JSCompositeFilter::setProperty(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return false; @@ -266,7 +264,7 @@ JSValueRef JSCompositeFilter::getType(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -284,7 +282,7 @@ JSValueRef JSCompositeFilter::getType(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -296,7 +294,7 @@ bool JSCompositeFilter::setType(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -316,7 +314,7 @@ bool JSCompositeFilter::setType(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; diff --git a/src/Tizen/JSFeature.cpp b/src/Tizen/JSFeature.cpp deleted file mode 100644 index e16fe4b..0000000 --- a/src/Tizen/JSFeature.cpp +++ /dev/null @@ -1,122 +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. -// - -/** - * @file JSFeature.cpp - * @author - * @version 0.1 - * @brief - */ - -#include -#include -#include -#include "JSFeature.h" -#include "JSFeatureParam.h" - - -namespace DeviceAPI { -namespace Tizen { - -namespace { - const char* PLUGIN_NAME = "Feature"; - const char* ATTRIBUTE_URI = "uri"; -} - -JSClassDefinition JSFeature::m_classInfo = -{ - 0, - kJSClassAttributeNone, - PLUGIN_NAME, - 0, - m_properties, - NULL, //m_functions, - initialize, - finalize, - NULL, //hasProperty, - NULL, //getProperty, - NULL, //setProperty, - NULL, //deleteProperty, - NULL, //getPropertyNames, - NULL, - NULL, - NULL, //hasInstance, - NULL //convertToType -}; - -JSStaticValue JSFeature::m_properties[] = { - { ATTRIBUTE_URI, getProperty, NULL, kJSPropertyAttributeReadOnly }, - { 0, 0, 0, 0 } -}; - -const JSClassDefinition* JSFeature::getClassInfo() -{ - return &m_classInfo; -} - -JSClassRef JSFeature::m_classRef = JSClassCreate(JSFeature::getClassInfo()); - -void JSFeature::initialize(JSContextRef context, JSObjectRef object) -{ - //LogDebug("entered"); - //private object should be passed to JSObjectMake function. - //Nothing to do here. -} - -void JSFeature::finalize(JSObjectRef object) -{ - LogDebug("entered"); - JSFeaturePrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); - delete priv; -} - -JSClassRef JSFeature::getClassRef() -{ - if (!m_classRef) { - m_classRef = JSClassCreate(&m_classInfo); - } - return m_classRef; -} - -JSValueRef JSFeature::getProperty(JSContextRef context, JSObjectRef object, - JSStringRef propertyName, JSValueRef* exception) -{ - LogDebug("entered"); - JSFeaturePrivateObject* priv = - static_cast(JSObjectGetPrivate(object)); - if (!priv) { - LogError("no private object"); - return JSValueMakeUndefined(context); - } - Try - { - WrtDeviceApis::CommonsJavaScript::Converter converter(context); - if (JSStringIsEqualToUTF8CString(propertyName, ATTRIBUTE_URI)) { - return converter.toJSValueRef(priv->getObject()->getName() ); - } - } - Catch(WrtDeviceApis::Commons::Exception) - { - LogError("error during conversion"); - } - return JSValueMakeUndefined(context); -} - -} // Tizen -} // DeviceAPI - diff --git a/src/Tizen/JSFeature.h b/src/Tizen/JSFeature.h deleted file mode 100644 index ce1ca79..0000000 --- a/src/Tizen/JSFeature.h +++ /dev/null @@ -1,90 +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. -// - -/** - * @file JSFeature.h - * @author - * @version 0.1 - * @brief - */ - -#ifndef _WRT_PLUGIN_JS_FEATURE_H_ -#define _WRT_PLUGIN_JS_FEATURE_H_ - -#include -#include -#include -#include - -namespace DeviceAPI { namespace Tizen { - -typedef WrtDeviceApis::CommonsJavaScript::PrivateObject JSFeaturePrivateObject; - -/** - * @class JSFeature - * @brief This class is javascript extenstion - * - */ -class JSFeature -{ -public: - /** - * This method initializes this in the JS Engine. - */ - static JSClassRef getClassRef(); - - /** - * Gets object's class description. - */ - static const JSClassDefinition* getClassInfo(); - -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); - - /** - * The callback invoked when getting a property's value. - */ - static JSValueRef getProperty(JSContextRef context, JSObjectRef object, - JSStringRef propertyName, JSValueRef* exception); - - /** - * This structure describes a statically declared value property. - */ - static JSStaticValue m_properties[]; - - /** - * This structure contains properties and callbacks that define a type of object. - */ - static JSClassDefinition m_classInfo; - - static JSClassRef m_classRef; - -}; - -} // Tizen -} // DeviceAPI - - -#endif // _WRT_PLUGIN_JS_FEATURE_H_ diff --git a/src/Tizen/JSFeatureParam.cpp b/src/Tizen/JSFeatureParam.cpp deleted file mode 100644 index d2ed547..0000000 --- a/src/Tizen/JSFeatureParam.cpp +++ /dev/null @@ -1,126 +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. -// - -/** - * @file JSFeatureParam.cpp - * @author - * @version 0.1 - * @brief - */ - -#include -#include -#include "JSFeatureParam.h" - - -namespace DeviceAPI { namespace Tizen { - -namespace { - const char* PLUGIN_NAME = "Param"; - const char* ATTRIBUTE_NAME = "name"; - const char* ATTRIBUTE_VALUE = "value"; -} - -JSClassDefinition JSFeatureParam::m_classInfo = -{ - 0, - kJSClassAttributeNone, - PLUGIN_NAME, - 0, - m_properties, - NULL, //m_functions, - initialize, - finalize, - NULL, //hasProperty, - NULL, //getProperty, - NULL, //setProperty, - NULL, //deleteProperty, - NULL, //getPropertyNames, - NULL, - NULL, - NULL, //hasInstance, - NULL //convertToType -}; - -JSStaticValue JSFeatureParam::m_properties[] = { - { ATTRIBUTE_NAME, getProperty, NULL, kJSPropertyAttributeReadOnly }, - { ATTRIBUTE_VALUE, getProperty, NULL, kJSPropertyAttributeReadOnly }, - { 0, 0, 0, 0 } -}; - -const JSClassDefinition* JSFeatureParam::getClassInfo() -{ - return &m_classInfo; -} - -JSClassRef JSFeatureParam::m_classRef = JSClassCreate(JSFeatureParam::getClassInfo()); - - -void JSFeatureParam::initialize(JSContextRef context, JSObjectRef object) -{ - LogDebug("entered"); - //private object should be passed to JSObjectMake function. - //Nothing to do here. -} - -void JSFeatureParam::finalize(JSObjectRef object) -{ - LogDebug("entered"); - JSFeatureParamPrivObject* priv = - static_cast(JSObjectGetPrivate(object)); - delete priv; -} - -JSClassRef JSFeatureParam::getClassRef() -{ - if (!m_classRef) { - m_classRef = JSClassCreate(&m_classInfo); - } - return m_classRef; -} - -JSValueRef JSFeatureParam::getProperty(JSContextRef context, JSObjectRef object, - JSStringRef propertyName, JSValueRef* exception) -{ - LogDebug("entered"); - JSFeatureParamPrivObject* priv = - static_cast(JSObjectGetPrivate(object)); - if (!priv) { - LogError("no private object"); - return JSValueMakeUndefined(context); - } - Try - { - WrtDeviceApis::CommonsJavaScript::Converter converter(context); - std::string propertyNameStr = converter.toString(propertyName); - if (propertyNameStr == ATTRIBUTE_NAME) { - return converter.toJSValueRef(priv->getObject().first); - } - else if (propertyNameStr == ATTRIBUTE_VALUE) { - return converter.toJSValueRef(priv->getObject().second); - } - } - Catch(WrtDeviceApis::Commons::Exception) - { - LogError("error during conversion"); - } - return JSValueMakeUndefined(context); -} - -} // Tizen -} // DeviceAPI - diff --git a/src/Tizen/JSFeatureParam.h b/src/Tizen/JSFeatureParam.h deleted file mode 100644 index a7f81f0..0000000 --- a/src/Tizen/JSFeatureParam.h +++ /dev/null @@ -1,90 +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. -// - -/** - * @file JSFeatureParam.h - * @author - * @version 0.1 - * @brief - */ - -#ifndef _WRT_PLUGIN_JS_FEATURE_PARAM_H_ -#define _WRT_PLUGIN_JS_FEATURE_PARAM_H_ - -#include -#include -#include -#include - -namespace DeviceAPI { namespace Tizen { - -typedef WrtDeviceApis::CommonsJavaScript::PrivateObject, WrtDeviceApis::CommonsJavaScript::NoOwnership> JSFeatureParamPrivObject; - -/** - * @class JSFeatureParam - * @brief This class is javascript extenstion - * - */ -class JSFeatureParam -{ -public: - /** - * This method initializes this in the JS Engine. - */ - static JSClassRef getClassRef(); - - /** - * Gets object's class description. - */ - static const JSClassDefinition* getClassInfo(); - -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); - - /** - * The callback invoked when getting a property's value. - */ - static JSValueRef getProperty(JSContextRef context, JSObjectRef object, - JSStringRef propertyName, JSValueRef* exception); - - /** - * This structure describes a statically declared value property. - */ - static JSStaticValue m_properties[]; - - /** - * This structure contains properties and callbacks that define a type of object. - */ - static JSClassDefinition m_classInfo; - - static JSClassRef m_classRef; - -}; - -} // Tizen -} // DeviceAPI - - -#endif // _WRT_PLUGIN_JS_FEATURE_PARAM_H_ diff --git a/src/Tizen/JSSimpleCoordinates.cpp b/src/Tizen/JSSimpleCoordinates.cpp index 664095d..85b26c5 100644 --- a/src/Tizen/JSSimpleCoordinates.cpp +++ b/src/Tizen/JSSimpleCoordinates.cpp @@ -25,11 +25,11 @@ #include "JSSimpleCoordinates.h" #include -#include #include #include #include #include +#include #define ATTRIBUTE_FILTER_CLASS_NAME "SimpleCoordinates" @@ -111,7 +111,7 @@ JSObjectRef JSSimpleCoordinates::createJSObject(JSContextRef context, SimpleCoor JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -123,7 +123,7 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); ArgumentValidator validator(context, argumentCount, arguments); @@ -152,7 +152,7 @@ JSObjectRef JSSimpleCoordinates::constructor(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException( context, TypeMismatchException("Error occurred while creating object")); *exception = exceptionObj; @@ -189,7 +189,7 @@ void JSSimpleCoordinates::Finalize(JSObjectRef object) SimpleCoordinatesPtr JSSimpleCoordinates::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSSimpleCoordinatesPriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -206,7 +206,7 @@ JSValueRef JSSimpleCoordinates::getLatitude(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -215,7 +215,7 @@ JSValueRef JSSimpleCoordinates::getLatitude(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -227,7 +227,7 @@ bool JSSimpleCoordinates::setLatitude(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -236,7 +236,7 @@ bool JSSimpleCoordinates::setLatitude(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; @@ -247,7 +247,7 @@ JSValueRef JSSimpleCoordinates::getLongitude(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -256,7 +256,7 @@ JSValueRef JSSimpleCoordinates::getLongitude(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -268,7 +268,7 @@ bool JSSimpleCoordinates::setLongitude(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -277,7 +277,7 @@ bool JSSimpleCoordinates::setLongitude(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; diff --git a/src/Tizen/JSSortMode.cpp b/src/Tizen/JSSortMode.cpp index 28f878f..9bb9377 100644 --- a/src/Tizen/JSSortMode.cpp +++ b/src/Tizen/JSSortMode.cpp @@ -23,13 +23,12 @@ */ #include "JSSortMode.h" - #include -#include #include #include #include #include +#include #define ATTRIBUTE_FILTER_CLASS_NAME "SortMode" @@ -111,7 +110,7 @@ JSObjectRef JSSortMode::createJSObject(JSContextRef context, SortModePtr private JSSortModePriv *priv = new JSSortModePriv(context, privateData); JSObjectRef jsObjectRef = JSObjectMake(context, getClassRef(), static_cast(priv)); if (NULL == jsObjectRef) { - LogError("object creation error"); + LoggerE("object creation error"); return NULL; } return jsObjectRef; @@ -123,7 +122,7 @@ JSObjectRef JSSortMode::constructor(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); std::string attributeName; SortOrder sortOrder; @@ -175,7 +174,7 @@ JSObjectRef JSSortMode::constructor(JSContextRef context, } Catch(Exception) { - LogError("Argument type mismatch : " << _rethrown_exception.GetMessage()); + LoggerE("Argument type mismatch : " << _rethrown_exception.GetMessage()); JSObjectRef exceptionObj = JSWebAPIException::makeJSWebAPIException( context, TypeMismatchException("Error occurred while creating object")); *exception = exceptionObj; @@ -212,7 +211,7 @@ void JSSortMode::Finalize(JSObjectRef object) SortModePtr JSSortMode::getPrivData(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); JSSortModePriv *priv = static_cast(JSObjectGetPrivate(object)); if (!priv) ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "Private object is null"); @@ -229,7 +228,7 @@ JSValueRef JSSortMode::getAttributeName(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -238,7 +237,7 @@ JSValueRef JSSortMode::getAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -250,7 +249,7 @@ bool JSSortMode::setAttributeName(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -259,7 +258,7 @@ bool JSSortMode::setAttributeName(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; @@ -270,7 +269,7 @@ JSValueRef JSSortMode::getOrder(JSContextRef context, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -288,7 +287,7 @@ JSValueRef JSSortMode::getOrder(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to get incorrect value [" << e.getName() << "] " << e.getMessage()); } return JSValueMakeUndefined(context); @@ -300,7 +299,7 @@ bool JSSortMode::setOrder(JSContextRef context, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); try { @@ -320,7 +319,7 @@ bool JSSortMode::setOrder(JSContextRef context, } catch(BasePlatformException &e) { - LogWarning("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); + LoggerW("trying to set incorrect value [" << e.getName() << "] " << e.getMessage()); } return true; diff --git a/src/Tizen/JSTizen.cpp b/src/Tizen/JSTizen.cpp index 750dfb0..166986c 100644 --- a/src/Tizen/JSTizen.cpp +++ b/src/Tizen/JSTizen.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -32,17 +31,14 @@ #include "FilterTypes.h" #include "AnyType.h" #include "JSTizen.h" -#include "JSFeature.h" #include "plugin_config.h" #include #include #include - #include +#include #define PLUGIN_NAME "tizen" -#define FUNCTION_LIST_AVAILABLE_FEATURES "listAvailableFeatures" -#define FUNCTION_LIST_ACTIVATED_FEATURES "listActivatedFeatures" namespace DeviceAPI { namespace Tizen { @@ -77,8 +73,6 @@ JSStaticValue JSTizen::m_properties[] = { }; JSStaticFunction JSTizen::m_functions[] = { - { FUNCTION_LIST_AVAILABLE_FEATURES, listAvailableFeatures, kJSPropertyAttributeNone}, - { FUNCTION_LIST_ACTIVATED_FEATURES, listActivatedFeatures, kJSPropertyAttributeNone}, { 0, 0, 0 } }; @@ -91,7 +85,7 @@ JSClassRef JSTizen::m_classRef = JSClassCreate(JSTizen::getClassInfo()); void JSTizen::initialize(JSContextRef context, JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); if (priv) { @@ -116,7 +110,7 @@ void JSTizen::initialize(JSContextRef context, JSObjectRef object) void JSTizen::finalize(JSObjectRef object) { - LogDebug("entered"); + LoggerD("entered"); TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); JSObjectSetPrivate(object, NULL); delete priv; @@ -144,7 +138,7 @@ void JSTizen::getPropertyNames(JSContextRef context, JSObjectRef object, TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (!priv || !priv->getObject()) { - LogError("No private obejct"); + LoggerE("No private obejct"); return; } PluginOnDemandPrivPtr privObj = priv->getObject(); @@ -153,7 +147,7 @@ void JSTizen::getPropertyNames(JSContextRef context, JSObjectRef object, } Catch(Commons::Exception) { - LogError("Error occured"); + LoggerE("Error occured"); } } @@ -172,14 +166,14 @@ JSValueRef JSTizen::convertToType(JSContextRef context, JSObjectRef object, bool JSTizen::hasProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName) { - LogDebug("entered"); + LoggerD("entered"); Try { TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (!priv || !priv->getObject()) { - LogError("No private obejct"); + LoggerE("No private obejct"); return false; } @@ -188,7 +182,7 @@ bool JSTizen::hasProperty(JSContextRef context, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error occured"); + LoggerE("Error occured"); } //let JSCore to handle this property @@ -198,14 +192,14 @@ bool JSTizen::hasProperty(JSContextRef context, JSValueRef JSTizen::getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (!priv || !priv->getObject()) { - LogError("No private obejct"); + LoggerE("No private obejct"); return false; } @@ -214,7 +208,7 @@ JSValueRef JSTizen::getProperty(JSContextRef context, JSObjectRef object, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error occured"); + LoggerE("Error occured"); } /* During normal operation flow should not reach here, @@ -225,13 +219,13 @@ JSValueRef JSTizen::getProperty(JSContextRef context, JSObjectRef object, bool JSTizen::setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) { - LogDebug("entered"); + LoggerD("entered"); Try { TizenPrivate* priv = static_cast(JSObjectGetPrivate(object)); if (!priv || !priv->getObject()) { - LogError("No private obejct"); + LoggerE("No private obejct"); return false; } std::string strPropertyName = CommonsJavaScript::Converter(context).toString(propertyName); @@ -244,7 +238,7 @@ bool JSTizen::setProperty(JSContextRef context, JSObjectRef object, } Catch(WrtDeviceApis::Commons::Exception) { - LogError("Error occured"); + LoggerE("Error occured"); } //this code should not be reached. setProperty is not called when @@ -252,101 +246,6 @@ bool JSTizen::setProperty(JSContextRef context, JSObjectRef object, //return false. return false; } - -JSValueRef JSTizen::listAvailableFeatures(JSContextRef context, JSObjectRef object, - JSObjectRef thisObject, size_t argumentCount, - const JSValueRef arguments[], JSValueRef* exception) -{ - LogDebug("entered"); - - TizenPrivate* priv = static_cast(JSObjectGetPrivate(thisObject)); - assert(priv); - - /* - * Current Tizen spec assures that tizen is always available - AccessStatus status = DEVICEAPIS_CHECK_ACCESS( - DEVICEAPIS_FUNCTION_API_LIST_AVAIL_FEATURES); - - SYNC_ACCESS_STATUS_HANDLER(status, context, exception); - */ - - try - { - if (!priv) { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "No private object"); - } - PluginOnDemandPrivPtr privObj = priv->getObject(); - } - catch(const WrtDeviceApis::Commons::Exception &ex) - { - return WrtDeviceApis::CommonsJavaScript::JSDOMExceptionFactory::UnknownException.make(context, exception); - } - JSObjectRef result = JSCreateArrayObject(context, 0, NULL); - int widgetId = WrtAccessSingleton::Instance().getWidgetId(); - WidgetDB::Api::IWidgetDBPtr widgetDB = - WidgetDB::Api::getWidgetDB(widgetId); - WidgetDB::Api::Features features = widgetDB->getRegisteredFeatures(); - for (size_t i=0; i(JSObjectGetPrivate(thisObject)); - assert(priv); - - /* - * Current Tizen spec assures that tizen is always available - AccessStatus status = DEVICEAPIS_CHECK_ACCESS( - DEVICEAPIS_FUNCTION_API_LIST_ACTIV_FEATURES); - - SYNC_ACCESS_STATUS_HANDLER(status, context, exception);*/ - try - { - if (!priv) { - ThrowMsg(WrtDeviceApis::Commons::NullPointerException, "No private object"); - } - PluginOnDemandPrivPtr privObj = priv->getObject(); - } - catch(const WrtDeviceApis::Commons::Exception &ex) - { - return WrtDeviceApis::CommonsJavaScript::JSDOMExceptionFactory::UnknownException.make(context, exception); - } - JSObjectRef result = JSCreateArrayObject(context, 0, NULL); - int widgetId = WrtAccessSingleton::Instance().getWidgetId(); - WidgetDB::Api::IWidgetDBPtr widgetDB = - WidgetDB::Api::getWidgetDB(widgetId); - WidgetDB::Api::Features features = widgetDB->getWidgetFeatures(); - for (size_t i=0; i #include #include #include @@ -32,6 +31,7 @@ #include "JSCompositeFilter.h" #include "JSSortMode.h" #include "JSSimpleCoordinates.h" +#include #define OBJECT_TIZEN "tizen" @@ -67,27 +67,27 @@ using namespace WrtDeviceApis::Commons; void on_widget_start_callback(int widgetId) { - LogDebug("[Tizen\\xxx] on_widget_start_callback ("<