From da854ef348cf918993a95adeeffa616db2dca6f7 Mon Sep 17 00:00:00 2001 From: Kim Kibum Date: Sun, 29 Apr 2012 17:04:35 +0900 Subject: [PATCH] upload tizen1.0 source --- CMakeLists.txt | 82 +- config.dtd | 32 + debian/changelog | 381 ++++- debian/control | 6 +- debian/rules | 65 +- debian/wrt-plugins-common-dev.install.in | 4 +- debian/wrt-plugins-common.install.in | 5 +- debian/wrt-plugins-common.postinst.in | 4 + packaging/wrt-plugins-common.spec | 68 + pkgconfigs/wrt-plugins-accelerometer.pc.in | 12 - pkgconfigs/wrt-plugins-calendar.pc.in | 12 - pkgconfigs/wrt-plugins-camera.pc.in | 12 - pkgconfigs/wrt-plugins-commons-javascript.pc.in | 4 +- pkgconfigs/wrt-plugins-commons.pc.in | 4 +- pkgconfigs/wrt-plugins-contact.pc.in | 12 - pkgconfigs/wrt-plugins-cpu.pc.in | 4 +- pkgconfigs/wrt-plugins-filesystem.pc.in | 4 +- pkgconfigs/wrt-plugins-haptics.pc.in | 12 - pkgconfigs/wrt-plugins-localstorage.pc.in | 12 - pkgconfigs/wrt-plugins-messaging.pc.in | 12 - pkgconfigs/wrt-plugins-mmplayer.pc.in | 4 +- pkgconfigs/wrt-plugins-orientation.pc.in | 12 - pkgconfigs/wrt-plugins-plugin-manager.pc.in | 4 +- pkgconfigs/wrt-plugins-power.pc.in | 12 - pkgconfigs/wrt-plugins-profile.pc.in | 12 - pkgconfigs/wrt-plugins-radio.pc.in | 12 - pkgconfigs/wrt-plugins-storageevent.pc.in | 12 - pkgconfigs/wrt-plugins-systeminfo.pc.in | 12 - pkgconfigs/wrt-plugins-task.pc.in | 12 - ...c.in => wrt-plugins-widget-interface-dao.pc.in} | 6 +- pkgconfigs/wrt-plugins-widget.pc.in | 12 - pkgconfigs/wrt-plugins-widgetdb.pc.in | 4 +- src/CMakeLists.txt | 6 +- src/Commons/CMakeLists.txt | 33 +- src/Commons/FunctionDeclaration.h | 14 +- .../WidgetConfiguration/ConfigurationSupport.h | 54 - .../WidgetConfiguration/WidgetConfiguration.cpp | 55 - .../WidgetConfiguration/WidgetConfiguration.h | 58 - src/Commons/WidgetConfiguration/config.cmake | 5 - .../WrtWrapper.cpp => WrtAccess/WrtAccess.cpp} | 44 +- .../WrtCameraManager.h => WrtAccess/WrtAccess.h} | 32 +- src/Commons/WrtAccess/config.cmake | 5 + src/Commons/WrtWrapper/IWrtCamera.h | 80 -- src/Commons/WrtWrapper/IWrtCameraManager.h | 56 - src/Commons/WrtWrapper/IWrtWrapper.h | 67 - src/Commons/WrtWrapper/WrtCamera.cpp | 178 --- src/Commons/WrtWrapper/WrtCamera.h | 88 -- src/Commons/WrtWrapper/WrtCameraManager.cpp | 83 -- src/Commons/WrtWrapper/WrtWrapper.h | 61 - src/Commons/WrtWrapper/WrtWrappersMgr.cpp | 144 -- src/Commons/WrtWrapper/WrtWrappersMgr.h | 92 -- src/Commons/WrtWrapper/config.cmake | 8 - src/CommonsJavaScript/CMakeLists.txt | 5 +- .../Security/SecurityFunctionDeclaration.cpp | 6 +- .../Security/SecurityFunctionDeclaration.h | 20 +- .../API/Accelerometer/AccelerationProperties.h | 50 - .../API/Accelerometer/AccelerometerFactory.cpp | 46 - .../API/Accelerometer/AccelerometerFactory.h | 48 - .../API/Accelerometer/EventAccelerationChanged.h | 66 - .../Accelerometer/EventGetCurrentAcceleration.h | 83 -- src/modules/API/Accelerometer/IAccelerometer.cpp | 42 - src/modules/API/Accelerometer/IAccelerometer.h | 83 -- src/modules/API/Accelerometer/ISensor.cpp | 33 - src/modules/API/Accelerometer/ISensor.h | 67 - src/modules/API/Accelerometer/config.cmake | 13 - src/modules/API/CMakeLists.txt | 12 - src/modules/API/Calendar/CalendarEvent.cpp | 260 ---- src/modules/API/Calendar/CalendarEvent.h | 155 -- src/modules/API/Calendar/CalendarFactory.cpp | 45 - src/modules/API/Calendar/CalendarFactory.h | 49 - src/modules/API/Calendar/EventAddEvent.h | 73 - src/modules/API/Calendar/EventCreateEvent.h | 72 - src/modules/API/Calendar/EventDeleteEvent.h | 72 - src/modules/API/Calendar/EventFilter.cpp | 284 ---- src/modules/API/Calendar/EventFilter.h | 128 -- src/modules/API/Calendar/EventFindEvents.h | 103 -- src/modules/API/Calendar/EventGetCalendars.h | 72 - src/modules/API/Calendar/EventUpdateEvent.h | 73 - src/modules/API/Calendar/ICalendar.cpp | 77 - src/modules/API/Calendar/ICalendar.h | 114 -- src/modules/API/Calendar/ICalendarManager.cpp | 47 - src/modules/API/Calendar/ICalendarManager.h | 50 - src/modules/API/Calendar/config.cmake | 15 - src/modules/API/Camera/CameraFactory.cpp | 38 - src/modules/API/Camera/CameraFactory.h | 55 - src/modules/API/Camera/EventBeginRecording.h | 64 - src/modules/API/Camera/EventEndRecording.h | 42 - src/modules/API/Camera/EventGetCameras.h | 83 -- src/modules/API/Camera/EventGetPreviewNode.h | 57 - src/modules/API/Camera/EventTakePicture.h | 60 - src/modules/API/Camera/ICamera.h | 136 -- src/modules/API/Camera/ICameraFeature.h | 71 - src/modules/API/Camera/ICameraManager.h | 67 - src/modules/API/Camera/ICaptureOptions.h | 240 ---- src/modules/API/Camera/IFeatureValue.h | 62 - .../API/Camera/SupportCameraPendingOperation.h | 39 - src/modules/API/Camera/config.cmake | 11 - src/modules/API/Contact/Contact.cpp | 368 ----- src/modules/API/Contact/Contact.h | 137 -- src/modules/API/Contact/ContactAddress.cpp | 372 ----- src/modules/API/Contact/ContactAddress.h | 144 -- src/modules/API/Contact/ContactEmail.cpp | 84 -- src/modules/API/Contact/ContactEmail.h | 72 - src/modules/API/Contact/ContactFactory.cpp | 43 - src/modules/API/Contact/ContactFactory.h | 47 - src/modules/API/Contact/ContactFilter.cpp | 240 ---- src/modules/API/Contact/ContactFilter.h | 123 -- src/modules/API/Contact/ContactPhoneNumber.cpp | 89 -- src/modules/API/Contact/ContactPhoneNumber.h | 85 -- src/modules/API/Contact/EventAddContact.h | 74 - src/modules/API/Contact/EventAddGroup.h | 73 - src/modules/API/Contact/EventDeleteContact.h | 74 - src/modules/API/Contact/EventDeleteGroup.h | 70 - src/modules/API/Contact/EventExportVCard.h | 84 -- src/modules/API/Contact/EventFindContacts.h | 134 -- src/modules/API/Contact/EventFindGroup.h | 86 -- .../API/Contact/EventGetAddressBookItemCount.h | 75 - src/modules/API/Contact/EventGetAddressBooks.h | 74 - src/modules/API/Contact/EventGetOwnerInfo.h | 84 -- src/modules/API/Contact/EventUpdateContact.h | 74 - src/modules/API/Contact/IAddressBook.cpp | 116 -- src/modules/API/Contact/IAddressBook.h | 100 -- src/modules/API/Contact/IContactEventPrivateData.h | 44 - src/modules/API/Contact/IContactManager.cpp | 56 - src/modules/API/Contact/IContactManager.h | 53 - src/modules/API/Contact/config.cmake | 18 - src/modules/API/Filesystem/IManager.cpp | 5 + src/modules/API/Filesystem/IManager.h | 1 + src/modules/API/Haptics/EventPlayBeep.h | 69 - src/modules/API/Haptics/EventStartMotor.h | 70 - src/modules/API/Haptics/HapticPattern.cpp | 75 - src/modules/API/Haptics/HapticPattern.h | 71 - src/modules/API/Haptics/IManager.cpp | 32 - src/modules/API/Haptics/IManager.h | 55 - src/modules/API/Haptics/IMotor.cpp | 26 - src/modules/API/Haptics/IMotor.h | 99 -- src/modules/API/Haptics/Types.h | 49 - src/modules/API/Haptics/config.cmake | 13 - src/modules/API/MMPlayer/EventOpen.h | 12 +- src/modules/API/Messaging/AttachmentFactory.cpp | 50 - src/modules/API/Messaging/AttachmentFactory.h | 50 - src/modules/API/Messaging/Attachments.cpp | 228 --- src/modules/API/Messaging/Attachments.h | 207 --- src/modules/API/Messaging/BccRecipient.cpp | 83 -- src/modules/API/Messaging/BccRecipient.h | 67 - src/modules/API/Messaging/Body.cpp | 68 - src/modules/API/Messaging/Body.h | 85 -- src/modules/API/Messaging/CallbackNumber.cpp | 70 - src/modules/API/Messaging/CallbackNumber.h | 83 -- src/modules/API/Messaging/CcRecipient.cpp | 82 -- src/modules/API/Messaging/CcRecipient.h | 66 - src/modules/API/Messaging/EmailAccountInfo.cpp | 84 -- src/modules/API/Messaging/EmailAccountInfo.h | 57 - .../API/Messaging/EmitterMessageReceived.cpp | 35 - src/modules/API/Messaging/EmitterMessageReceived.h | 46 - src/modules/API/Messaging/EventDeleteMessage.h | 52 - src/modules/API/Messaging/EventFindMessage.h | 59 - src/modules/API/Messaging/EventMessageReceived.cpp | 38 - src/modules/API/Messaging/EventMessageReceived.h | 52 - src/modules/API/Messaging/EventOnSendingFailed.h | 74 - src/modules/API/Messaging/EventSendMessage.h | 103 -- src/modules/API/Messaging/EventUpdateMessage.h | 55 - src/modules/API/Messaging/From.cpp | 65 - src/modules/API/Messaging/From.h | 74 - src/modules/API/Messaging/IAttachment.cpp | 147 -- src/modules/API/Messaging/IAttachment.h | 125 -- src/modules/API/Messaging/IBinarySms.cpp | 41 - src/modules/API/Messaging/IBinarySms.h | 52 - src/modules/API/Messaging/IEmail.cpp | 60 - src/modules/API/Messaging/IEmail.h | 60 - src/modules/API/Messaging/IEmailAccount.cpp | 68 - src/modules/API/Messaging/IEmailAccount.h | 81 -- src/modules/API/Messaging/IMessage.cpp | 235 ---- src/modules/API/Messaging/IMessage.h | 327 ----- src/modules/API/Messaging/IMessaging.cpp | 39 - src/modules/API/Messaging/IMessaging.h | 87 -- src/modules/API/Messaging/IMessagingTypes.h | 69 - src/modules/API/Messaging/IMms.cpp | 74 - src/modules/API/Messaging/IMms.h | 83 -- src/modules/API/Messaging/IMmsSlide.h | 66 - src/modules/API/Messaging/IMmsSlideProperties.h | 244 ---- src/modules/API/Messaging/IMmsSlides.h | 109 -- src/modules/API/Messaging/ISms.cpp | 58 - src/modules/API/Messaging/ISms.h | 57 - .../API/Messaging/MessageEventPrivateData.h | 60 - src/modules/API/Messaging/MessageFactory.cpp | 132 -- src/modules/API/Messaging/MessageFactory.h | 102 -- src/modules/API/Messaging/MessageFilter.cpp | 334 ----- src/modules/API/Messaging/MessageFilter.h | 151 -- src/modules/API/Messaging/MessagePriority.cpp | 56 - src/modules/API/Messaging/MessagePriority.h | 76 - src/modules/API/Messaging/MmsSlide.cpp | 167 --- src/modules/API/Messaging/MmsSlide.h | 86 -- src/modules/API/Messaging/MmsSlideProperty.cpp | 70 - src/modules/API/Messaging/MmsSlideProperty.h | 84 -- src/modules/API/Messaging/MmsSlides.cpp | 102 -- src/modules/API/Messaging/MmsSlides.h | 71 - src/modules/API/Messaging/Recipient.cpp | 210 --- src/modules/API/Messaging/Recipient.h | 112 -- src/modules/API/Messaging/ReqReceiverMessage.cpp | 160 --- src/modules/API/Messaging/ReqReceiverMessage.h | 78 -- src/modules/API/Messaging/SourceAddress.cpp | 73 - src/modules/API/Messaging/SourceAddress.h | 62 - src/modules/API/Messaging/Subject.cpp | 67 - src/modules/API/Messaging/Subject.h | 83 -- src/modules/API/Messaging/ToRecipient.cpp | 82 -- src/modules/API/Messaging/ToRecipient.h | 64 - src/modules/API/Messaging/ValidityPeriodHours.cpp | 60 - src/modules/API/Messaging/ValidityPeriodHours.h | 76 - src/modules/API/Messaging/VirtualMessage.cpp | 79 -- src/modules/API/Messaging/VirtualMessage.h | 78 -- src/modules/API/Messaging/config.cmake | 41 - .../API/Orientation/EventGetCurrentOrientation.h | 83 -- .../API/Orientation/EventOrientationChanged.h | 66 - src/modules/API/Orientation/IOrientation.cpp | 42 - src/modules/API/Orientation/IOrientation.h | 83 -- src/modules/API/Orientation/OrientationFactory.cpp | 46 - src/modules/API/Orientation/OrientationFactory.h | 48 - .../API/Orientation/OrientationProperties.h | 51 - src/modules/API/Orientation/config.cmake | 12 - .../API/PluginManager/PluginManagerFactory.cpp | 6 +- .../API/PluginManager/PluginManagerFactory.h | 3 +- src/modules/API/Power/Enums.h | 36 - src/modules/API/Power/EventCharging.cpp | 32 - src/modules/API/Power/EventCharging.h | 46 - src/modules/API/Power/EventLight.h | 72 - src/modules/API/Power/EventLow.cpp | 42 - src/modules/API/Power/EventLow.h | 62 - src/modules/API/Power/EventRemaining.cpp | 42 - src/modules/API/Power/EventRemaining.h | 62 - src/modules/API/Power/IBacklight.cpp | 29 - src/modules/API/Power/IBacklight.h | 61 - src/modules/API/Power/IBattery.cpp | 28 - src/modules/API/Power/IBattery.h | 97 -- src/modules/API/Power/IManager.cpp | 37 - src/modules/API/Power/IManager.h | 69 - src/modules/API/Power/config.cmake | 16 - src/modules/API/Profile/Enums.h | 37 - src/modules/API/Profile/EventSetWallpaper.h | 61 - src/modules/API/Profile/IDesktop.cpp | 26 - src/modules/API/Profile/IDesktop.h | 71 - src/modules/API/Profile/IManager.cpp | 32 - src/modules/API/Profile/IManager.h | 102 -- src/modules/API/Profile/IRingtone.cpp | 26 - src/modules/API/Profile/IRingtone.h | 91 -- src/modules/API/Profile/Types.h | 50 - src/modules/API/Profile/config.cmake | 13 - src/modules/API/Radio/Enums.h | 42 - src/modules/API/Radio/EventSourceTypeChange.cpp | 36 - src/modules/API/Radio/EventSourceTypeChange.h | 61 - src/modules/API/Radio/IManager.cpp | 36 - src/modules/API/Radio/IManager.h | 91 -- src/modules/API/Radio/ISource.cpp | 30 - src/modules/API/Radio/ISource.h | 71 - src/modules/API/Radio/Types.h | 31 - src/modules/API/Radio/config.cmake | 13 - src/modules/API/SystemInfo/ISystemInfo.cpp | 36 - src/modules/API/SystemInfo/ISystemInfo.h | 45 - src/modules/API/SystemInfo/config.cmake | 11 - src/modules/API/Task/CalendarTask.cpp | 186 --- src/modules/API/Task/CalendarTask.h | 131 -- src/modules/API/Task/IEventAddTask.h | 74 - src/modules/API/Task/IEventCreateTask.h | 74 - src/modules/API/Task/IEventDeleteTask.h | 73 - src/modules/API/Task/IEventFindTasks.h | 103 -- src/modules/API/Task/IEventGetTasks.h | 73 - src/modules/API/Task/IEventUpdateTask.h | 74 - src/modules/API/Task/ITask.cpp | 79 -- src/modules/API/Task/ITask.h | 114 -- src/modules/API/Task/ITaskManager.cpp | 48 - src/modules/API/Task/ITaskManager.h | 50 - src/modules/API/Task/TaskFactory.cpp | 52 - src/modules/API/Task/TaskFactory.h | 50 - src/modules/API/Task/TaskFilter.cpp | 215 --- src/modules/API/Task/TaskFilter.h | 111 -- src/modules/API/Task/config.cmake | 15 - src/modules/API/Widget/WidgetFactory.cpp | 4 +- src/modules/API/Widget/WidgetFactory.h | 3 +- src/modules/API/config.cmake | 3 + src/modules/CMakeLists.txt | 3 + src/modules/packages/Accelerometer/CMakeLists.txt | 47 - src/modules/packages/CMakeLists.txt | 12 - src/modules/packages/Calendar/CMakeLists.txt | 52 - src/modules/packages/Camera/CMakeLists.txt | 52 - src/modules/packages/Contact/CMakeLists.txt | 61 - src/modules/packages/Cpu/CMakeLists.txt | 5 +- src/modules/packages/Filesystem/CMakeLists.txt | 5 +- src/modules/packages/Haptics/CMakeLists.txt | 49 - src/modules/packages/LocalStorage/CMakeLists.txt | 14 +- src/modules/packages/MMPlayer/CMakeLists.txt | 5 +- src/modules/packages/Messaging/CMakeLists.txt | 81 -- src/modules/packages/Networking/CMakeLists.txt | 5 +- src/modules/packages/Orientation/CMakeLists.txt | 46 - src/modules/packages/PluginManager/CMakeLists.txt | 5 +- src/modules/packages/Power/CMakeLists.txt | 49 - src/modules/packages/Profile/CMakeLists.txt | 48 - src/modules/packages/Radio/CMakeLists.txt | 47 - src/modules/packages/StorageEvent/CMakeLists.txt | 14 +- src/modules/packages/SystemInfo/CMakeLists.txt | 44 - src/modules/packages/Task/CMakeLists.txt | 53 - src/modules/packages/Widget/CMakeLists.txt | 12 +- src/modules/packages/WidgetDB/CMakeLists.txt | 5 +- .../packages/WidgetInterfaceDAO/CMakeLists.txt | 5 +- src/modules/tizen/Accelerometer/Accelerometer.cpp | 327 ----- src/modules/tizen/Accelerometer/Accelerometer.h | 159 --- src/modules/tizen/Accelerometer/Sensor.cpp | 85 -- src/modules/tizen/Accelerometer/Sensor.h | 64 - src/modules/tizen/Accelerometer/config.cmake | 19 - src/modules/tizen/CMakeLists.txt | 19 +- src/modules/tizen/Calendar/Calendar.cpp | 212 --- src/modules/tizen/Calendar/Calendar.h | 48 - src/modules/tizen/Calendar/CalendarManager.cpp | 144 -- src/modules/tizen/Calendar/CalendarManager.h | 51 - src/modules/tizen/Calendar/EventWrapper.cpp | 1047 -------------- src/modules/tizen/Calendar/EventWrapper.h | 88 -- src/modules/tizen/Calendar/config.cmake | 26 - src/modules/tizen/Camera-Webkit/Camera.cpp | 482 ------- src/modules/tizen/Camera-Webkit/Camera.h | 142 -- src/modules/tizen/Camera-Webkit/CameraManager.cpp | 66 - src/modules/tizen/Camera-Webkit/CameraManager.h | 45 - src/modules/tizen/Camera-Webkit/config.cmake | 15 - src/modules/tizen/Contact/AddressBook.cpp | 1233 ---------------- src/modules/tizen/Contact/AddressBook.h | 151 -- src/modules/tizen/Contact/ContactManager.cpp | 113 -- src/modules/tizen/Contact/ContactManager.h | 51 - src/modules/tizen/Contact/ContactWrapper.cpp | 1480 -------------------- src/modules/tizen/Contact/ContactWrapper.h | 83 -- src/modules/tizen/Contact/config.cmake | 26 - src/modules/tizen/DBus/Connection.cpp | 339 ----- src/modules/tizen/DBus/Connection.h | 140 -- src/modules/tizen/DBus/Message.cpp | 139 -- src/modules/tizen/DBus/Message.h | 86 -- src/modules/tizen/DBus/MessageEvent.h | 32 - src/modules/tizen/DBus/config.cmake | 16 - .../DEPRACATED/AppLauncher/AppLauncherManager.cpp | 836 ----------- .../DEPRACATED/AppLauncher/AppLauncherManager.h | 83 -- .../tizen/DEPRACATED/AppLauncher/config.cmake | 48 - .../tizen/DEPRACATED/Camera/AttributeInfo.cpp | 48 - .../tizen/DEPRACATED/Camera/AttributeInfo.h | 39 - src/modules/tizen/DEPRACATED/Camera/Camera.cpp | 929 ------------ src/modules/tizen/DEPRACATED/Camera/Camera.h | 160 --- .../tizen/DEPRACATED/Camera/CameraManager.cpp | 69 - .../tizen/DEPRACATED/Camera/CameraManager.h | 52 - src/modules/tizen/DEPRACATED/Camera/config.cmake | 22 - src/modules/tizen/DEPRACATED/Device/Manager.cpp | 74 - src/modules/tizen/DEPRACATED/Device/Manager.h | 73 - src/modules/tizen/DEPRACATED/Device/config.cmake | 21 - src/modules/tizen/DEPRACATED/Display/Manager.cpp | 71 - src/modules/tizen/DEPRACATED/Display/Manager.h | 60 - src/modules/tizen/DEPRACATED/Display/Screen.cpp | 207 --- src/modules/tizen/DEPRACATED/Display/Screen.h | 133 -- src/modules/tizen/DEPRACATED/Display/config.cmake | 25 - .../DEPRACATED/FeatureLoader/FeatureManager.cpp | 65 - .../DEPRACATED/FeatureLoader/FeatureManager.h | 63 - .../tizen/DEPRACATED/FeatureLoader/config.cmake | 6 - src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp | 279 ---- src/modules/tizen/DEPRACATED/Gallery/Gallery.h | 152 -- .../DEPRACATED/Gallery/GalleryRequestManager.cpp | 147 -- .../DEPRACATED/Gallery/GalleryRequestManager.h | 49 - src/modules/tizen/DEPRACATED/Gallery/config.cmake | 19 - .../tizen/DEPRACATED/Geolocation/Geolocation.cpp | 265 ---- .../tizen/DEPRACATED/Geolocation/Geolocation.h | 105 -- .../tizen/DEPRACATED/Geolocation/config.cmake | 21 - src/modules/tizen/DEPRACATED/Memory/Manager.cpp | 80 -- src/modules/tizen/DEPRACATED/Memory/Manager.h | 50 - src/modules/tizen/DEPRACATED/Memory/config.cmake | 18 - src/modules/tizen/DEPRACATED/System/Date.cpp | 55 - src/modules/tizen/DEPRACATED/System/Date.h | 54 - .../tizen/DEPRACATED/System/Environment.cpp | 128 -- src/modules/tizen/DEPRACATED/System/Environment.h | 75 - src/modules/tizen/DEPRACATED/System/config.cmake | 19 - .../tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp | 143 -- .../tizen/DEPRACATED/Telephony/LogEntryWrapper.h | 48 - .../tizen/DEPRACATED/Telephony/LogManager.cpp | 207 --- .../tizen/DEPRACATED/Telephony/LogManager.h | 69 - .../tizen/DEPRACATED/Telephony/config.cmake | 26 - src/modules/tizen/DEPRACATED/UI/config.cmake | 6 - src/modules/tizen/Haptics/Manager.cpp | 53 - src/modules/tizen/Haptics/Manager.h | 60 - src/modules/tizen/Haptics/Motor.cpp | 302 ---- src/modules/tizen/Haptics/Motor.h | 127 -- src/modules/tizen/Haptics/config.cmake | 31 - src/modules/tizen/MMPlayer/Manager.cpp | 16 +- src/modules/tizen/Messaging/Attachment.cpp | 63 - src/modules/tizen/Messaging/Attachment.h | 47 - src/modules/tizen/Messaging/BinarySms.cpp | 93 -- src/modules/tizen/Messaging/BinarySms.h | 63 - src/modules/tizen/Messaging/CallbackMgr.cpp | 137 -- src/modules/tizen/Messaging/CallbackMgr.h | 79 -- src/modules/tizen/Messaging/Email.cpp | 598 -------- src/modules/tizen/Messaging/Email.h | 119 -- src/modules/tizen/Messaging/EmailConverter.cpp | 116 -- src/modules/tizen/Messaging/EmailConverter.h | 41 - src/modules/tizen/Messaging/EmailService.cpp | 194 --- src/modules/tizen/Messaging/EmailService.h | 73 - src/modules/tizen/Messaging/EmailUtils.cpp | 94 -- src/modules/tizen/Messaging/EmailUtils.h | 63 - src/modules/tizen/Messaging/ISendingObserver.h | 77 - src/modules/tizen/Messaging/MailNotifier.cpp | 94 -- src/modules/tizen/Messaging/MailNotifier.h | 60 - src/modules/tizen/Messaging/MailSender.cpp | 234 ---- src/modules/tizen/Messaging/MailSender.h | 77 - src/modules/tizen/Messaging/Messaging.cpp | 1140 --------------- src/modules/tizen/Messaging/Messaging.h | 203 --- src/modules/tizen/Messaging/Mms.cpp | 880 ------------ src/modules/tizen/Messaging/Mms.h | 117 -- src/modules/tizen/Messaging/MmsSlide.cpp | 23 - src/modules/tizen/Messaging/MmsSlide.h | 41 - .../tizen/Messaging/MsgServiceHandleMgr.cpp | 27 - src/modules/tizen/Messaging/MsgServiceHandleMgr.h | 112 -- src/modules/tizen/Messaging/NetworkStatus.cpp | 85 -- src/modules/tizen/Messaging/NetworkStatus.h | 60 - src/modules/tizen/Messaging/ScopedMail.h | 54 - src/modules/tizen/Messaging/ScopedMailbox.h | 54 - src/modules/tizen/Messaging/Sms.cpp | 657 --------- src/modules/tizen/Messaging/Sms.h | 135 -- .../tizen/Messaging/StorageChangeMessage.cpp | 102 -- src/modules/tizen/Messaging/StorageChangeMessage.h | 62 - src/modules/tizen/Messaging/config.cmake | 38 - src/modules/tizen/Orientation/Orientation.cpp | 318 ----- src/modules/tizen/Orientation/Orientation.h | 157 --- src/modules/tizen/Orientation/config.cmake | 18 - src/modules/tizen/PluginManager/PluginManager.cpp | 26 +- src/modules/tizen/PluginManager/PluginManager.h | 3 + src/modules/tizen/Power/Backlight.cpp | 131 -- src/modules/tizen/Power/Backlight.h | 83 -- src/modules/tizen/Power/Battery.cpp | 209 --- src/modules/tizen/Power/Battery.h | 129 -- src/modules/tizen/Power/Manager.cpp | 93 -- src/modules/tizen/Power/Manager.h | 76 - src/modules/tizen/Power/config.cmake | 23 - src/modules/tizen/Profile/Desktop.cpp | 84 -- src/modules/tizen/Profile/Desktop.h | 67 - src/modules/tizen/Profile/Manager.cpp | 163 --- src/modules/tizen/Profile/Manager.h | 92 -- src/modules/tizen/Profile/Ringtone.cpp | 120 -- src/modules/tizen/Profile/Ringtone.h | 79 -- src/modules/tizen/Profile/config.cmake | 32 - src/modules/tizen/Radio/Manager.cpp | 148 -- src/modules/tizen/Radio/Manager.h | 83 -- src/modules/tizen/Radio/Source.cpp | 92 -- src/modules/tizen/Radio/Source.h | 80 -- src/modules/tizen/Radio/config.cmake | 25 - src/modules/tizen/SystemInfo/SystemInfo.cpp | 118 -- src/modules/tizen/SystemInfo/SystemInfo.h | 48 - src/modules/tizen/SystemInfo/config.cmake | 21 - src/modules/tizen/Task/Task.cpp | 206 --- src/modules/tizen/Task/Task.h | 48 - src/modules/tizen/Task/TaskManager.cpp | 118 -- src/modules/tizen/Task/TaskManager.h | 54 - src/modules/tizen/Task/TaskWrapper.cpp | 496 ------- src/modules/tizen/Task/TaskWrapper.h | 86 -- src/modules/tizen/Task/config.cmake | 27 - src/modules/tizen/VConf/Key.cpp | 169 --- src/modules/tizen/VConf/Key.h | 144 -- src/modules/tizen/VConf/Node.cpp | 44 - src/modules/tizen/VConf/Node.h | 69 - src/modules/tizen/VConf/config.cmake | 16 - src/modules/tizen/Widget/Widget.cpp | 46 +- src/modules/tizen/Widget/Widget.h | 10 +- src/modules/tizen/WidgetDB/WidgetDB.cpp | 7 +- .../WidgetInterfaceDAO/WidgetInterfaceDAO.cpp | 29 +- src/modules/tizen/config.cmake | 3 + src/standards/CMakeLists.txt | 19 + src/standards/W3C/CMakeLists.txt | 15 + src/standards/W3C/DESCRIPTION | 2 + .../W3C/Widget/AddEventListenerSupport.cpp | 142 ++ src/standards/W3C/Widget/AddEventListenerSupport.h | 76 + src/standards/W3C/Widget/CMakeLists.txt | 56 + src/standards/W3C/Widget/IFrameSupport.cpp | 83 ++ src/standards/W3C/Widget/IFrameSupport.h | 71 + src/standards/W3C/Widget/JSPreferences.cpp | 566 ++++++++ src/standards/W3C/Widget/JSPreferences.h | 129 ++ src/standards/W3C/Widget/JSStorageEvent.cpp | 278 ++++ src/standards/W3C/Widget/JSStorageEvent.h | 108 ++ src/standards/W3C/Widget/JSTest.cpp | 149 ++ src/standards/W3C/Widget/JSTest.h | 71 + src/standards/W3C/Widget/JSWidget.cpp | 538 +++++++ src/standards/W3C/Widget/JSWidget.h | 131 ++ src/standards/W3C/Widget/Test.cpp | 127 ++ src/standards/W3C/Widget/Test.h | 66 + src/standards/W3C/Widget/config.xml | 24 + src/standards/W3C/Widget/plugin_initializer.cpp | 125 ++ src/standards/standard-features-list | 1 + tests/CMakeLists.txt | 74 - tests/main.cpp | 43 - tests/test_widget_interface_dao.cpp | 289 ---- tests/wrt_plugins_commons_test_prepare_db.sh | 38 - 488 files changed, 3540 insertions(+), 42746 deletions(-) create mode 100644 config.dtd mode change 100755 => 100644 debian/wrt-plugins-common.postinst.in create mode 100644 packaging/wrt-plugins-common.spec delete mode 100644 pkgconfigs/wrt-plugins-accelerometer.pc.in delete mode 100644 pkgconfigs/wrt-plugins-calendar.pc.in delete mode 100644 pkgconfigs/wrt-plugins-camera.pc.in delete mode 100644 pkgconfigs/wrt-plugins-contact.pc.in delete mode 100644 pkgconfigs/wrt-plugins-haptics.pc.in delete mode 100644 pkgconfigs/wrt-plugins-localstorage.pc.in delete mode 100644 pkgconfigs/wrt-plugins-messaging.pc.in delete mode 100644 pkgconfigs/wrt-plugins-orientation.pc.in delete mode 100644 pkgconfigs/wrt-plugins-power.pc.in delete mode 100644 pkgconfigs/wrt-plugins-profile.pc.in delete mode 100644 pkgconfigs/wrt-plugins-radio.pc.in delete mode 100644 pkgconfigs/wrt-plugins-storageevent.pc.in delete mode 100644 pkgconfigs/wrt-plugins-systeminfo.pc.in delete mode 100644 pkgconfigs/wrt-plugins-task.pc.in rename pkgconfigs/{wrt-plugins-widget_interface_dao.pc.in => wrt-plugins-widget-interface-dao.pc.in} (65%) delete mode 100644 pkgconfigs/wrt-plugins-widget.pc.in delete mode 100644 src/Commons/WidgetConfiguration/ConfigurationSupport.h delete mode 100644 src/Commons/WidgetConfiguration/WidgetConfiguration.cpp delete mode 100644 src/Commons/WidgetConfiguration/WidgetConfiguration.h delete mode 100644 src/Commons/WidgetConfiguration/config.cmake rename src/Commons/{WrtWrapper/WrtWrapper.cpp => WrtAccess/WrtAccess.cpp} (86%) rename src/Commons/{WrtWrapper/WrtCameraManager.h => WrtAccess/WrtAccess.h} (63%) create mode 100644 src/Commons/WrtAccess/config.cmake delete mode 100644 src/Commons/WrtWrapper/IWrtCamera.h delete mode 100644 src/Commons/WrtWrapper/IWrtCameraManager.h delete mode 100644 src/Commons/WrtWrapper/IWrtWrapper.h delete mode 100644 src/Commons/WrtWrapper/WrtCamera.cpp delete mode 100644 src/Commons/WrtWrapper/WrtCamera.h delete mode 100644 src/Commons/WrtWrapper/WrtCameraManager.cpp delete mode 100644 src/Commons/WrtWrapper/WrtWrapper.h delete mode 100644 src/Commons/WrtWrapper/WrtWrappersMgr.cpp delete mode 100644 src/Commons/WrtWrapper/WrtWrappersMgr.h delete mode 100644 src/Commons/WrtWrapper/config.cmake delete mode 100644 src/modules/API/Accelerometer/AccelerationProperties.h delete mode 100644 src/modules/API/Accelerometer/AccelerometerFactory.cpp delete mode 100644 src/modules/API/Accelerometer/AccelerometerFactory.h delete mode 100644 src/modules/API/Accelerometer/EventAccelerationChanged.h delete mode 100644 src/modules/API/Accelerometer/EventGetCurrentAcceleration.h delete mode 100644 src/modules/API/Accelerometer/IAccelerometer.cpp delete mode 100644 src/modules/API/Accelerometer/IAccelerometer.h delete mode 100644 src/modules/API/Accelerometer/ISensor.cpp delete mode 100644 src/modules/API/Accelerometer/ISensor.h delete mode 100644 src/modules/API/Accelerometer/config.cmake delete mode 100644 src/modules/API/Calendar/CalendarEvent.cpp delete mode 100644 src/modules/API/Calendar/CalendarEvent.h delete mode 100644 src/modules/API/Calendar/CalendarFactory.cpp delete mode 100644 src/modules/API/Calendar/CalendarFactory.h delete mode 100644 src/modules/API/Calendar/EventAddEvent.h delete mode 100644 src/modules/API/Calendar/EventCreateEvent.h delete mode 100644 src/modules/API/Calendar/EventDeleteEvent.h delete mode 100644 src/modules/API/Calendar/EventFilter.cpp delete mode 100644 src/modules/API/Calendar/EventFilter.h delete mode 100644 src/modules/API/Calendar/EventFindEvents.h delete mode 100644 src/modules/API/Calendar/EventGetCalendars.h delete mode 100644 src/modules/API/Calendar/EventUpdateEvent.h delete mode 100644 src/modules/API/Calendar/ICalendar.cpp delete mode 100644 src/modules/API/Calendar/ICalendar.h delete mode 100644 src/modules/API/Calendar/ICalendarManager.cpp delete mode 100644 src/modules/API/Calendar/ICalendarManager.h delete mode 100644 src/modules/API/Calendar/config.cmake delete mode 100644 src/modules/API/Camera/CameraFactory.cpp delete mode 100644 src/modules/API/Camera/CameraFactory.h delete mode 100644 src/modules/API/Camera/EventBeginRecording.h delete mode 100644 src/modules/API/Camera/EventEndRecording.h delete mode 100644 src/modules/API/Camera/EventGetCameras.h delete mode 100644 src/modules/API/Camera/EventGetPreviewNode.h delete mode 100644 src/modules/API/Camera/EventTakePicture.h delete mode 100644 src/modules/API/Camera/ICamera.h delete mode 100644 src/modules/API/Camera/ICameraFeature.h delete mode 100644 src/modules/API/Camera/ICameraManager.h delete mode 100644 src/modules/API/Camera/ICaptureOptions.h delete mode 100644 src/modules/API/Camera/IFeatureValue.h delete mode 100644 src/modules/API/Camera/SupportCameraPendingOperation.h delete mode 100644 src/modules/API/Camera/config.cmake delete mode 100644 src/modules/API/Contact/Contact.cpp delete mode 100644 src/modules/API/Contact/Contact.h delete mode 100644 src/modules/API/Contact/ContactAddress.cpp delete mode 100644 src/modules/API/Contact/ContactAddress.h delete mode 100644 src/modules/API/Contact/ContactEmail.cpp delete mode 100644 src/modules/API/Contact/ContactEmail.h delete mode 100644 src/modules/API/Contact/ContactFactory.cpp delete mode 100644 src/modules/API/Contact/ContactFactory.h delete mode 100644 src/modules/API/Contact/ContactFilter.cpp delete mode 100644 src/modules/API/Contact/ContactFilter.h delete mode 100644 src/modules/API/Contact/ContactPhoneNumber.cpp delete mode 100644 src/modules/API/Contact/ContactPhoneNumber.h delete mode 100644 src/modules/API/Contact/EventAddContact.h delete mode 100644 src/modules/API/Contact/EventAddGroup.h delete mode 100644 src/modules/API/Contact/EventDeleteContact.h delete mode 100644 src/modules/API/Contact/EventDeleteGroup.h delete mode 100644 src/modules/API/Contact/EventExportVCard.h delete mode 100644 src/modules/API/Contact/EventFindContacts.h delete mode 100644 src/modules/API/Contact/EventFindGroup.h delete mode 100644 src/modules/API/Contact/EventGetAddressBookItemCount.h delete mode 100644 src/modules/API/Contact/EventGetAddressBooks.h delete mode 100644 src/modules/API/Contact/EventGetOwnerInfo.h delete mode 100644 src/modules/API/Contact/EventUpdateContact.h delete mode 100644 src/modules/API/Contact/IAddressBook.cpp delete mode 100644 src/modules/API/Contact/IAddressBook.h delete mode 100644 src/modules/API/Contact/IContactEventPrivateData.h delete mode 100644 src/modules/API/Contact/IContactManager.cpp delete mode 100644 src/modules/API/Contact/IContactManager.h delete mode 100644 src/modules/API/Contact/config.cmake delete mode 100644 src/modules/API/Haptics/EventPlayBeep.h delete mode 100644 src/modules/API/Haptics/EventStartMotor.h delete mode 100644 src/modules/API/Haptics/HapticPattern.cpp delete mode 100644 src/modules/API/Haptics/HapticPattern.h delete mode 100644 src/modules/API/Haptics/IManager.cpp delete mode 100644 src/modules/API/Haptics/IManager.h delete mode 100644 src/modules/API/Haptics/IMotor.cpp delete mode 100644 src/modules/API/Haptics/IMotor.h delete mode 100644 src/modules/API/Haptics/Types.h delete mode 100644 src/modules/API/Haptics/config.cmake delete mode 100644 src/modules/API/Messaging/AttachmentFactory.cpp delete mode 100644 src/modules/API/Messaging/AttachmentFactory.h delete mode 100644 src/modules/API/Messaging/Attachments.cpp delete mode 100644 src/modules/API/Messaging/Attachments.h delete mode 100644 src/modules/API/Messaging/BccRecipient.cpp delete mode 100644 src/modules/API/Messaging/BccRecipient.h delete mode 100644 src/modules/API/Messaging/Body.cpp delete mode 100644 src/modules/API/Messaging/Body.h delete mode 100644 src/modules/API/Messaging/CallbackNumber.cpp delete mode 100644 src/modules/API/Messaging/CallbackNumber.h delete mode 100644 src/modules/API/Messaging/CcRecipient.cpp delete mode 100644 src/modules/API/Messaging/CcRecipient.h delete mode 100644 src/modules/API/Messaging/EmailAccountInfo.cpp delete mode 100644 src/modules/API/Messaging/EmailAccountInfo.h delete mode 100644 src/modules/API/Messaging/EmitterMessageReceived.cpp delete mode 100644 src/modules/API/Messaging/EmitterMessageReceived.h delete mode 100644 src/modules/API/Messaging/EventDeleteMessage.h delete mode 100644 src/modules/API/Messaging/EventFindMessage.h delete mode 100644 src/modules/API/Messaging/EventMessageReceived.cpp delete mode 100644 src/modules/API/Messaging/EventMessageReceived.h delete mode 100644 src/modules/API/Messaging/EventOnSendingFailed.h delete mode 100644 src/modules/API/Messaging/EventSendMessage.h delete mode 100644 src/modules/API/Messaging/EventUpdateMessage.h delete mode 100644 src/modules/API/Messaging/From.cpp delete mode 100644 src/modules/API/Messaging/From.h delete mode 100644 src/modules/API/Messaging/IAttachment.cpp delete mode 100644 src/modules/API/Messaging/IAttachment.h delete mode 100644 src/modules/API/Messaging/IBinarySms.cpp delete mode 100644 src/modules/API/Messaging/IBinarySms.h delete mode 100644 src/modules/API/Messaging/IEmail.cpp delete mode 100644 src/modules/API/Messaging/IEmail.h delete mode 100644 src/modules/API/Messaging/IEmailAccount.cpp delete mode 100644 src/modules/API/Messaging/IEmailAccount.h delete mode 100644 src/modules/API/Messaging/IMessage.cpp delete mode 100644 src/modules/API/Messaging/IMessage.h delete mode 100644 src/modules/API/Messaging/IMessaging.cpp delete mode 100644 src/modules/API/Messaging/IMessaging.h delete mode 100644 src/modules/API/Messaging/IMessagingTypes.h delete mode 100644 src/modules/API/Messaging/IMms.cpp delete mode 100644 src/modules/API/Messaging/IMms.h delete mode 100644 src/modules/API/Messaging/IMmsSlide.h delete mode 100644 src/modules/API/Messaging/IMmsSlideProperties.h delete mode 100644 src/modules/API/Messaging/IMmsSlides.h delete mode 100644 src/modules/API/Messaging/ISms.cpp delete mode 100644 src/modules/API/Messaging/ISms.h delete mode 100644 src/modules/API/Messaging/MessageEventPrivateData.h delete mode 100644 src/modules/API/Messaging/MessageFactory.cpp delete mode 100644 src/modules/API/Messaging/MessageFactory.h delete mode 100644 src/modules/API/Messaging/MessageFilter.cpp delete mode 100644 src/modules/API/Messaging/MessageFilter.h delete mode 100644 src/modules/API/Messaging/MessagePriority.cpp delete mode 100644 src/modules/API/Messaging/MessagePriority.h delete mode 100644 src/modules/API/Messaging/MmsSlide.cpp delete mode 100644 src/modules/API/Messaging/MmsSlide.h delete mode 100644 src/modules/API/Messaging/MmsSlideProperty.cpp delete mode 100644 src/modules/API/Messaging/MmsSlideProperty.h delete mode 100644 src/modules/API/Messaging/MmsSlides.cpp delete mode 100644 src/modules/API/Messaging/MmsSlides.h delete mode 100644 src/modules/API/Messaging/Recipient.cpp delete mode 100644 src/modules/API/Messaging/Recipient.h delete mode 100644 src/modules/API/Messaging/ReqReceiverMessage.cpp delete mode 100644 src/modules/API/Messaging/ReqReceiverMessage.h delete mode 100644 src/modules/API/Messaging/SourceAddress.cpp delete mode 100644 src/modules/API/Messaging/SourceAddress.h delete mode 100644 src/modules/API/Messaging/Subject.cpp delete mode 100644 src/modules/API/Messaging/Subject.h delete mode 100644 src/modules/API/Messaging/ToRecipient.cpp delete mode 100644 src/modules/API/Messaging/ToRecipient.h delete mode 100644 src/modules/API/Messaging/ValidityPeriodHours.cpp delete mode 100644 src/modules/API/Messaging/ValidityPeriodHours.h delete mode 100644 src/modules/API/Messaging/VirtualMessage.cpp delete mode 100644 src/modules/API/Messaging/VirtualMessage.h delete mode 100644 src/modules/API/Messaging/config.cmake delete mode 100644 src/modules/API/Orientation/EventGetCurrentOrientation.h delete mode 100644 src/modules/API/Orientation/EventOrientationChanged.h delete mode 100644 src/modules/API/Orientation/IOrientation.cpp delete mode 100644 src/modules/API/Orientation/IOrientation.h delete mode 100644 src/modules/API/Orientation/OrientationFactory.cpp delete mode 100644 src/modules/API/Orientation/OrientationFactory.h delete mode 100644 src/modules/API/Orientation/OrientationProperties.h delete mode 100644 src/modules/API/Orientation/config.cmake delete mode 100644 src/modules/API/Power/Enums.h delete mode 100644 src/modules/API/Power/EventCharging.cpp delete mode 100644 src/modules/API/Power/EventCharging.h delete mode 100644 src/modules/API/Power/EventLight.h delete mode 100644 src/modules/API/Power/EventLow.cpp delete mode 100644 src/modules/API/Power/EventLow.h delete mode 100644 src/modules/API/Power/EventRemaining.cpp delete mode 100644 src/modules/API/Power/EventRemaining.h delete mode 100644 src/modules/API/Power/IBacklight.cpp delete mode 100644 src/modules/API/Power/IBacklight.h delete mode 100644 src/modules/API/Power/IBattery.cpp delete mode 100644 src/modules/API/Power/IBattery.h delete mode 100644 src/modules/API/Power/IManager.cpp delete mode 100644 src/modules/API/Power/IManager.h delete mode 100644 src/modules/API/Power/config.cmake delete mode 100644 src/modules/API/Profile/Enums.h delete mode 100644 src/modules/API/Profile/EventSetWallpaper.h delete mode 100644 src/modules/API/Profile/IDesktop.cpp delete mode 100644 src/modules/API/Profile/IDesktop.h delete mode 100644 src/modules/API/Profile/IManager.cpp delete mode 100644 src/modules/API/Profile/IManager.h delete mode 100644 src/modules/API/Profile/IRingtone.cpp delete mode 100644 src/modules/API/Profile/IRingtone.h delete mode 100644 src/modules/API/Profile/Types.h delete mode 100644 src/modules/API/Profile/config.cmake delete mode 100644 src/modules/API/Radio/Enums.h delete mode 100644 src/modules/API/Radio/EventSourceTypeChange.cpp delete mode 100644 src/modules/API/Radio/EventSourceTypeChange.h delete mode 100644 src/modules/API/Radio/IManager.cpp delete mode 100644 src/modules/API/Radio/IManager.h delete mode 100644 src/modules/API/Radio/ISource.cpp delete mode 100644 src/modules/API/Radio/ISource.h delete mode 100644 src/modules/API/Radio/Types.h delete mode 100644 src/modules/API/Radio/config.cmake delete mode 100644 src/modules/API/SystemInfo/ISystemInfo.cpp delete mode 100644 src/modules/API/SystemInfo/ISystemInfo.h delete mode 100644 src/modules/API/SystemInfo/config.cmake delete mode 100644 src/modules/API/Task/CalendarTask.cpp delete mode 100644 src/modules/API/Task/CalendarTask.h delete mode 100644 src/modules/API/Task/IEventAddTask.h delete mode 100644 src/modules/API/Task/IEventCreateTask.h delete mode 100644 src/modules/API/Task/IEventDeleteTask.h delete mode 100644 src/modules/API/Task/IEventFindTasks.h delete mode 100644 src/modules/API/Task/IEventGetTasks.h delete mode 100644 src/modules/API/Task/IEventUpdateTask.h delete mode 100644 src/modules/API/Task/ITask.cpp delete mode 100644 src/modules/API/Task/ITask.h delete mode 100644 src/modules/API/Task/ITaskManager.cpp delete mode 100644 src/modules/API/Task/ITaskManager.h delete mode 100644 src/modules/API/Task/TaskFactory.cpp delete mode 100644 src/modules/API/Task/TaskFactory.h delete mode 100644 src/modules/API/Task/TaskFilter.cpp delete mode 100644 src/modules/API/Task/TaskFilter.h delete mode 100644 src/modules/API/Task/config.cmake create mode 100644 src/modules/API/config.cmake delete mode 100644 src/modules/packages/Accelerometer/CMakeLists.txt delete mode 100644 src/modules/packages/Calendar/CMakeLists.txt delete mode 100644 src/modules/packages/Camera/CMakeLists.txt delete mode 100644 src/modules/packages/Contact/CMakeLists.txt delete mode 100644 src/modules/packages/Haptics/CMakeLists.txt delete mode 100644 src/modules/packages/Messaging/CMakeLists.txt delete mode 100644 src/modules/packages/Orientation/CMakeLists.txt delete mode 100644 src/modules/packages/Power/CMakeLists.txt delete mode 100644 src/modules/packages/Profile/CMakeLists.txt delete mode 100644 src/modules/packages/Radio/CMakeLists.txt delete mode 100644 src/modules/packages/SystemInfo/CMakeLists.txt delete mode 100644 src/modules/packages/Task/CMakeLists.txt delete mode 100644 src/modules/tizen/Accelerometer/Accelerometer.cpp delete mode 100644 src/modules/tizen/Accelerometer/Accelerometer.h delete mode 100644 src/modules/tizen/Accelerometer/Sensor.cpp delete mode 100644 src/modules/tizen/Accelerometer/Sensor.h delete mode 100644 src/modules/tizen/Accelerometer/config.cmake delete mode 100644 src/modules/tizen/Calendar/Calendar.cpp delete mode 100644 src/modules/tizen/Calendar/Calendar.h delete mode 100644 src/modules/tizen/Calendar/CalendarManager.cpp delete mode 100644 src/modules/tizen/Calendar/CalendarManager.h delete mode 100644 src/modules/tizen/Calendar/EventWrapper.cpp delete mode 100644 src/modules/tizen/Calendar/EventWrapper.h delete mode 100644 src/modules/tizen/Calendar/config.cmake delete mode 100644 src/modules/tizen/Camera-Webkit/Camera.cpp delete mode 100644 src/modules/tizen/Camera-Webkit/Camera.h delete mode 100644 src/modules/tizen/Camera-Webkit/CameraManager.cpp delete mode 100644 src/modules/tizen/Camera-Webkit/CameraManager.h delete mode 100644 src/modules/tizen/Camera-Webkit/config.cmake delete mode 100644 src/modules/tizen/Contact/AddressBook.cpp delete mode 100644 src/modules/tizen/Contact/AddressBook.h delete mode 100644 src/modules/tizen/Contact/ContactManager.cpp delete mode 100644 src/modules/tizen/Contact/ContactManager.h delete mode 100755 src/modules/tizen/Contact/ContactWrapper.cpp delete mode 100644 src/modules/tizen/Contact/ContactWrapper.h delete mode 100644 src/modules/tizen/Contact/config.cmake delete mode 100644 src/modules/tizen/DBus/Connection.cpp delete mode 100644 src/modules/tizen/DBus/Connection.h delete mode 100644 src/modules/tizen/DBus/Message.cpp delete mode 100644 src/modules/tizen/DBus/Message.h delete mode 100644 src/modules/tizen/DBus/MessageEvent.h delete mode 100644 src/modules/tizen/DBus/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h delete mode 100644 src/modules/tizen/DEPRACATED/AppLauncher/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Camera/AttributeInfo.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Camera/AttributeInfo.h delete mode 100644 src/modules/tizen/DEPRACATED/Camera/Camera.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Camera/Camera.h delete mode 100644 src/modules/tizen/DEPRACATED/Camera/CameraManager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Camera/CameraManager.h delete mode 100644 src/modules/tizen/DEPRACATED/Camera/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Device/Manager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Device/Manager.h delete mode 100644 src/modules/tizen/DEPRACATED/Device/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Display/Manager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Display/Manager.h delete mode 100644 src/modules/tizen/DEPRACATED/Display/Screen.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Display/Screen.h delete mode 100644 src/modules/tizen/DEPRACATED/Display/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h delete mode 100644 src/modules/tizen/DEPRACATED/FeatureLoader/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Gallery/Gallery.h delete mode 100644 src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h delete mode 100644 src/modules/tizen/DEPRACATED/Gallery/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h delete mode 100644 src/modules/tizen/DEPRACATED/Geolocation/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Memory/Manager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Memory/Manager.h delete mode 100644 src/modules/tizen/DEPRACATED/Memory/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/System/Date.cpp delete mode 100644 src/modules/tizen/DEPRACATED/System/Date.h delete mode 100644 src/modules/tizen/DEPRACATED/System/Environment.cpp delete mode 100644 src/modules/tizen/DEPRACATED/System/Environment.h delete mode 100644 src/modules/tizen/DEPRACATED/System/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h delete mode 100644 src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp delete mode 100644 src/modules/tizen/DEPRACATED/Telephony/LogManager.h delete mode 100644 src/modules/tizen/DEPRACATED/Telephony/config.cmake delete mode 100644 src/modules/tizen/DEPRACATED/UI/config.cmake delete mode 100644 src/modules/tizen/Haptics/Manager.cpp delete mode 100644 src/modules/tizen/Haptics/Manager.h delete mode 100644 src/modules/tizen/Haptics/Motor.cpp delete mode 100644 src/modules/tizen/Haptics/Motor.h delete mode 100644 src/modules/tizen/Haptics/config.cmake delete mode 100644 src/modules/tizen/Messaging/Attachment.cpp delete mode 100644 src/modules/tizen/Messaging/Attachment.h delete mode 100644 src/modules/tizen/Messaging/BinarySms.cpp delete mode 100644 src/modules/tizen/Messaging/BinarySms.h delete mode 100644 src/modules/tizen/Messaging/CallbackMgr.cpp delete mode 100644 src/modules/tizen/Messaging/CallbackMgr.h delete mode 100755 src/modules/tizen/Messaging/Email.cpp delete mode 100644 src/modules/tizen/Messaging/Email.h delete mode 100644 src/modules/tizen/Messaging/EmailConverter.cpp delete mode 100644 src/modules/tizen/Messaging/EmailConverter.h delete mode 100644 src/modules/tizen/Messaging/EmailService.cpp delete mode 100644 src/modules/tizen/Messaging/EmailService.h delete mode 100644 src/modules/tizen/Messaging/EmailUtils.cpp delete mode 100644 src/modules/tizen/Messaging/EmailUtils.h delete mode 100644 src/modules/tizen/Messaging/ISendingObserver.h delete mode 100644 src/modules/tizen/Messaging/MailNotifier.cpp delete mode 100644 src/modules/tizen/Messaging/MailNotifier.h delete mode 100644 src/modules/tizen/Messaging/MailSender.cpp delete mode 100644 src/modules/tizen/Messaging/MailSender.h delete mode 100644 src/modules/tizen/Messaging/Messaging.cpp delete mode 100644 src/modules/tizen/Messaging/Messaging.h delete mode 100644 src/modules/tizen/Messaging/Mms.cpp delete mode 100644 src/modules/tizen/Messaging/Mms.h delete mode 100644 src/modules/tizen/Messaging/MmsSlide.cpp delete mode 100644 src/modules/tizen/Messaging/MmsSlide.h delete mode 100644 src/modules/tizen/Messaging/MsgServiceHandleMgr.cpp delete mode 100644 src/modules/tizen/Messaging/MsgServiceHandleMgr.h delete mode 100644 src/modules/tizen/Messaging/NetworkStatus.cpp delete mode 100644 src/modules/tizen/Messaging/NetworkStatus.h delete mode 100644 src/modules/tizen/Messaging/ScopedMail.h delete mode 100644 src/modules/tizen/Messaging/ScopedMailbox.h delete mode 100644 src/modules/tizen/Messaging/Sms.cpp delete mode 100644 src/modules/tizen/Messaging/Sms.h delete mode 100644 src/modules/tizen/Messaging/StorageChangeMessage.cpp delete mode 100644 src/modules/tizen/Messaging/StorageChangeMessage.h delete mode 100644 src/modules/tizen/Messaging/config.cmake delete mode 100644 src/modules/tizen/Orientation/Orientation.cpp delete mode 100644 src/modules/tizen/Orientation/Orientation.h delete mode 100644 src/modules/tizen/Orientation/config.cmake delete mode 100644 src/modules/tizen/Power/Backlight.cpp delete mode 100644 src/modules/tizen/Power/Backlight.h delete mode 100644 src/modules/tizen/Power/Battery.cpp delete mode 100644 src/modules/tizen/Power/Battery.h delete mode 100644 src/modules/tizen/Power/Manager.cpp delete mode 100644 src/modules/tizen/Power/Manager.h delete mode 100644 src/modules/tizen/Power/config.cmake delete mode 100644 src/modules/tizen/Profile/Desktop.cpp delete mode 100644 src/modules/tizen/Profile/Desktop.h delete mode 100644 src/modules/tizen/Profile/Manager.cpp delete mode 100644 src/modules/tizen/Profile/Manager.h delete mode 100644 src/modules/tizen/Profile/Ringtone.cpp delete mode 100644 src/modules/tizen/Profile/Ringtone.h delete mode 100644 src/modules/tizen/Profile/config.cmake delete mode 100644 src/modules/tizen/Radio/Manager.cpp delete mode 100644 src/modules/tizen/Radio/Manager.h delete mode 100644 src/modules/tizen/Radio/Source.cpp delete mode 100644 src/modules/tizen/Radio/Source.h delete mode 100644 src/modules/tizen/Radio/config.cmake delete mode 100755 src/modules/tizen/SystemInfo/SystemInfo.cpp delete mode 100644 src/modules/tizen/SystemInfo/SystemInfo.h delete mode 100644 src/modules/tizen/SystemInfo/config.cmake delete mode 100644 src/modules/tizen/Task/Task.cpp delete mode 100644 src/modules/tizen/Task/Task.h delete mode 100644 src/modules/tizen/Task/TaskManager.cpp delete mode 100644 src/modules/tizen/Task/TaskManager.h delete mode 100644 src/modules/tizen/Task/TaskWrapper.cpp delete mode 100644 src/modules/tizen/Task/TaskWrapper.h delete mode 100644 src/modules/tizen/Task/config.cmake delete mode 100644 src/modules/tizen/VConf/Key.cpp delete mode 100644 src/modules/tizen/VConf/Key.h delete mode 100644 src/modules/tizen/VConf/Node.cpp delete mode 100644 src/modules/tizen/VConf/Node.h delete mode 100644 src/modules/tizen/VConf/config.cmake mode change 100755 => 100644 src/modules/tizen/WidgetDB/WidgetDB.cpp create mode 100644 src/modules/tizen/config.cmake create mode 100644 src/standards/CMakeLists.txt create mode 100644 src/standards/W3C/CMakeLists.txt create mode 100644 src/standards/W3C/DESCRIPTION create mode 100644 src/standards/W3C/Widget/AddEventListenerSupport.cpp create mode 100644 src/standards/W3C/Widget/AddEventListenerSupport.h create mode 100755 src/standards/W3C/Widget/CMakeLists.txt create mode 100644 src/standards/W3C/Widget/IFrameSupport.cpp create mode 100644 src/standards/W3C/Widget/IFrameSupport.h create mode 100644 src/standards/W3C/Widget/JSPreferences.cpp create mode 100644 src/standards/W3C/Widget/JSPreferences.h create mode 100644 src/standards/W3C/Widget/JSStorageEvent.cpp create mode 100644 src/standards/W3C/Widget/JSStorageEvent.h create mode 100644 src/standards/W3C/Widget/JSTest.cpp create mode 100644 src/standards/W3C/Widget/JSTest.h create mode 100644 src/standards/W3C/Widget/JSWidget.cpp create mode 100644 src/standards/W3C/Widget/JSWidget.h create mode 100644 src/standards/W3C/Widget/Test.cpp create mode 100644 src/standards/W3C/Widget/Test.h create mode 100644 src/standards/W3C/Widget/config.xml create mode 100644 src/standards/W3C/Widget/plugin_initializer.cpp create mode 100644 src/standards/standard-features-list delete mode 100644 tests/CMakeLists.txt delete mode 100644 tests/main.cpp delete mode 100644 tests/test_widget_interface_dao.cpp delete mode 100755 tests/wrt_plugins_commons_test_prepare_db.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa4731..8217e67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,49 +14,25 @@ # cmake_minimum_required(VERSION 2.6) -IF("${CMAKE_PROJECT_NAME}" STREQUAL "") - SET(CMAKE_PROJECT_NAME wrt-plugins-common) -ENDIF("${CMAKE_PROJECT_NAME}" STREQUAL "") - +SET(CMAKE_PROJECT_NAME wrt-plugins-common) set(PACKAGE_NAME ${CMAKE_PROJECT_NAME}) - project(${CMAKE_PROJECT_NAME}) +STRING(REGEX MATCH "([^.]*)" CMAKE_PROJECT_API_VERSION "${CMAKE_PROJECT_VERSION}") ################################################################################ # Required platform modules include(FindPkgConfig) -pkg_search_module(dpl REQUIRED dpl-efl>=1.0.0) +pkg_search_module(dpl REQUIRED dpl-efl>=0.2.21) include_directories( ${dpl_INCLUDE_DIRS} ) - -# -# Logs -# -OPTION(DPL_LOG "DPL logs status" ON) - -IF(DPL_LOG) - MESSAGE(STATUS "Logging enabled for DPL") - ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") -ELSE(DPL_LOG) - MESSAGE(STATUS "Logging disabled for DPL") -ENDIF(DPL_LOG) - - -############################################################################### -# Set build type (Release by default) -IF("${CMAKE_BUILD_TYPE}" STREQUAL "") - SET(CMAKE_BUILD_TYPE Release) -ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") - -MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") - ############################################################################## # Compiler flags +SET(CMAKE_BUILD_TYPE Release) SET(CMAKE_C_FLAGS_PROFILING "-O0 -g -pg") SET(CMAKE_CXX_FLAGS_PROFILING "-O0 -std=c++0x -g -pg") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") @@ -65,15 +41,33 @@ SET(CMAKE_C_FLAGS_RELEASE "-O2 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g") #### +OPTION(DPL_LOG "DPL logs status" ON) +IF(DPL_LOG) + MESSAGE(STATUS "Logging enabled for DPL") + ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") +ELSE(DPL_LOG) + MESSAGE(STATUS "Logging disabled for DPL") +ENDIF(DPL_LOG) + ADD_DEFINITIONS("-fvisibility=default") # mark all exported symbols as visible +ADD_DEFINITIONS("-fPIC") # If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding ADD_DEFINITIONS("-DEXPORT_API=") ADD_DEFINITIONS("-Wall") -ADD_DEFINITIONS("-Werror") +#ADD_DEFINITIONS("-Werror") ADD_DEFINITIONS("-Wextra") ADD_DEFINITIONS("-Wno-deprecated") - -#disable default singleton implementation ADD_DEFINITIONS("-DSEPARATED_SINGLETON_IMPLEMENTATION") +#ADD_DEFINITIONS("-DW3C_TEST") +#ADD_DEFINITIONS("-DDEVPKG") + +############################################################################## +# CMake flags +IF (W3C_TEST) + SET(W3C_TEST "ON") +ENDIF(W3C_TEST) +IF (DEVPKG) + SET(DEVPKG "ON") +ENDIF(DEVPKG) ################################################################################ # Miscellaneous variables @@ -95,6 +89,13 @@ if (NOT DEFINED PLATFORM) endif () ################################################################################ +# Schema of plugin's configuration file + +set(COMMON_CONFIG_DTD ${CMAKE_CURRENT_SOURCE_DIR}/config.dtd) +set(COMMON_CONFIG_DTD_DST /usr/etc/wrt-plugins) +INSTALL(FILES ${COMMON_CONFIG_DTD} DESTINATION ${COMMON_CONFIG_DTD_DST}) + +################################################################################ # Macros used for including plugins from AL. @@ -107,7 +108,6 @@ endfunction() # Subdirectories add_subdirectory(src) -add_subdirectory(tests) ################################################################################ # PKGCONFIG @@ -123,24 +123,9 @@ endmacro(configure_and_install_pkg) configure_and_install_pkg(wrt-plugins-commons-javascript.pc) configure_and_install_pkg(wrt-plugins-commons.pc) configure_and_install_pkg(wrt-plugins-filesystem.pc) -configure_and_install_pkg(wrt-plugins-camera.pc) -configure_and_install_pkg(wrt-plugins-messaging.pc) -configure_and_install_pkg(wrt-plugins-calendar.pc) -configure_and_install_pkg(wrt-plugins-haptics.pc) -configure_and_install_pkg(wrt-plugins-contact.pc) configure_and_install_pkg(wrt-plugins-mmplayer.pc) -configure_and_install_pkg(wrt-plugins-widget.pc) configure_and_install_pkg(wrt-plugins-cpu.pc) -configure_and_install_pkg(wrt-plugins-accelerometer.pc) -configure_and_install_pkg(wrt-plugins-task.pc) -configure_and_install_pkg(wrt-plugins-orientation.pc) -configure_and_install_pkg(wrt-plugins-radio.pc) -configure_and_install_pkg(wrt-plugins-power.pc) -configure_and_install_pkg(wrt-plugins-profile.pc) -configure_and_install_pkg(wrt-plugins-localstorage.pc) -configure_and_install_pkg(wrt-plugins-systeminfo.pc) -configure_and_install_pkg(wrt-plugins-widget_interface_dao.pc) -configure_and_install_pkg(wrt-plugins-storageevent.pc) +configure_and_install_pkg(wrt-plugins-widget-interface-dao.pc) configure_and_install_pkg(wrt-plugins-widgetdb.pc) configure_and_install_pkg(wrt-plugins-plugin-manager.pc) @@ -156,3 +141,4 @@ set(CMAKE_CONFIG_FILE_NAME "${CMAKE_CONFIG_FILE_NAME}" CACHE # Summary message(STATUS "PLATFORM = ${PLATFORM}") +message(STATUS "W3C_TEST = ${W3C_TEST}") diff --git a/config.dtd b/config.dtd new file mode 100644 index 0000000..f1a1de4 --- /dev/null +++ b/config.dtd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/debian/changelog b/debian/changelog index 21b026d..67c2734 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,35 +1,394 @@ +wrt-plugins-common (0.3.27) unstable; urgency=low + + * Filesystem export API is changed. + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.27 + + -- Tae-Jeong Lee Fri, 16 Mar 2012 15:19:57 +0900 + +wrt-plugins-common (0.3.26) unstable; urgency=low + + * Invalid attributes fixed for file + * Localization data used for widget interface instead of database + * Fix closing DBus connection + * wrt-plugins-commons test removing + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.26 + + -- Jihoon Chung Wed, 14 Mar 2012 19:43:54 +0900 + +wrt-plugins-common (0.3.25) unstable; urgency=low + + * Support OBS, SMACK + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.25 + + -- Yunchan Cho Tue, 13 Mar 2012 20:04:24 +0900 + +wrt-plugins-common (0.3.24) unstable; urgency=low + + * Revert 'Loading w3c plugin by default turned off' + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.24 + + -- Hoseon LEE Sat, 10 Mar 2012 17:23:16 +0100 + +wrt-plugins-common (0.3.23) unstable; urgency=low + + * Loading w3c plugin by default turned off + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.23 + + -- Grzegorz Krawczyk Fri, 09 Feb 2012 17:23:16 +0100 + +wrt-plugins-common (0.3.22) unstable; urgency=low + + * Fixed problem with package installation + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.22 + + -- Grzegorz Krawczyk Mon, 05 Feb 2012 16:03:16 +0100 + +wrt-plugins-common (0.3.21) unstable; urgency=low + + * Debianized for 0.3.21 + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.21 + + -- Tae-Jeong Lee Mon, 05 Mar 2012 10:56:10 +0900 + +wrt-plugins-common (0.3.20) unstable; urgency=low + + * Adjust to changes in wrt-security + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.20 + + -- Grzegorz Krawczyk Tue, 28 Feb 2012 17:43:16 +0100 + +wrt-plugins-common (0.3.19) unstable; urgency=low + + * Adjust to changes in email-service API. + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.19 + + -- Zbigniew Kostrzewa Mon, 27 Feb 2012 09:23:46 +0100 + +wrt-plugins-common (0.3.18-1) unstable; urgency=low + + * Redebinized + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.18-1 + + -- Grzegorz Krawczyk Sat, 25 Feb 2012 11:06:51 +0100 + +wrt-plugins-common (0.3.18) unstable; urgency=low + + * Camera module turned on (try) + * Fixed package dependency + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.18 + + -- Grzegorz Krawczyk Sat, 25 Feb 2012 10:16:51 +0100 + +wrt-plugins-common (0.3.17) unstable; urgency=low + + * Camera module turned off + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.17 + + -- Grzegorz Krawczyk Fri, 24 Feb 2012 19:36:54 +0100 + +wrt-plugins-common (0.3.16) unstable; urgency=low + + * Messaging bugfix + * Camera: old implementation has been restored + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.16 + + -- Grzegorz Krawczyk Fri, 24 Feb 2012 18:56:54 +0100 + wrt-plugins-common (0.3.15) unstable; urgency=low - * Boilerplate update + * Messaging module adjusted to API change in msg-service - * Git : tizen2/pkgs/w/wrt-plugins-common + * Git : slp/pkgs/w/wrt-plugins-common * Tag : wrt-plugins-common_0.3.15 - -- Tae-Jeong Lee Thu, 23 Feb 2012 16:16:14 +0900 + -- Grzegorz Krawczyk Tue, 21 Feb 2012 18:26:14 +0100 wrt-plugins-common (0.3.14) unstable; urgency=low - * debianize + * WAC 2.0 Compliance - Messaging. - * Git : tizen2/pkgs/w/wrt-plugins-common + * Git : slp/pkgs/w/wrt-plugins-common * Tag : wrt-plugins-common_0.3.14 - -- Yunchan Cho Wed, 22 Feb 2012 17:06:07 +0900 + -- Zbigniew Kostrzewa Mon, 20 Feb 2012 14:24:09 +0100 wrt-plugins-common (0.3.13) unstable; urgency=low - * Updated wrt-plugins-common version + * Download agent API Change - * Git : tizen2/pkgs/w/wrt-plugins-common + * Git : slp/pkgs/w/wrt-plugins-common * Tag : wrt-plugins-common_0.3.13 - -- Hoseon LEE Wed, 22 Feb 2012 15:13:13 +0900 + -- Grzegorz Krawczyk Fri, 17 Feb 2012 16:26:14 +0100 wrt-plugins-common (0.3.12) unstable; urgency=low - * Init changelog + * Download agent API Change - * Git : tizen2/pkgs/w/wrt-plugins-common + * Git : slp/pkgs/w/wrt-plugins-common * Tag : wrt-plugins-common_0.3.12 -- Hoseon LEE Wed, 15 Feb 2012 17:56:14 +0900 + +wrt-plugins-common (0.3.11) unstable; urgency=low + + * change location of database file for widget interface + * Removing SLP, Bada ... strings for Source Open + * readAsText() API bug fix + * Update Threadpool + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.11 + + -- Jihoon Chung Tue, 14 Feb 2012 10:23:18 +0900 + +wrt-plugins-common (0.3.10-1) unstable; urgency=low + + * Debianize for Refactoring Phase2 + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.10-1 + + -- Jihoon Chung Thu, 02 Feb 2012 16:24:20 +0900 + +wrt-plugins-common (0.3.10) unstable; urgency=low + + * Debianize for Refactoring Phase2 + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.10 + + -- Jihoon Chung Tue, 31 Jan 2012 13:40:17 +0900 + +wrt-plugins-common (0.3.9-1) unstable; urgency=low + + * Redebianized due to problem with repository + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.9-1 + + -- Grzegorz Krawczyk Wed, 25 Jan 2012 17:05:05 +0100 + +wrt-plugins-common (0.3.9) unstable; urgency=low + + * Fix bug with plugin unloading + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.9 + + -- Grzegorz Krawczyk Wed, 25 Jan 2012 15:38:19 +0100 + +wrt-plugins-common (0.3.8) unstable; urgency=low + + * Debianize latest source + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.8 + + -- Yunchan Cho Wed, 25 Jan 2012 10:39:09 +0900 + +wrt-plugins-common (0.3.7) unstable; urgency=low + + * Repository adopted to new wrt-commons + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.7 + + -- Grzegorz Krawczyk Fri, 20 Jan 2012 16:34:19 +0100 + +wrt-plugins-common (0.3.6-1) unstable; urgency=low + + * (Redebianized) Modified usage of Ace Thin Client + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.6-1 + + -- Grzegorz Krawczyk Thu, 19 Jan 2012 14:44:39 +0100 + +wrt-plugins-common (0.3.6) unstable; urgency=low + + * Modified usage of Ace Thin Client + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.6 + + -- Grzegorz Krawczyk Thu, 19 Jan 2012 14:34:29 +0100 + +wrt-plugins-common (0.3.5) unstable; urgency=low + + * Webkit2(Refactoring) branch merged + + * Git : slp/pkgs/w/wrt-plugins-common + * Tag : wrt-plugins-common_0.3.5 + + -- Jihoon Chung Mon, 16 Jan 2012 16:21:49 +0900 + +wrt-plugins-common (0.3.4) unstable; urgency=low + + * Plugin Manager class implemented. + + * Git : slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.3.4 + + -- Grzegorz Krawczyk Wed, 03 Jan 2011 15:27:19 +0100 + +wrt-plugins-common (0.3.3) unstable; urgency=low + + * Module names cleaned up. Removed old 'deviceapis' and 'commons' names. + + * Git : slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.3.3 + + -- Grzegorz Krawczyk Fri, 23 Dec 2011 13:17:19 +0100 + +wrt-plugins-common (0.3.2) unstable; urgency=low + + * Access to WidgetDB modified + + * Git : slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.3.2 + + -- Grzegorz Krawczyk Thu, 22 Dec 2011 15:04:17 +0100 + +wrt-plugins-common (0.3.1) unstable; urgency=low + + * Installation path for commons modules modified to /usr/lib + + * Git : slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.3.1 + + -- Grzegorz Krawczyk Mon, 19 Dec 2011 14:04:17 +0100 + +wrt-plugins-common (0.3.0) unstable; urgency=low + + * Debianize 0.3.0 for Webkit2 branch + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.3.0 + + -- Grzegorz Krawczyk Thu, 15 Dec 2011 16:28:32 +0100 + +wrt-plugins-common (0.2.2) unstable; urgency=low + + * Calendar module fixes + + * Git : slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.2.2 + + -- Yunchan Cho Tue, 20 Dec 2011 10:54:23 +0900 + +wrt-plugins-common (0.2.1) unstable; urgency=low + + * Apply changed notification macros of email-service + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.2.1 + + -- Yunchan Cho Thu, 15 Dec 2011 15:21:51 +0900 + +wrt-plugins-common (0.2.0) unstable; urgency=low + + * Debianize 0.2.0 + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-plugins-common_0.2.0 + + -- Taejeong Lee Thu, 08 Dec 2011 12:54:32 +0900 + +wrt-plugins-common (0.1.10) unstable; urgency=low + + * Debianize 0.1.10 + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.10 + + -- Taejeong Lee Fri, 02 Dec 2011 16:06:35 +0900 + +wrt-deviceapis-commons (0.1.9) unstable; urgency=low + + * Debianize for connection manager. + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.9 + + -- Taejeong Lee Tue, 29 Nov 2011 14:05:32 +0900 + +wrt-deviceapis-commons (0.1.8) unstable; urgency=low + + * Fixed problem with assignment operator + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.8 + + -- Grzegorz Krawczyk Wed, 23 Nov 2011 17:38:22 +0100 + +wrt-deviceapis-commons (0.1.7) unstable; urgency=low + + * Debianized for SDK release. + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.7 + + -- taejeong.lee Wed, 23 Nov 2011 21:27:15 +0900 + +wrt-deviceapis-commons (0.1.6) unstable; urgency=low + + * change slp.h to tizen.h + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.6 + + -- Jaehyun Park Wed, 23 Nov 2011 19:17:27 +0900 + +wrt-deviceapis-commons (0.1.5) unstable; urgency=low + + * Fixed emmiters behaviour + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.5 + + -- Grzegorz Krawczyk Mon, 21 Nov 2011 14:31:32 +0100 + +wrt-deviceapis-commons (0.1.4) unstable; urgency=low + + * Fix segmentation fault when msg-service returns NULL body + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.4 + + -- Grzegorz Krawczyk Thu, 10 Nov 2011 11:11:17 +0100 + +wrt-deviceapis-commons (0.1.3) unstable; urgency=low + + * Upload to package repository + + * Git : 165.213.180.234:slp/pkgs/w/wrt-plugins-commons + * Tag : wrt-deviceapis-commons_0.1.3 + + -- Grzegorz Krawczyk Tue, 08 Nov 2011 10:21:19 +0100 diff --git a/debian/control b/debian/control index 903278c..623731a 100644 --- a/debian/control +++ b/debian/control @@ -2,19 +2,19 @@ Source: wrt-plugins-common Section: devel Priority: extra Maintainer: Piotr Fatyga , Grzegorz Krawczyk , Zbigniew Kostrzewa , Taehee Lee -Build-Depends: debhelper (>= 5), wrt-dev (>=0.8.6), libwebkit-engine-dev, wrt-commons-dev (>=0.2.6), libmm-player-dev, libmm-sound-dev, libpcre-dev, libdbus-1-dev, libslp-sensor-dev, email-service-dev, libslp-msg-service-dev (>=0.5.0), libslp-calendar-dev, libglib2.0-dev, capi-telephony-network-info-dev, libdevman-dev, libcontacts-service-dev, libdownload-agent-dev, libvconf-dev, libslp-pm-dev, iniparser-dev, libslp-tapi-dev +Build-Depends: debhelper (>= 5), wrt-dev (>=0.8.27), libwebkit-engine-dev, wrt-commons-dev (>=0.2.6), libmm-player-dev, libmm-sound-dev, libpcre-dev, libglib2.0-dev, iniparser-dev, wrt-security-dev(>= 0.0.12) Uploaders: Hoseon LEE , Taejeong Lee , Jaehyun Park Package: wrt-plugins-common Architecture: any Section: libs -Depends: ${shlibs:Depends}, ${misc:Depends}, wrt (>=0.8.6) +Depends: ${shlibs:Depends}, ${misc:Depends}, wrt, wrt-security(>= 0.0.12) Description: Common modules for creation JavaScript's plugins Package: wrt-plugins-common-dev Architecture: any Section: libs -Depends: wrt-plugins-common (= ${Source-Version}), libwebkit-engine-dev, wrt-commons-dev (>=0.2.6), wrt-dev +Depends: wrt-plugins-common (= ${Source-Version}), libwebkit-engine-dev, wrt-commons-dev (>=0.2.6), wrt-dev (>=0.8.27) Description: Common modules for creation JavaScript's plugins -dev Package: wrt-plugins-common-dbg diff --git a/debian/rules b/debian/rules index 4f334dc..70b9d33 100755 --- a/debian/rules +++ b/debian/rules @@ -6,83 +6,40 @@ # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - - -# These are used for cross-compiling and for saving the configure script -# from having to guess our platform (since we know it already) -DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -PACKAGE_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*(\(.*\)).*/\1/') -PACKAGE_API_VERSION ?= $(shell sed -n "1 p" debian/changelog | sed 's/.*([0-9]*.\([0-9]*\).*).*/\1/') -PROJECT_NAME ?= wrt-plugins-common - -CFLAGS ?= -Wall -g -fvisibility=default -fPIC -CXXFLAGS ?= -Wall -g -fPIC +PACKAGE_VERSION ?= $(shell dpkg-parsechangelog | sed -n 's/^Version: // p') PREFIX ?= /usr +CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build +LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--hash-style=both -Wl,--version-script=$(CURDIR)/wrt-plugins-common.map -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 - CXXFLAGS += -O0 -else - CFLAGS += -O2 - CXXFLAGS += -O2 -endif - -ifeq (,$(findstring no,$(DPL_LOG))) +ifeq (,$(findstring no,$(DPL_LOGS))) DPL_LOGS_STATUS = "ON" else DPL_LOGS_STATUS = "OFF" endif -LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--hash-style=both -Wl,--version-script=$(CURDIR)/wrt-plugins-common.map - -ifdef DEVPKG - CMAKEFLAGS += -DDEVPKG="$(DEVPKG)" -endif - - -CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build - -#configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && \ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \ - cmake ${SRCDIR} \ - ${CMAKEFLAGS}\ - -DBUILD_TYPE="${TARGET}" \ - -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ - -DCMAKE_BUILD_TYPE="$(BUILD_TYPE)" \ - -DCMAKE_PACKAGE_VERSION="$(PACKAGE_API_VERSION)" \ - -DCMAKE_PROJECT_NAME="$(PROJECT_NAME)" \ - -DDPL_LOG=$(DPL_LOGS_STATUS) .. - + CFLAGS= cmake ${SRCDIR} \ + LDFLAGS="$(LDFLAGS)" \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DDPL_LOG=$(DPL_LOGS_STATUS) \ + -DCMAKE_PROJECT_VERSION="$(PACKAGE_VERSION)" .. build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. - cd $(CMAKE_BUILD_DIR) && $(MAKE) -j5 - + cd $(CMAKE_BUILD_DIR) && $(MAKE) -j4 #docbook-to-man debian/ncurses.sgml > ncurses.1 for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ cat $$f > $${f%.in}; \ - sed -i -e "s#@PREFIX@#$(PREFIX)/lib#g" $${f%.in}; \ - sed -i -e "s#@PREFIX_INCLUDE@#$(PREFIX)/include#g" $${f%.in}; \ + sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \ done - for f in `find $(CURDIR)/pkgconfigs/ -name "*.in"`; do \ - cat $$f > $${f%.in}; \ - sed -i -e "s#@VERSION@#$(PACKAGE_VERSION)#g" $${f%.in}; \ - sed -i -e "s#@PROJECT_NAME@#$(PROJECT_NAME)#g" $${f%.in}; \ - done - - touch $@ clean: diff --git a/debian/wrt-plugins-common-dev.install.in b/debian/wrt-plugins-common-dev.install.in index 09f10db..7fea3e5 100644 --- a/debian/wrt-plugins-common-dev.install.in +++ b/debian/wrt-plugins-common-dev.install.in @@ -1,2 +1,4 @@ -@PREFIX_INCLUDE@/* +@PREFIX@/include/* +@PREFIX@/lib/pkgconfig/* +@PREFIX@/lib/*.so diff --git a/debian/wrt-plugins-common.install.in b/debian/wrt-plugins-common.install.in index dc18d6c..147bd73 100644 --- a/debian/wrt-plugins-common.install.in +++ b/debian/wrt-plugins-common.install.in @@ -1,4 +1,5 @@ - -@PREFIX@/* +@PREFIX@/lib/*.so.* +@PREFIX@/lib/wrt-plugins/* +@PREFIX@/etc/wrt-plugins/config.dtd /usr/share/wrt-plugins-common/widget_interface_db.sql diff --git a/debian/wrt-plugins-common.postinst.in b/debian/wrt-plugins-common.postinst.in old mode 100755 new mode 100644 index 1a24852..e1a12e9 --- a/debian/wrt-plugins-common.postinst.in +++ b/debian/wrt-plugins-common.postinst.in @@ -1 +1,5 @@ #!/bin/sh + +mkdir -p /usr/lib/wrt-plugins + +touch /opt/apps/widget/plugin-installation-required \ No newline at end of file diff --git a/packaging/wrt-plugins-common.spec b/packaging/wrt-plugins-common.spec new file mode 100644 index 0000000..f05429c --- /dev/null +++ b/packaging/wrt-plugins-common.spec @@ -0,0 +1,68 @@ +#sbs-git:public/pkgs/w/wrt-plugins-common wrt-plugins-common 0.3.27 +Name: wrt-plugins-common +Summary: wrt-plugins common library +Version: 0.3.27 +Release: 1 +Group: Development/Libraries +License: Apache License, Version 2.0 +Source0: %{name}-%{version}.tar.gz + +BuildRequires: cmake +BuildRequires: pkgconfig(dpl-efl) +BuildRequires: pkgconfig(wrt-plugin-api) +BuildRequires: pkgconfig(ace-client) +BuildRequires: pkgconfig(dpl-event-efl) +BuildRequires: pkgconfig(ewebkit) +BuildRequires: pkgconfig(dpl-wrt-dao-ro) +BuildRequires: pkgconfig(dpl-db-efl) +BuildRequires: pkgconfig(libpcrecpp) +BuildRequires: pkgconfig(wrt-plugin-loading) +BuildRequires: pkgconfig(mm-sound) +BuildRequires: pkgconfig(mm-player) +BuildRequires: ug-picker-efl +Requires: ldconfig + +%description +JavaScript plugins for WebRuntime + +%package devel +Summary: wrt-plugins-common library development headers +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +wrt-plugins common library development headers + +%prep +%setup -q + +%build +export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--hash-style=both" + +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DDPL_LOG="ON" \ + -DCMAKE_PROJECT_VERSION=%{version} +make %{?jobs:-j%jobs} + +%install +%make_install + +%clean +rm -rf %{buildroot} + +%post +mkdir -p /usr/lib/wrt-plugins +touch /opt/apps/widget/plugin-installation-required + +%files +/usr/etc/wrt-plugins/config.dtd +%{_libdir}/*.so +%{_libdir}/*.so.* +%{_libdir}/wrt-plugins/w3c-widget-interface/libwrt-plugins-w3c-widget-interface.so +%attr(644,root,root) %{_libdir}/wrt-plugins/standard-features-list +%attr(644,root,root) %{_libdir}/wrt-plugins/w3c-widget-interface/config.xml +%attr(644,root,root) /usr/share/wrt-plugins-common/widget_interface_db.sql + +%files devel +%{_includedir}/* +%{_libdir}/pkgconfig/* diff --git a/pkgconfigs/wrt-plugins-accelerometer.pc.in b/pkgconfigs/wrt-plugins-accelerometer.pc.in deleted file mode 100644 index 8331e66..0000000 --- a/pkgconfigs/wrt-plugins-accelerometer.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Calendar module -Description: WebRuntime Calendar module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-accelerometer -Cflags: -I${includedir}/Accelerometer diff --git a/pkgconfigs/wrt-plugins-calendar.pc.in b/pkgconfigs/wrt-plugins-calendar.pc.in deleted file mode 100644 index 496652d..0000000 --- a/pkgconfigs/wrt-plugins-calendar.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Calendar module -Description: WebRuntime Calendar module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-calendar -Cflags: -I${includedir}/Calendar diff --git a/pkgconfigs/wrt-plugins-camera.pc.in b/pkgconfigs/wrt-plugins-camera.pc.in deleted file mode 100644 index 7c67c10..0000000 --- a/pkgconfigs/wrt-plugins-camera.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Camera module -Description: WebRuntime Camera module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-camera -Cflags: -I${includedir}/Camera diff --git a/pkgconfigs/wrt-plugins-commons-javascript.pc.in b/pkgconfigs/wrt-plugins-commons-javascript.pc.in index f758eb0..73a3dd0 100644 --- a/pkgconfigs/wrt-plugins-commons-javascript.pc.in +++ b/pkgconfigs/wrt-plugins-commons-javascript.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WrtDeviceApis commons with JavaScrpt dependencies Description: Commons for DeviceApis with JavaScrpt dependencies -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl ewebkit wrt-plugins-commons Libs: -L${libdir} -lwrt-plugins-commons-javascript Cflags: -I${includedir} diff --git a/pkgconfigs/wrt-plugins-commons.pc.in b/pkgconfigs/wrt-plugins-commons.pc.in index 4b37700..e3c8c7a 100644 --- a/pkgconfigs/wrt-plugins-commons.pc.in +++ b/pkgconfigs/wrt-plugins-commons.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WrtDeviceApis commons Description: Commons for DeviceApis -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl Libs: -L${libdir} -lwrt-plugins-commons Cflags: -I${includedir} diff --git a/pkgconfigs/wrt-plugins-contact.pc.in b/pkgconfigs/wrt-plugins-contact.pc.in deleted file mode 100644 index 49105e7..0000000 --- a/pkgconfigs/wrt-plugins-contact.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Contact module -Description: WebRuntime Contact module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-contact -Cflags: -I${includedir}/Contact diff --git a/pkgconfigs/wrt-plugins-cpu.pc.in b/pkgconfigs/wrt-plugins-cpu.pc.in index 7aed9eb..8793d2e 100644 --- a/pkgconfigs/wrt-plugins-cpu.pc.in +++ b/pkgconfigs/wrt-plugins-cpu.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis Cpu module Description: WebRuntime Cpu module -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl wrt-plugins-commons Libs: -L${libdir} -lwrt-plugins-cpu Cflags: -I${includedir}/Cpu diff --git a/pkgconfigs/wrt-plugins-filesystem.pc.in b/pkgconfigs/wrt-plugins-filesystem.pc.in index 28f9196..49563e1 100644 --- a/pkgconfigs/wrt-plugins-filesystem.pc.in +++ b/pkgconfigs/wrt-plugins-filesystem.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis Filesystem module Description: WebRuntime Filesystem module -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl wrt-plugins-commons Libs: -L${libdir} -lwrt-plugins-filesystem Cflags: -I${includedir}/Filesystem diff --git a/pkgconfigs/wrt-plugins-haptics.pc.in b/pkgconfigs/wrt-plugins-haptics.pc.in deleted file mode 100644 index 97e3348..0000000 --- a/pkgconfigs/wrt-plugins-haptics.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Haptics module -Description: WebRuntime Haptics module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-haptics -Cflags: -I${includedir}/Haptics diff --git a/pkgconfigs/wrt-plugins-localstorage.pc.in b/pkgconfigs/wrt-plugins-localstorage.pc.in deleted file mode 100644 index 2ddeff8..0000000 --- a/pkgconfigs/wrt-plugins-localstorage.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis LocalStorage module -Description: WebRuntime LocalStorage module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-localstorage -Cflags: -I${includedir}/LocalStorage diff --git a/pkgconfigs/wrt-plugins-messaging.pc.in b/pkgconfigs/wrt-plugins-messaging.pc.in deleted file mode 100644 index 12ff85a..0000000 --- a/pkgconfigs/wrt-plugins-messaging.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Messaging module -Description: WebRuntime Messaging module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons wrt-plugins-filesystem -Libs: -L${libdir} -lwrt-plugins-messaging -Cflags: -I${includedir}/Messaging diff --git a/pkgconfigs/wrt-plugins-mmplayer.pc.in b/pkgconfigs/wrt-plugins-mmplayer.pc.in index 93118e2..a914642 100644 --- a/pkgconfigs/wrt-plugins-mmplayer.pc.in +++ b/pkgconfigs/wrt-plugins-mmplayer.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis MMPlayer module Description: WebRuntime MMPlayer module -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl wrt-plugins-commons Libs: -L${libdir} -lwrt-plugins-mmplayer Cflags: -I${includedir}/MMPlayer diff --git a/pkgconfigs/wrt-plugins-orientation.pc.in b/pkgconfigs/wrt-plugins-orientation.pc.in deleted file mode 100644 index a275d41..0000000 --- a/pkgconfigs/wrt-plugins-orientation.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Orientation module -Description: WebRuntime Orientation module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-orientation -Cflags: -I${includedir}/Orientation diff --git a/pkgconfigs/wrt-plugins-plugin-manager.pc.in b/pkgconfigs/wrt-plugins-plugin-manager.pc.in index b7e3915..9ed0170 100644 --- a/pkgconfigs/wrt-plugins-plugin-manager.pc.in +++ b/pkgconfigs/wrt-plugins-plugin-manager.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis Plugin Manager module Description: WebRuntime Plugin Manager module -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl wrt-plugins-commons wrt-plugins-commons-javascript dpl-wrt-dao-ro ewebkit Libs: -L${libdir} -lwrt-plugins-plugin-manager Cflags: -I${includedir}/PluginManager diff --git a/pkgconfigs/wrt-plugins-power.pc.in b/pkgconfigs/wrt-plugins-power.pc.in deleted file mode 100644 index 5ba2dab..0000000 --- a/pkgconfigs/wrt-plugins-power.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Camera module -Description: WebRuntime Camera module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-power -Cflags: -I${includedir}/Power diff --git a/pkgconfigs/wrt-plugins-profile.pc.in b/pkgconfigs/wrt-plugins-profile.pc.in deleted file mode 100644 index a3e3dc4..0000000 --- a/pkgconfigs/wrt-plugins-profile.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Profile module -Description: WebRuntime Profile module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-profile -Cflags: -I${includedir}/Profile diff --git a/pkgconfigs/wrt-plugins-radio.pc.in b/pkgconfigs/wrt-plugins-radio.pc.in deleted file mode 100644 index e4b24c5..0000000 --- a/pkgconfigs/wrt-plugins-radio.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Radio module -Description: WebRuntime Radio module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-radio -Cflags: -I${includedir}/Radio diff --git a/pkgconfigs/wrt-plugins-storageevent.pc.in b/pkgconfigs/wrt-plugins-storageevent.pc.in deleted file mode 100644 index c16d290..0000000 --- a/pkgconfigs/wrt-plugins-storageevent.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis StorageEvent module -Description: WebRuntime StorageEvent module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-storageevent -Cflags: -I${includedir}/StorageEvent diff --git a/pkgconfigs/wrt-plugins-systeminfo.pc.in b/pkgconfigs/wrt-plugins-systeminfo.pc.in deleted file mode 100644 index 03e5972..0000000 --- a/pkgconfigs/wrt-plugins-systeminfo.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis SystemInfo module -Description: WebRuntime SystemInfo module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-systeminfo -Cflags: -I${includedir}/SystemInfo diff --git a/pkgconfigs/wrt-plugins-task.pc.in b/pkgconfigs/wrt-plugins-task.pc.in deleted file mode 100644 index 6526f08..0000000 --- a/pkgconfigs/wrt-plugins-task.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Camera module -Description: WebRuntime Camera module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-task -lwrt-plugins-filesystem -Cflags: -I${includedir}/Task diff --git a/pkgconfigs/wrt-plugins-widget_interface_dao.pc.in b/pkgconfigs/wrt-plugins-widget-interface-dao.pc.in similarity index 65% rename from pkgconfigs/wrt-plugins-widget_interface_dao.pc.in rename to pkgconfigs/wrt-plugins-widget-interface-dao.pc.in index ed2050b..b4ca655 100644 --- a/pkgconfigs/wrt-plugins-widget_interface_dao.pc.in +++ b/pkgconfigs/wrt-plugins-widget-interface-dao.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis Widget Interface module Description: WebRuntime Widget Interface module -Version: @VERSION@ -Requires: dpl-efl dpl-db-efl wrt-plugins-commons wrt-dao-ro wrt-plugins-localstorage +Version: @CMAKE_PROJECT_VERSION@ +Requires: dpl-efl dpl-db-efl wrt-plugins-commons dpl-wrt-dao-ro wrt-plugins-localstorage Libs: -L${libdir} -lwrt-plugins-widget-interface-dao Cflags: -I${includedir}/WidgetInterfaceDAO diff --git a/pkgconfigs/wrt-plugins-widget.pc.in b/pkgconfigs/wrt-plugins-widget.pc.in deleted file mode 100644 index ce17d59..0000000 --- a/pkgconfigs/wrt-plugins-widget.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=/usr -project_name=@PROJECT_NAME@ -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include/${project_name} - -Name: WebRuntime DeviceApis Widget module -Description: WebRuntime Widget module -Version: @VERSION@ -Requires: dpl-efl wrt-plugins-commons -Libs: -L${libdir} -lwrt-plugins-widget -Cflags: -I${includedir}/Widget diff --git a/pkgconfigs/wrt-plugins-widgetdb.pc.in b/pkgconfigs/wrt-plugins-widgetdb.pc.in index 46e6b7b..788423a 100644 --- a/pkgconfigs/wrt-plugins-widgetdb.pc.in +++ b/pkgconfigs/wrt-plugins-widgetdb.pc.in @@ -1,12 +1,12 @@ prefix=/usr -project_name=@PROJECT_NAME@ +project_name=@CMAKE_PROJECT_NAME@ exec_prefix=${prefix} libdir=${prefix}/lib/ includedir=${prefix}/include/${project_name} Name: WebRuntime DeviceApis WidgetDB module Description: WebRuntime WidgetDB module -Version: @VERSION@ +Version: @CMAKE_PROJECT_VERSION@ Requires: dpl-efl wrt-plugins-commons Libs: -L${libdir} -lwrt-plugins-widgetdb Cflags: -I${includedir}/WidgetDB diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ebcff65..04ed299 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,10 @@ endif() #include directories include_directories(${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/modules/API) + ${CMAKE_CURRENT_SOURCE_DIR}/modules/API + ${CMAKE_CURRENT_SOURCE_DIR}/Commons + ${CMAKE_CURRENT_SOURCE_DIR}/CommonsJavaScript + ) #target names set(TARGET_COMMONS "wrt-plugins-commons") @@ -46,3 +49,4 @@ set(TARGET_COMMONS_JAVASCRIPT "wrt-plugins-commons-javascript") add_subdirectory(Commons) add_subdirectory(CommonsJavaScript) add_subdirectory(modules) +add_subdirectory(standards) diff --git a/src/Commons/CMakeLists.txt b/src/Commons/CMakeLists.txt index 437cf9f..33b126a 100755 --- a/src/Commons/CMakeLists.txt +++ b/src/Commons/CMakeLists.txt @@ -17,14 +17,9 @@ macro(install_header_file HEADER_FILE) DESTINATION ${DESTINATION_HEADERS_NON_JS}) endmacro() -macro(install_wrtwrapper_header_file HEADER_FILE) +macro(install_wrtaccess_header_file HEADER_FILE) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADERS_NON_JS}/WrtWrapper) -endmacro() - -macro(install_widget_configuration_header_file HEADER_FILE) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADERS_NON_JS}/WidgetConfiguration) + DESTINATION ${DESTINATION_HEADERS_NON_JS}/WrtAccess) endmacro() macro(install_widget_interface_dao_header_file HEADER_FILE) @@ -32,17 +27,16 @@ macro(install_widget_interface_dao_header_file HEADER_FILE) DESTINATION ${DESTINATION_HEADERS_NON_JS}/WidgetInterfaceDAO) endmacro() -include_config_file(WrtWrapper) -include_config_file(WidgetConfiguration) +include_config_file(WrtAccess) pkg_search_module(wrt-plugin-api REQUIRED wrt-plugin-api>=0.7.0) -pkg_search_module(wrt-ace-client REQUIRED wrt-ace-client) +pkg_search_module(ace-client REQUIRED ace-client) pkg_search_module(dpl-event REQUIRED dpl-event-efl) set(WRT_COMMONS_DEPENDECIES_INCLUDES ${INCLUDE_JS_INDEPENDENT} ${wrt-plugin-api_INCLUDE_DIRS} - ${wrt-ace-client_INCLUDE_DIRS} + ${ace-client_INCLUDE_DIRS} ) include_directories(${WRT_COMMONS_DEPENDECIES_INCLUDES}) @@ -50,8 +44,7 @@ include_directories(${WRT_COMMONS_DEPENDECIES_INCLUDES}) set(TARGET_NAME ${TARGET_COMMONS}) set(SRCS - ${SRCS_WRT_WRAPPER} - ${SRCS_WIDGET_CONFIGURATION} + ${SRCS_WRT_ACCESS} ${CMAKE_CURRENT_SOURCE_DIR}/Base64.cpp ${CMAKE_CURRENT_SOURCE_DIR}/FunctionDefinition.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Regex.cpp @@ -65,10 +58,13 @@ set(SRCS add_library(${TARGET_NAME} SHARED ${SRCS}) target_link_libraries(${TARGET_NAME} ${LIBS_COMMONS} - ${wrt-ace-client_LIBRARIES} + ${ace-client_LIBRARIES} ${dpl-event_LIBRARIES} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) @@ -96,9 +92,4 @@ install_header_file(ThreadPool.h) install_header_file(TypesDeclaration.h) install_header_file(TypeTraits.h) install_header_file(plugin_initializer_def.h) -install_wrtwrapper_header_file(WrtWrapper/IWrtCamera.h) -install_wrtwrapper_header_file(WrtWrapper/IWrtCameraManager.h) -install_wrtwrapper_header_file(WrtWrapper/IWrtWrapper.h) -install_wrtwrapper_header_file(WrtWrapper/WrtWrappersMgr.h) -install_widget_configuration_header_file(WidgetConfiguration/WidgetConfiguration.h) -install_widget_configuration_header_file(WidgetConfiguration/ConfigurationSupport.h) +install_wrtaccess_header_file(WrtAccess/WrtAccess.h) diff --git a/src/Commons/FunctionDeclaration.h b/src/Commons/FunctionDeclaration.h index f93db50..23d3322 100644 --- a/src/Commons/FunctionDeclaration.h +++ b/src/Commons/FunctionDeclaration.h @@ -19,10 +19,11 @@ #include #include #include -#include +#include #include #include #include +#include #define ACE_DECLARE_FUNCTION(function_definition) \ extern WrtDeviceApis::Commons::AceFunction ace_ ## function_definition @@ -132,23 +133,18 @@ template AceSecurityStatus aceCheckAccess( - JavaScriptContext globalContext, const FunctionGetter& f, const char* functionName, Args && ... args) { + using namespace WrtDeviceApis::Commons; + AceFunction aceFunction = f(functionName); ArgumentsVerifier argsVerify; argsVerify(aceFunction, args ...); - IWrtWrapperPtr wrapper = - WrtWrappersMgr::getInstance().getWrtWrapper(globalContext); - if (!wrapper) { - LogError("Wrapper doesn't exist."); - return AceSecurityStatus::InternalError; - } - if (!(wrapper->checkAccess(aceFunction))) { + if (!(WrtAccessSingleton::Instance().checkAccessControl(aceFunction))) { LogDebug("Function is not allowed to run"); return AceSecurityStatus::AccessDenied; } diff --git a/src/Commons/WidgetConfiguration/ConfigurationSupport.h b/src/Commons/WidgetConfiguration/ConfigurationSupport.h deleted file mode 100644 index 5cfeab6..0000000 --- a/src/Commons/WidgetConfiguration/ConfigurationSupport.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_DEVICEAPIS_COMMONS_CONFIGURATION_SUPPORT_H_ -#define WRT_DEVICEAPIS_COMMONS_CONFIGURATION_SUPPORT_H_ - -#include - -namespace WrtDeviceApis { -namespace Commons { - -class ConfigurationSupport -{ - public: - virtual WidgetConfigurationPtr getConfiguration() const - { - return m_configuration; - } - - virtual void setConfiguration(const WidgetConfigurationPtr& config) - { - m_configuration = config; - } - - virtual ~ConfigurationSupport() - { - } - - protected: - WidgetConfigurationPtr m_configuration; -}; - -} -} - -#endif diff --git a/src/Commons/WidgetConfiguration/WidgetConfiguration.cpp b/src/Commons/WidgetConfiguration/WidgetConfiguration.cpp deleted file mode 100644 index 8a29aa3..0000000 --- a/src/Commons/WidgetConfiguration/WidgetConfiguration.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include -#include -#include -#include "WidgetConfiguration.h" - -namespace WrtDeviceApis { -namespace Commons { - -WidgetConfigurationPtr WidgetConfiguration::create( - const JavaScriptContext context) -{ - Try - { - WidgetConfigurationPtr config(new WidgetConfiguration); - config->m_wrtWrapper =WrtDeviceApis::Commons:: - WrtWrappersMgr::getInstance().getWrtWrapper(context); - - return config; - } - Catch(Commons::InvalidArgumentException) - { - LogError("Wrt wrapper doesnt exist, check plugin_initializer.cpp file"); - Assert(false); - } -} - -IWrtWrapperPtr WidgetConfiguration::getWrtWrapper() const -{ - return m_wrtWrapper; -} - -} -} diff --git a/src/Commons/WidgetConfiguration/WidgetConfiguration.h b/src/Commons/WidgetConfiguration/WidgetConfiguration.h deleted file mode 100644 index 586d9a7..0000000 --- a/src/Commons/WidgetConfiguration/WidgetConfiguration.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WIDGET_CONFIGURATION_H_ -#define WRT_PLUGINS_WIDGET_CONFIGURATION_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Commons { - -struct WidgetConfiguration; -typedef DPL::SharedPtr WidgetConfigurationPtr; - -struct WidgetConfiguration -{ - IWrtWrapperPtr getWrtWrapper() const; - - /** - * @thrown Commons::InvalidArgumentsException if wrapper doesnt exist - * TODO temporary Assert is used - * */ - static WidgetConfigurationPtr create(const JavaScriptContext context); - - private: - WidgetConfiguration() - { - } - - private: - IWrtWrapperPtr m_wrtWrapper; -}; - - -} -} - -#endif diff --git a/src/Commons/WidgetConfiguration/config.cmake b/src/Commons/WidgetConfiguration/config.cmake deleted file mode 100644 index 40d1a10..0000000 --- a/src/Commons/WidgetConfiguration/config.cmake +++ /dev/null @@ -1,5 +0,0 @@ -get_current_path() - -set(SRCS_WIDGET_CONFIGURATION - ${CURRENT_PATH}/WidgetConfiguration.cpp -) diff --git a/src/Commons/WrtWrapper/WrtWrapper.cpp b/src/Commons/WrtAccess/WrtAccess.cpp similarity index 86% rename from src/Commons/WrtWrapper/WrtWrapper.cpp rename to src/Commons/WrtAccess/WrtAccess.cpp index 79da373..ce55e8e 100644 --- a/src/Commons/WrtWrapper/WrtWrapper.cpp +++ b/src/Commons/WrtAccess/WrtAccess.cpp @@ -27,9 +27,11 @@ #include #include #include -#include "WrtWrapper.h" -#include "WrtCameraManager.h" +#include "WrtAccess.h" #include +#include + +IMPLEMENT_SINGLETON(WrtDeviceApis::Commons::WrtAccess) namespace WrtDeviceApis { namespace Commons { @@ -72,32 +74,39 @@ class ScopedDeviceCapArray : public DPL::ScopedResource } }; -WrtWrapper::WrtWrapper(int widgetId, - const engine_interface_t* interface) : - m_widgetId(widgetId) +WrtAccess::WrtAccess() +{ + DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS"); +} + +WrtAccess::~WrtAccess() { - m_wrt = interface; +} - if (!interface) { - LogError("Pointer to interface is NULL"); +void WrtAccess::initialize(int widgetId) +{ + LogDebug("initialize"); + + if (widgetId < 0) + { + LogDebug("Invalid widget id"); + Throw(Exception); } - m_cameraManager = IWrtCameraManagerPtr( - new WrtCameraManager(widgetId, interface)); + m_widgetId = widgetId; } -WrtWrapper::~WrtWrapper() +void WrtAccess::deinitialize(int widgetId) { - LogDebug("entered"); + LogDebug("deinitialize"); } -int WrtWrapper::getWidgetId() const +int WrtAccess::getWidgetId() const { - LogDebug("entered"); return m_widgetId; } -bool WrtWrapper::checkAccess(const AceFunction& aceFunction) const +bool WrtAccess::checkAccessControl(const AceFunction& aceFunction) const { size_t deviceCount = aceFunction.deviceCapabilities.size(); @@ -155,10 +164,5 @@ bool WrtWrapper::checkAccess(const AceFunction& aceFunction) const Instance().checkFunctionCall(aceRequest); } -IWrtCameraManagerPtr WrtWrapper::getCameraManagerInterface() const -{ - return m_cameraManager; -} - } } // WrtDeviceApisCommon diff --git a/src/Commons/WrtWrapper/WrtCameraManager.h b/src/Commons/WrtAccess/WrtAccess.h similarity index 63% rename from src/Commons/WrtWrapper/WrtCameraManager.h rename to src/Commons/WrtAccess/WrtAccess.h index be218b2..0c21374 100644 --- a/src/Commons/WrtWrapper/WrtCameraManager.h +++ b/src/Commons/WrtAccess/WrtAccess.h @@ -19,36 +19,36 @@ * @brief */ -#ifndef WRT_PLUGINS_WRT_CAMERA_MANAGER_H_ -#define WRT_PLUGINS_WRT_CAMERA_MANAGER_H_ +#ifndef WRT_PLUGINS_WRT_ACCESS_H_ +#define WRT_PLUGINS_WRT_ACCESS_H_ -#include -#include "IWrtCameraManager.h" +#include +#include namespace WrtDeviceApis { namespace Commons { -class WrtCameraManager : public IWrtCameraManager +class WrtAccess { - public: - WrtCameraManager(int widgetId, const engine_interface_t* interface); - - virtual WrtCamerasPtr getCameras(); + void initialize(int widgetId); + void deinitialize(int widgetId); + int getWidgetId() const; + bool checkAccessControl(const AceFunction &aceFunction) const; private: - bool initialize(); + WrtAccess(); + virtual ~WrtAccess(); -private: + bool m_initialized; int m_widgetId; - const engine_interface_t* m_wrt; - - WrtCamerasPtr m_cameras; + friend class DPL::Singleton; }; +typedef DPL::Singleton WrtAccessSingleton; + } } // WrtDeviceApisCommon -#endif - +#endif //WRT_PLUGINS_WRT_ACCESS_H_ diff --git a/src/Commons/WrtAccess/config.cmake b/src/Commons/WrtAccess/config.cmake new file mode 100644 index 0000000..a31ce63 --- /dev/null +++ b/src/Commons/WrtAccess/config.cmake @@ -0,0 +1,5 @@ +get_current_path() + +set(SRCS_WRT_ACCESS + ${CURRENT_PATH}/WrtAccess.cpp +) diff --git a/src/Commons/WrtWrapper/IWrtCamera.h b/src/Commons/WrtWrapper/IWrtCamera.h deleted file mode 100644 index c1a613d..0000000 --- a/src/Commons/WrtWrapper/IWrtCamera.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WRT_CAMERA_INTERFACE_H_ -#define WRT_PLUGINS_WRT_CAMERA_INTERFACE_H_ - -#include - -#include - -namespace WrtDeviceApis { -namespace Commons { - -class IWrtCamera{ - -public: - typedef int CameraPendingOperation; - typedef void (*SetPendingOperationCb)(CameraPendingOperation, - void* user_data); - - typedef void* CameraPreviewNode; - typedef void (*CameraCaptureSuccessCb)(const char* filename, void* data); - typedef void (*CameraPreviewSuccessCb)(CameraPreviewNode node, void* data); - typedef void (*CameraErrorCb)(int errorCode, void*); - -public: - virtual void createPreviewNode(CameraPreviewSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) = 0; - - virtual void captureImage(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) = 0; - - virtual void startVideoCapture(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) = 0; - - virtual void stopVideoCapture() = 0; - - virtual void cancelAsyncOperation( - const IWrtCamera::CameraPendingOperation& pendingOperation) = 0; - - /** - * virtual destructor - */ - virtual ~IWrtCamera(){} -}; - -typedef DPL::SharedPtr IWrtCameraPtr; - -} -} // WrtDeviceApisCommon - -#endif diff --git a/src/Commons/WrtWrapper/IWrtCameraManager.h b/src/Commons/WrtWrapper/IWrtCameraManager.h deleted file mode 100644 index e6d1934..0000000 --- a/src/Commons/WrtWrapper/IWrtCameraManager.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WRT_CAMERA_MANAGER_INTERFACE_H_ -#define WRT_PLUGINS_WRT_CAMERA_MANAGER_INTERFACE_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Commons { - -class IWrtCameraManager -{ - -public: - - typedef std::list WrtCameras; - typedef DPL::SharedPtr WrtCamerasPtr; - -public: - - virtual WrtCamerasPtr getCameras() = 0; - - /** - * virtual destructor - */ - virtual ~IWrtCameraManager(){} -}; - -typedef DPL::SharedPtr IWrtCameraManagerPtr; - -} -} // WrtDeviceApisCommon - -#endif diff --git a/src/Commons/WrtWrapper/IWrtWrapper.h b/src/Commons/WrtWrapper/IWrtWrapper.h deleted file mode 100644 index 79f5da3..0000000 --- a/src/Commons/WrtWrapper/IWrtWrapper.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WRT_ENGINE_WRAPPER_INTERFACE_H_ -#define WRT_PLUGINS_WRT_ENGINE_WRAPPER_INTERFACE_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Commons { - -class IWrtWrapper -{ - - public: - - virtual ~IWrtWrapper() - { - } - - /* - * Get widgetId - * @throw Exception::PlatformException if platform error - * @throw Exception::SecurityException if wrt forbiden using this function - * */ - virtual int getWidgetId() const = 0; - - /* - * Get call permission for platform function. - * */ - virtual bool checkAccess(const AceFunction &aceFunction) - const = 0; - - - /** - * Returns shared pointer to camera interface - * */ - virtual IWrtCameraManagerPtr getCameraManagerInterface() const = 0; -}; - -typedef DPL::SharedPtr IWrtWrapperPtr; - -} -} // WrtDeviceApisCommon - -#endif diff --git a/src/Commons/WrtWrapper/WrtCamera.cpp b/src/Commons/WrtWrapper/WrtCamera.cpp deleted file mode 100644 index 9e62143..0000000 --- a/src/Commons/WrtWrapper/WrtCamera.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "WrtCamera.h" -#include -#include - -namespace WrtDeviceApis { -namespace Commons { - -WrtCamera::WrtCamera(int widgetId, - const engine_interface_t* interface, - CameraInstance camera, - camera_type /*type*/) : - m_widgetId(widgetId), - m_wrt(interface), - m_camera(camera) -{ - if (!interface) { - LogError("Pointer to interface is NULL"); - } -} - -void WrtCamera::createPreviewNode(CameraPreviewSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) -{ - if (!m_wrt || - !m_wrt->wrt_camera_create_preview_node) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_create_preview_node( - m_widgetId, - m_camera, - successCallback, - errorCallback, - setPendingOperationCb, - user_data)) - { - LogError("Error: Platform error when create_preview_node"); - Throw(PlatformException); - } -} - -void WrtCamera::captureImage(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) -{ - if (!m_wrt || - !m_wrt->wrt_camera_capture_image) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_capture_image( - m_widgetId, - m_camera, - filename.c_str(), - highRes, - successCallback, - errorCallback, - setPendingOperationCb, - user_data)) - { - LogError("Error: Platform error when capture_image"); - Throw(PlatformException); - } -} - -void WrtCamera::startVideoCapture(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data) -{ - if (!m_wrt || - !m_wrt->wrt_camera_start_video_capture) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_start_video_capture( - m_widgetId, - m_camera, - filename.c_str(), - highRes, - successCallback, - errorCallback, - setPendingOperationCb, - user_data)) - { - LogError("Error: Platform error when start video"); - Throw(PlatformException); - } -} - -void WrtCamera::stopVideoCapture() -{ - if (!m_wrt || - !m_wrt->wrt_camera_stop_video_capture) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_stop_video_capture(m_widgetId, m_camera)) { - LogError("Error: Platform error when start video"); - Throw(PlatformException); - } -} - -void WrtCamera::cancelAsyncOperation ( - const IWrtCamera::CameraPendingOperation& pendingOperation) -{ - if (!m_wrt || - !m_wrt->wrt_camera_cancel_async_operation) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_cancel_async_operation(m_widgetId, - m_camera, - pendingOperation)) - { - LogError("Error: Platform error when start video"); - Throw(PlatformException); - } -} - -WrtCamera::~WrtCamera() -{ - if (!m_wrt || - !m_wrt->wrt_camera_remove_camera) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - if (m_wrt->wrt_camera_remove_camera(m_widgetId, m_camera)) { - LogError("Error: Platform error when removing camera"); - //DPL::Assert(0); - // Throw(PlatformException); - } - - LogDebug("Camera instance removed"); -} - -} -} // WrtDeviceApisCommon diff --git a/src/Commons/WrtWrapper/WrtCamera.h b/src/Commons/WrtWrapper/WrtCamera.h deleted file mode 100644 index fdc8141..0000000 --- a/src/Commons/WrtWrapper/WrtCamera.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WRT_CAMERA_H_ -#define WRT_PLUGINS_WRT_CAMERA_H_ - -#include -#include -#include -#include "IWrtCamera.h" -//#include - -namespace WrtDeviceApis { -namespace Commons { - -class WrtCamera : public IWrtCamera -{ - -public: - typedef void* CameraInstance; - -public: - WrtCamera(int widgetId, - const engine_interface_t* interface, - CameraInstance camera, - camera_type type); - - virtual void createPreviewNode(CameraPreviewSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data); - - virtual void captureImage(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data); - - virtual void startVideoCapture(const std::string& filename, - bool highRes, - CameraCaptureSuccessCb successCallback, - CameraErrorCb errorCallback, - SetPendingOperationCb setPendingOperationCb, - void* user_data); - - virtual void stopVideoCapture(); - - virtual void cancelAsyncOperation(const CameraPendingOperation& operation); - - /** - * virtual destructor - */ - virtual ~WrtCamera(); - -private: - int m_widgetId; - - const engine_interface_t* m_wrt; - - CameraInstance m_camera; -}; - -typedef DPL::SharedPtr WrtCameraPtr; - -} -} // WrtDeviceApisCommon - -#endif - diff --git a/src/Commons/WrtWrapper/WrtCameraManager.cpp b/src/Commons/WrtWrapper/WrtCameraManager.cpp deleted file mode 100644 index 5836e5f..0000000 --- a/src/Commons/WrtWrapper/WrtCameraManager.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "WrtCameraManager.h" -#include -#include -#include "WrtCamera.h" - -namespace WrtDeviceApis { -namespace Commons { - -WrtCameraManager::WrtCameraManager(int widgetId, - const engine_interface_t* interface) - : m_widgetId(widgetId) -{ - m_wrt = interface; - - if (!interface) { - LogError("Pointer to interface is NULL"); - } - - m_cameras = WrtCamerasPtr(new WrtCameras); -} - - -IWrtCameraManager::WrtCamerasPtr WrtCameraManager::getCameras() -{ - static bool initialized = initialize(); - (void)initialized; - - return m_cameras; -} - -bool WrtCameraManager::initialize() -{ - if (!m_wrt || - !m_wrt->wrt_camera_get_cameras || - !m_wrt->wrt_camera_free_webkit_cameras) - { - LogError("Error: Security error"); - Throw(SecurityException); - } - - webkit_cameras_array *array = m_wrt->wrt_camera_get_cameras(m_widgetId); - if (NULL == array) { - LogError("Error: Platform error when get_cameras"); - Throw(PlatformException); - } - - for (size_t i = 0; i < array->size; ++i) { - m_cameras->push_back( - IWrtCameraPtr(new WrtCamera(m_widgetId, - m_wrt, - array->webkit_cameras[i].camera, - array->webkit_cameras[i].type))); - } - return true; - - - - -} - -} -} // WrtDeviceApisCommon diff --git a/src/Commons/WrtWrapper/WrtWrapper.h b/src/Commons/WrtWrapper/WrtWrapper.h deleted file mode 100644 index 188fc91..0000000 --- a/src/Commons/WrtWrapper/WrtWrapper.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_WRT_ENGINE_WRAPPER_H_ -#define WRT_PLUGINS_WRT_ENGINE_WRAPPER_H_ - -#include -#include "IWrtWrapper.h" - -namespace WrtDeviceApis { -namespace Commons { - -class WrtWrapper : public IWrtWrapper -{ - public: - friend class WrtWrappersMgr; - - public: - - virtual ~WrtWrapper(); - - virtual int getWidgetId() const; - - virtual bool checkAccess(const AceFunction &aceFunction) const; - - virtual IWrtCameraManagerPtr getCameraManagerInterface() const; - - private: - - WrtWrapper(int widgetId, const engine_interface_t* interface); - - private: - int m_widgetId; - - const engine_interface_t* m_wrt; - - IWrtCameraManagerPtr m_cameraManager; -}; - -} -} // WrtDeviceApisCommon - -#endif diff --git a/src/Commons/WrtWrapper/WrtWrappersMgr.cpp b/src/Commons/WrtWrapper/WrtWrappersMgr.cpp deleted file mode 100644 index 6b54d37..0000000 --- a/src/Commons/WrtWrapper/WrtWrappersMgr.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include -#include "WrtWrapper.h" -#include "WrtWrappersMgr.h" - -namespace WrtDeviceApis { -namespace Commons { - -WrtWrappersMgr::WrtWrappersMgr() -{ - DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS"); -} - -WrtWrappersMgr::~WrtWrappersMgr() -{ -} - -IWrtWrapperPtr WrtWrappersMgr::registerWrapper( - int widgetId, - JavaScriptContext context, - const engine_interface_t* interface) -{ - LogDebug("entered"); - if (!context || !interface) { - Throw(InvalidArgumentException); - } - - if (isWrapperRegistered(context)) { - return getWrtWrapper(context); - } - - LogDebug("creation wrapper for id: " << widgetId); - IWrtWrapperPtr wrapper(new WrtWrapper(widgetId, interface)); - - addWrapper(context, wrapper); - - return wrapper; -} - -void WrtWrappersMgr::removeWrapper(int widgetId) -{ - LogDebug("entered"); - RegisteredWrappersIterator it = m_wrappers.begin(); - - for (; it != m_wrappers.end(); ++it) { - if (it->second->getWidgetId() == widgetId) { - m_wrappers.erase(it); - return; - } - } - Throw(InvalidArgumentException); -} - -void WrtWrappersMgr::removeWrapper(JavaScriptContext context) -{ - LogDebug("entered"); - RegisteredWrappersIterator it = m_wrappers.find(context); - - if (it == m_wrappers.end()) { - Throw(InvalidArgumentException); - } - - m_wrappers.erase(it); -} - -WrtWrappersMgr& WrtWrappersMgr::getInstance() -{ - LogDebug("entered"); - - static WrtWrappersMgr instance; - return instance; -} - -IWrtWrapperPtr WrtWrappersMgr::getWrapper(const JavaScriptContext context) -const -{ - LogDebug("entered"); - RegisteredWrappersConstIterator it = m_wrappers.find(context); - - if (it == m_wrappers.end()) { - Throw(OutOfRangeException); - } - - return it->second; -} - -IWrtWrapperPtr WrtWrappersMgr::getWrtWrapper(const JavaScriptContext context) -const -{ - LogDebug("entered"); - - IWrtWrapperPtr wrapper; - - Try { - wrapper = getWrapper(context); - } - Catch(OutOfRangeException){ - Throw(InvalidArgumentException); - } - - return wrapper; -} - -void WrtWrappersMgr::addWrapper(JavaScriptContext context, - IWrtWrapperPtr wrapper) -{ - LogDebug("entered"); - m_wrappers.insert(std::make_pair(context, wrapper)); -} - -bool WrtWrappersMgr::isWrapperRegistered(JavaScriptContext context) const -{ - LogDebug("entered"); - RegisteredWrappersConstIterator it = m_wrappers.find(context); - - if (it == m_wrappers.end()) { - return false; - } - return true; -} - -} -} // WrtDeviceApisCommon diff --git a/src/Commons/WrtWrapper/WrtWrappersMgr.h b/src/Commons/WrtWrapper/WrtWrappersMgr.h deleted file mode 100644 index ee1badd..0000000 --- a/src/Commons/WrtWrapper/WrtWrappersMgr.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk - * @version 0.1 - * @brief This file provide factory to create wrapper for api from wrt - */ - -#ifndef WRT_PLUGINS_WRT_WRAPPERS_MGR_INTERFACE_H_ -#define WRT_PLUGINS_WRT_WRAPPERS_MGR_INTERFACE_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Commons { - -class WrtWrappersMgr : private DPL::Noncopyable -{ - typedef std::map RegisteredWrappers; - typedef RegisteredWrappers::iterator RegisteredWrappersIterator; - typedef RegisteredWrappers::const_iterator RegisteredWrappersConstIterator; - - public: - - static WrtWrappersMgr& getInstance(); - - /* - * creates wrt wrappers for widgetId - * @throw Exception::Exception if creation fail - * @throw Exception::InvalidArgumentException if arguments are wrong - * if Wrapper exist - * */ - virtual IWrtWrapperPtr registerWrapper(int widgetId, - JavaScriptContext context, - const engine_interface_t* interface); - - /* - * removes previously created wrapper - * @throw Exception::InvalidArgumentException if creation fail - * if widget is not registered - * */ - virtual void removeWrapper(int widgetId); - - /* - * removes previously created wrapper - * @throw Exception::InvalidArgumentException if creation fail - * if widget is not registered - * */ - virtual void removeWrapper(JavaScriptContext context); - - /* - * a get previously created wrapper - * @throw Exception::InvalidArgumentException if creation fail - * if wrapper is not registered - * */ - virtual IWrtWrapperPtr getWrtWrapper(const JavaScriptContext context) const; - - virtual bool isWrapperRegistered(JavaScriptContext context) const; - - virtual ~WrtWrappersMgr(); - - private: - WrtWrappersMgr(); - - IWrtWrapperPtr getWrapper(const JavaScriptContext context) const; - - void addWrapper(JavaScriptContext context, - IWrtWrapperPtr wrapper); - - RegisteredWrappers m_wrappers; -}; - -} -} // WrtDeviceApisCommon - -#endif diff --git a/src/Commons/WrtWrapper/config.cmake b/src/Commons/WrtWrapper/config.cmake deleted file mode 100644 index 8a44899..0000000 --- a/src/Commons/WrtWrapper/config.cmake +++ /dev/null @@ -1,8 +0,0 @@ -get_current_path() - -set(SRCS_WRT_WRAPPER - ${CURRENT_PATH}/WrtWrappersMgr.cpp - ${CURRENT_PATH}/WrtWrapper.cpp - ${CURRENT_PATH}/WrtCamera.cpp - ${CURRENT_PATH}/WrtCameraManager.cpp -) diff --git a/src/CommonsJavaScript/CMakeLists.txt b/src/CommonsJavaScript/CMakeLists.txt index 3b4a9f2..88611bb 100755 --- a/src/CommonsJavaScript/CMakeLists.txt +++ b/src/CommonsJavaScript/CMakeLists.txt @@ -55,7 +55,10 @@ target_link_libraries(${TARGET_NAME} ${webkit_LIBRARIES} ${TARGET_COMMONS} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp index db53b21..fe20f9c 100644 --- a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp +++ b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.cpp @@ -22,13 +22,11 @@ namespace CommonsJavaScript { AceSecurityStatus aceCheckAccessSimple( - JSContextRef globalContext, WrtDeviceApis::Commons::AceFunction aceFunction) { - return aceCheckAccess2>(globalContext, - aceFunction); + return aceCheckAccess2>(aceFunction); } } -} \ No newline at end of file +} diff --git a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h index e3305a9..ad93dd8 100644 --- a/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h +++ b/src/CommonsJavaScript/Security/SecurityFunctionDeclaration.h @@ -17,7 +17,7 @@ #define _FUNCTION_DECLARATION_ #include -#include +#include #include #include #include @@ -58,25 +58,23 @@ class DefaultArgsVerifier<> template -AceSecurityStatus aceCheckAccess2(JSContextRef globalContext, - WrtDeviceApis::Commons::AceFunction aceFunction, +AceSecurityStatus aceCheckAccess2( + WrtDeviceApis::Commons::AceFunction aceFunction, Args && ... args) { + using namespace WrtDeviceApis::Commons; + ArgumentsVerifier argsVerify; argsVerify(aceFunction, args ...); Try { - WrtDeviceApis::Commons::IWrtWrapperPtr wrapper = - WrtDeviceApis::Commons::WrtWrappersMgr::getInstance().getWrtWrapper( - globalContext); - - if (!(wrapper->checkAccess(aceFunction))) { + if (!(WrtAccessSingleton::Instance().checkAccessControl(aceFunction))) { LogDebug("Function is not allowed to run"); return AceSecurityStatus::AccessDenied; } } Catch(WrtDeviceApis::Commons::OutOfRangeException) { - LogError("Wrapper doesn't exist."); + LogError("WrtAccess doesn't exist."); return AceSecurityStatus::InternalError; } @@ -88,8 +86,8 @@ AceSecurityStatus aceCheckAccess2(JSContextRef globalContext, //The simplest version -AceSecurityStatus aceCheckAccessSimple(JSContextRef globalContext, - WrtDeviceApis::Commons::AceFunction aceFunction); +AceSecurityStatus aceCheckAccessSimple( + WrtDeviceApis::Commons::AceFunction aceFunction); } } diff --git a/src/modules/API/Accelerometer/AccelerationProperties.h b/src/modules/API/Accelerometer/AccelerationProperties.h deleted file mode 100644 index 2d9a780..0000000 --- a/src/modules/API/Accelerometer/AccelerationProperties.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file AccelerationProperties.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_ACCELERATION_PROPERTIES_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_ACCELERATION_PROPERTIES_H_ - -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -struct AccelerationProperties -{ - double xAxis; - double yAxis; - double zAxis; - AccelerationProperties() : - xAxis(0.0), - yAxis(0.0), - zAxis(0.0) - { - } -}; - -typedef DPL::SharedPtr AccelerationPropertiesPtr; -} // Accelerometer -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_ACCELEROMETER_ACCELERATION_PROPERTIES_H_ \ No newline at end of file diff --git a/src/modules/API/Accelerometer/AccelerometerFactory.cpp b/src/modules/API/Accelerometer/AccelerometerFactory.cpp deleted file mode 100644 index 5e1fae0..0000000 --- a/src/modules/API/Accelerometer/AccelerometerFactory.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file AccelerometerFactory.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -IAccelerometerPtr AccelerometerFactory::getAccelerometers() -{ - return IAccelerometerPtr(new Accelerometer()); -} - -AccelerometerFactory& AccelerometerFactory::getInstance() -{ - static AccelerometerFactory theInstance; - return theInstance; -} - -AccelerometerFactory::AccelerometerFactory() -{ -} -} -} -} diff --git a/src/modules/API/Accelerometer/AccelerometerFactory.h b/src/modules/API/Accelerometer/AccelerometerFactory.h deleted file mode 100644 index 3e94182..0000000 --- a/src/modules/API/Accelerometer/AccelerometerFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file AccelerometerFactory.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief This class provide factory to create Accelerometer - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETERFACTORY_H_ -#define WRTDEVICEAPIS_ACCELEROMETERFACTORY_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -class AccelerometerFactory : DPL::Noncopyable -{ - public: - IAccelerometerPtr getAccelerometers(); - - static AccelerometerFactory& getInstance(); - - protected: - AccelerometerFactory(); -}; -} -} -} - -#endif //WRTDEVICEAPIS_ACCELEROMETERFACTORY_H_ - diff --git a/src/modules/API/Accelerometer/EventAccelerationChanged.h b/src/modules/API/Accelerometer/EventAccelerationChanged.h deleted file mode 100644 index adcbbaa..0000000 --- a/src/modules/API/Accelerometer/EventAccelerationChanged.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file EventAccelerationChanged.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_EVENT_ACCELERATION_CHANGED_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_EVENT_ACCELERATION_CHANGED_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -class EventAccelerationChanged : - public Commons::ListenerEvent -{ - private: - AccelerationProperties m_props; - - public: - AccelerationProperties getAccelerationProperties() const - { - return m_props; - } - void setAccelerationProperties(const AccelerationProperties &props) - { - m_props = props; - } - - EventAccelerationChanged() - { - } -}; - -typedef DPL::SharedPtr EventAccelerationChangedPtr; -typedef Commons::ListenerEventEmitter - EventAccelerationChangedEmitter; -typedef DPL::SharedPtr - EventAccelerationChangedEmitterPtr; -} // Accelerometer -} // Api -} // WrtDeviceApis - -#endif //WRTDEVICEAPIS_ACCELEROMETER_EVENT_ACCELERATION_CHANGED_H_ \ No newline at end of file diff --git a/src/modules/API/Accelerometer/EventGetCurrentAcceleration.h b/src/modules/API/Accelerometer/EventGetCurrentAcceleration.h deleted file mode 100644 index 4decb04..0000000 --- a/src/modules/API/Accelerometer/EventGetCurrentAcceleration.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file EventGetCurrentAcceleration.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_EVENT_GET_CURRENT_ACCELERATION_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_EVENT_GET_CURRENT_ACCELERATION_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -class EventGetCurrentAcceleration : - public Commons::IEvent -{ - private: - AccelerationProperties m_props; - public: - void setXAxis(double xAxis) - { - m_props.xAxis = xAxis; - } - void setYAxis(double yAxis) - { - m_props.yAxis = yAxis; - } - void setZAxis(double zAxis) - { - m_props.zAxis = zAxis; - } - - double getXAxis() const - { - return m_props.xAxis; - } - double getYAxis() const - { - return m_props.yAxis; - } - double getZAxis() const - { - return m_props.zAxis; - } - - AccelerationProperties getAccelerationProperties() const - { - return m_props; - } - - EventGetCurrentAcceleration() - { - } -}; - -typedef DPL::SharedPtr -EventGetCurrentAccelerationPtr; -} // Accelerometer -} // Api -} // WrtDeviceApis - -#endif //WRTDEVICEAPIS_API_ACCELEROMETER_EVENT_GET_CURRENT_ACCELERATION_H_ \ No newline at end of file diff --git a/src/modules/API/Accelerometer/IAccelerometer.cpp b/src/modules/API/Accelerometer/IAccelerometer.cpp deleted file mode 100644 index c47397d..0000000 --- a/src/modules/API/Accelerometer/IAccelerometer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file IAccelerometer.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -IAccelerometer::IAccelerometer() : - EventRequestReceiver( - Commons::ThreadEnum::ACCELEROMETER_THREAD) -{ -} - -IAccelerometer::~IAccelerometer() -{ -} - -} -} -} diff --git a/src/modules/API/Accelerometer/IAccelerometer.h b/src/modules/API/Accelerometer/IAccelerometer.h deleted file mode 100644 index e074502..0000000 --- a/src/modules/API/Accelerometer/IAccelerometer.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file IAccelerometer.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_IACCELEROMETER_H_ -#define WRTDEVICEAPIS_IACCELEROMETER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -class EventGetCurrentAcceleration; -typedef DPL::SharedPtr - EventGetCurrentAccelerationPtr; - -class IAccelerometer : - public Commons::EventRequestReceiver -{ - public: - virtual ~IAccelerometer(); - - /** - * Gets current acceleration - * @param event @see WrtDeviceApis::Api::Accelerometer::EventGetCurrentAcceleration. - * @exception Commons::PlatformException when platform error occurs - */ - virtual void getCurrentAcceleration( - const EventGetCurrentAccelerationPtr& event) = 0; - - /** - * Requests sensor module to receive continuously update of current - * acceleration if the acceleration is significantly changed - * @param emitter @see WrtDeviceApis::Api::Accelerometer::EventAccelerationChanged. - * @param minNotificationInterval - * @return An ID of created subscription - * @exception Commons::PlatformException when platform error occurs - */ - virtual long watchAcceleration( - const EventAccelerationChangedEmitterPtr& emitter, - long minNotificationInterval) = 0; - - /** - * Stopping periodic acceleration updates started with watchAcceleration - * @param id An Id of listener subscription. - * @exception Commons::PlatformException when platform error occurs - */ - virtual void clearWatch(EventAccelerationChangedEmitter::IdType id) = 0; - - protected: - IAccelerometer(); - - virtual void OnRequestReceived(const EventGetCurrentAccelerationPtr& event) - = 0; -}; - -typedef DPL::SharedPtr IAccelerometerPtr; -} -} -} - -#endif /* WRTDEVICEAPIS_API_IACCELEROMETER_H_ */ diff --git a/src/modules/API/Accelerometer/ISensor.cpp b/src/modules/API/Accelerometer/ISensor.cpp deleted file mode 100644 index f38bca4..0000000 --- a/src/modules/API/Accelerometer/ISensor.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "ISensor.h" -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -ISensor& ISensor::getInstance() -{ - return Accelerometer::Sensor::getInstance(); -} - -ISensor::~ISensor() -{ -} -} // Accelerometer -} // Api -} // WrtDeviceApis diff --git a/src/modules/API/Accelerometer/ISensor.h b/src/modules/API/Accelerometer/ISensor.h deleted file mode 100644 index 7ef1b63..0000000 --- a/src/modules/API/Accelerometer/ISensor.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_ISENSOR_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_ISENSOR_H_ - -#include - -namespace WrtDeviceApis { -namespace Accelerometer { -namespace Api { - -class ISensor : private DPL::Noncopyable -{ - public: - /** - * Gets instance of accelerometer sensor. - * @return Accelerometer sensor interface. - * @throw UnsupportedException If platform does not support it. - */ - static ISensor& getInstance(); - - public: - virtual ~ISensor() = 0; - - /** - * Gets value on X-axis. - * @return Value on X-axis. - * @throw PlatformException If error in platform occurs. - */ - virtual double getX() const = 0; - - /** - * Gets value on Y-axis. - * @return Value on Y-axis. - * @throw PlatformException If error in platform occurs. - */ - virtual double getY() const = 0; - - /** - * Gets value on Z-axis. - * @return Value on Z-axis. - * @throw PlatformException If error in platform occurs. - */ - virtual double getZ() const = 0; -}; -} // Accelerometer -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_ACCELEROMETER_ISENSOR_H_ diff --git a/src/modules/API/Accelerometer/config.cmake b/src/modules/API/Accelerometer/config.cmake deleted file mode 100644 index 31bfaad..0000000 --- a/src/modules/API/Accelerometer/config.cmake +++ /dev/null @@ -1,13 +0,0 @@ -get_current_path() - -set(API_ACCELEROMETER_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_ACCELEROMETER - ${CURRENT_PATH}/ISensor.cpp - ${CURRENT_PATH}/AccelerometerFactory.cpp - ${CURRENT_PATH}/IAccelerometer.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/CMakeLists.txt b/src/modules/API/CMakeLists.txt index 1ea1a8f..b9e2f69 100644 --- a/src/modules/API/CMakeLists.txt +++ b/src/modules/API/CMakeLists.txt @@ -12,22 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -include_config_file(Calendar) -include_config_file(Camera) include_config_file(Filesystem) -include_config_file(Messaging) -include_config_file(Haptics) -include_config_file(Contact) include_config_file(MMPlayer) include_config_file(Cpu) -include_config_file(Power) -include_config_file(Accelerometer) -include_config_file(Profile) include_config_file(Widget) -include_config_file(Radio) -include_config_file(Orientation) -include_config_file(Task) -include_config_file(SystemInfo) include_config_file(LocalStorage) include_config_file(StorageEvent) include_config_file(WidgetDB) diff --git a/src/modules/API/Calendar/CalendarEvent.cpp b/src/modules/API/Calendar/CalendarEvent.cpp deleted file mode 100644 index a8a7b02..0000000 --- a/src/modules/API/Calendar/CalendarEvent.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Event.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include -#include -#include "CalendarEvent.h" - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -CalendarEvent::CalendarEvent() : - m_calendarId(UNDEFINED_CALENDAR_ID), - m_recurrence(UNDEFINED_RECURRENCE), - m_status(UNDEFINED_STATUS), - m_alarmType(UNDEFINED_ALARM_TYPE), - m_categories(new CategoryList()), - m_interval(1) -{ -} - -CalendarEvent::~CalendarEvent() -{ -} - -bool CalendarEvent::getIdIsSet() const -{ - return !m_id.IsNull(); -} - -bool CalendarEvent::getAlarmTimeIsSet() const -{ - return !m_alarmTime.IsNull(); -} - -bool CalendarEvent::getExpiresIsSet() const -{ - return !m_expires.IsNull(); -} - -int CalendarEvent::getCalendarId() const -{ - return m_calendarId; -} - -void CalendarEvent::setCalendarId(int value) -{ - m_calendarId = value; -} - -int CalendarEvent::getId() const -{ - return *m_id; -} - -void CalendarEvent::setId(int value) -{ - m_id = value; -} - -void CalendarEvent::resetId() -{ - m_id = DPL::Optional(); -} - -std::string CalendarEvent::getDescription() const -{ - return m_description; -} - -void CalendarEvent::setDescription(const std::string &value) -{ - m_description = value; -} - -std::string CalendarEvent::getSubject() const -{ - return m_subject; -} - -void CalendarEvent::setSubject(const std::string &value) -{ - m_subject = value; -} - -time_t CalendarEvent::getStartTime() const -{ - return m_startTime; -} - -void CalendarEvent::setStartTime(time_t value) -{ - m_startTime = value; -} - -time_t CalendarEvent::getEndTime() const -{ - return m_endTime; -} - -void CalendarEvent::setEndTime(time_t value) -{ - m_endTime = value; -} - -std::string CalendarEvent::getLocation() const -{ - return m_location; -} - -void CalendarEvent::setLocation(const std::string &value) -{ - m_location = value; -} - -CalendarEvent::EventRecurrence CalendarEvent::getRecurrence() const -{ - return m_recurrence == UNDEFINED_RECURRENCE ? NO_RECURRENCE : m_recurrence; -} - -void CalendarEvent::setRecurrence(EventRecurrence value) -{ - m_recurrence = value; -} - -CalendarEvent::EventStatus CalendarEvent::getStatus() const -{ - return m_status == UNDEFINED_STATUS ? TENTATIVE_STATUS : m_status; -} - -void CalendarEvent::setStatus(EventStatus value) -{ - m_status = value; -} - -time_t CalendarEvent::getAlarmTime() const -{ - return *m_alarmTime; -} - -void CalendarEvent::setAlarmTime(time_t value) -{ - m_alarmTime = value; -} - -void CalendarEvent::resetAlarmTime() -{ - m_alarmTime = DPL::Optional(); -} - -CalendarEvent::EventAlarmType CalendarEvent::getAlarmType() const -{ - return m_alarmType == UNDEFINED_ALARM_TYPE ? NO_ALARM : m_alarmType; -} - -void CalendarEvent::setAlarmType(EventAlarmType value) -{ - m_alarmType = value; -} - -CategoryListPtr CalendarEvent::getCategories() const -{ - return m_categories; -} -void CalendarEvent::setCategories(const CategoryListPtr &value) -{ - m_categories = value; -} - -time_t CalendarEvent::getExpires() const -{ - return *m_expires; -} - -void CalendarEvent::setExpires(time_t value) -{ - m_expires = value; -} - -void CalendarEvent::resetExpires() -{ - m_expires = DPL::Optional(); -} - -int CalendarEvent::getInterval() const -{ - return m_interval; -} - -void CalendarEvent::setInterval(int value) -{ - if (m_interval < 1) { - LogError("invalid interval"); - ThrowMsg(Commons::InvalidArgumentException, "interval less than 1"); - } - m_interval = value; -} - -void CalendarEvent::display() const -{ - LogDebug("m_id " << m_id); - LogDebug("m_calendarId " << m_calendarId); - LogDebug("m_description " << m_description); - LogDebug("m_subject " << m_subject); - LogDebug("m_startTime " << m_startTime); - LogDebug("m_endTime " << m_endTime); - LogDebug("m_location " << m_location); - LogDebug("m_recurrence " << m_recurrence); - LogDebug("m_status " << m_status); - if (!m_alarmTime.IsNull()) { - LogDebug("m_alarmTime " << *m_alarmTime); - } - LogDebug("m_alarmType " << m_alarmType); - if (!m_expires.IsNull()) { - LogDebug("m_expires" << *m_expires); - } - LogDebug("m_categories size " << m_categories->size()); - for (size_t i = 0; i < m_categories->size(); ++i) { - LogDebug("category" << i << " " << m_categories->at(i)); - } -} - -bool CalendarEvent::validate() const -{ - if (m_alarmType == INVALID_ALARM_TYPE) { - LogError("Incorrect alarm type value detected"); - return false; - } - if (m_recurrence == INVALID_RECURRENCE) { - LogError("Incorrect recurrence value detected"); - return false; - } - if (m_status == INVALID_STATUS) { - LogError("Incorrect status value detected"); - return false; - } - return true; -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Calendar/CalendarEvent.h b/src/modules/API/Calendar/CalendarEvent.h deleted file mode 100644 index 235b4b4..0000000 --- a/src/modules/API/Calendar/CalendarEvent.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file CalendarEvent.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_CALENDAR_EVENT_H_ -#define WRTDEVICEAPIS_CALENDAR_CALENDAR_EVENT_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -typedef std::vector CategoryList; -typedef DPL::SharedPtr CategoryListPtr; - -/* This object represents a single calendar event */ -class CalendarEvent -{ - public: - - static const int UNDEFINED_CALENDAR_ID = -1; - - typedef enum - { - NO_RECURRENCE, //The calendar entry occurs once - DAILY_RECURRENCE, //The calendar entry occurs every day - WEEKLY_RECURRENCE, //The calendar entry occurs every week e.g. every Monday - MONTHLY_RECURRENCE, //The calendar entry occurs every month e.g. every 3rd day of month - YEARLY_RECURRENCE, //The calendar entry occurs every year e.g. every June 1st - WEEKDAY_RECURRENCE, //The calendar entry occurs Mon-Fri every week - MONTHLY_ON_DAY_RECURRENCE, //The calendar entry occurs on the same weekday or weekend every month, e.g., every second Tuesday each month. - INVALID_RECURRENCE = 10000, - UNDEFINED_RECURRENCE /* should be used only to mark a fact filter is not set */ - } EventRecurrence; - - typedef enum - { - TENTATIVE_STATUS, - CONFIRMED_STATUS, - CANCELLED_STATUS, - INVALID_STATUS = 10000, - UNDEFINED_STATUS /* should be used only to mark a fact filter is not set */ - } EventStatus; - - typedef enum - { - NO_ALARM, - SILENT_ALARM, - SOUND_ALARM, - INVALID_ALARM_TYPE = 10000, - UNDEFINED_ALARM_TYPE /* should be used only to mark a fact filter is not set */ - } EventAlarmType; - - CalendarEvent(); - virtual ~CalendarEvent(); - - int getId() const; - void setId(int value); - void resetId(); - - int getCalendarId() const; - void setCalendarId(int value); - - std::string getDescription() const; - void setDescription(const std::string &value); - - std::string getSubject() const; - void setSubject(const std::string &value); - - time_t getStartTime() const; - void setStartTime(time_t value); - - time_t getEndTime() const; - void setEndTime(time_t value); - - std::string getLocation() const; - void setLocation(const std::string &value); - - EventRecurrence getRecurrence() const; - void setRecurrence(EventRecurrence value); - - EventStatus getStatus() const; - void setStatus(EventStatus value); - - time_t getAlarmTime() const; - void setAlarmTime(time_t value); - void resetAlarmTime(); - - EventAlarmType getAlarmType() const; - void setAlarmType(EventAlarmType value); - - CategoryListPtr getCategories() const; - void setCategories(const CategoryListPtr &value); - - time_t getExpires() const; - void setExpires(time_t value); - void resetExpires(); - - int getInterval() const; - void setInterval(int value); - - void display() const; - bool validate() const; - - bool getIdIsSet() const; - bool getAlarmTimeIsSet() const; - bool getExpiresIsSet() const; - - protected: - DPL::Optional m_id; - int m_calendarId; - std::string m_description; - std::string m_subject; - std::time_t m_startTime; - std::time_t m_endTime; - std::string m_location; - EventRecurrence m_recurrence; - EventStatus m_status; - DPL::Optional m_alarmTime; - EventAlarmType m_alarmType; - CategoryListPtr m_categories; - DPL::Optional m_expires; - int m_interval; -}; - -typedef DPL::SharedPtr CalendarEventPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_CALENDAR_EVENT_H_ - diff --git a/src/modules/API/Calendar/CalendarFactory.cpp b/src/modules/API/Calendar/CalendarFactory.cpp deleted file mode 100644 index f5abb31..0000000 --- a/src/modules/API/Calendar/CalendarFactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "CalendarFactory.h" -#include "ICalendarManager.h" -#include "ICalendar.h" -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -ICalendarManagerPtr CalendarFactory::createCalendarManagerObject() -{ - ICalendarManagerPtr result(new CalendarManager()); - return result; -} - -ICalendarPtr CalendarFactory::createCalendarObject() -{ - ICalendarPtr result(new Calendar()); - return result; -} - -CalendarFactory& CalendarFactory::getInstance() -{ - static CalendarFactory theInstance; - return theInstance; -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Calendar/CalendarFactory.h b/src/modules/API/Calendar/CalendarFactory.h deleted file mode 100644 index 21e18b7..0000000 --- a/src/modules/API/Calendar/CalendarFactory.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ICalendarFactory.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_CALENDAR_FACTORY_H_ -#define WRTDEVICEAPIS_CALENDAR_CALENDAR_FACTORY_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class CalendarFactory : private DPL::Noncopyable -{ - private: - CalendarFactory() - { - } - public: - static CalendarFactory& getInstance(); - ICalendarManagerPtr createCalendarManagerObject(); - ICalendarPtr createCalendarObject(); -}; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_CALENDAR_FACTORY_H_ \ No newline at end of file diff --git a/src/modules/API/Calendar/EventAddEvent.h b/src/modules/API/Calendar/EventAddEvent.h deleted file mode 100644 index 852a50f..0000000 --- a/src/modules/API/Calendar/EventAddEvent.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_ADD_EVENT_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_ADD_EVENT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventAddEvent : public Commons::IEvent -{ - CalendarEventPtr m_eventAdd; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setEvent(CalendarEventPtr value) - { - m_eventAdd = value; - } - CalendarEventPtr getEvent() const - { - return m_eventAdd; - } - EventAddEvent() : m_eventAdd(NULL), - m_result(false) - { - LogDebug("entered"); - } - ~EventAddEvent() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventAddEventPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_ADD_EVENT_H_ diff --git a/src/modules/API/Calendar/EventCreateEvent.h b/src/modules/API/Calendar/EventCreateEvent.h deleted file mode 100644 index 124e83a..0000000 --- a/src/modules/API/Calendar/EventCreateEvent.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_CREATE_EVENT_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_CREATE_EVENT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventCreateEvent : public Commons::IEvent -{ - CalendarEventPtr m_event; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setEvent(CalendarEventPtr value) - { - m_event = value; - } - CalendarEventPtr getEvent() const - { - return m_event; - } - EventCreateEvent() : m_event(NULL), - m_result(false) - { - } - ~EventCreateEvent() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventCreateEventPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_CREATE_EVENT_H_ diff --git a/src/modules/API/Calendar/EventDeleteEvent.h b/src/modules/API/Calendar/EventDeleteEvent.h deleted file mode 100644 index a152425..0000000 --- a/src/modules/API/Calendar/EventDeleteEvent.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_DELETE_EVENT_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_DELETE_EVENT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventDeleteEvent : public Commons::IEvent -{ - CalendarEventPtr m_event; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setEvent(CalendarEventPtr value) - { - m_event = value; - } - CalendarEventPtr getEvent() const - { - return m_event; - } - EventDeleteEvent() : m_event(NULL), - m_result(false) - { - } - ~EventDeleteEvent() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventDeleteEventPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_DELETE_EVENT_H_ diff --git a/src/modules/API/Calendar/EventFilter.cpp b/src/modules/API/Calendar/EventFilter.cpp deleted file mode 100644 index 2cf25de..0000000 --- a/src/modules/API/Calendar/EventFilter.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "EventFilter.h" -#include - -/** - * @file EventFilter.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -EventFilter::EventFilter() -{ -} - -EventFilter::~EventFilter() -{ -} - -std::string EventFilter::getIdFilter() const -{ - return *m_id; -} - -void EventFilter::setIdFilter(const std::string &value) -{ - m_id = value; -} - -int EventFilter::getCalendarIdFilter() const -{ - return *m_calendarId; -} - -void EventFilter::setCalendarIdFilter(int value) -{ - m_calendarId = value; -} - -std::string EventFilter::getDescriptionFilter() const -{ - return *m_description; -} - -void EventFilter::setDescriptionFilter(const std::string &value) -{ - m_description = value; -} - -std::string EventFilter::getSubjectFilter() const -{ - return *m_subject; -} - -void EventFilter::setSubjectFilter(const std::string &value) -{ - m_subject = value; -} - -time_t EventFilter::getStartTimeMinFilter() const -{ - return *m_startTimeMin; -} - -time_t EventFilter::getStartTimeMaxFilter() const -{ - return *m_startTimeMax; -} - -void EventFilter::setStartTimeMinFilter(time_t value) -{ - m_startTimeMin = value; -} - -void EventFilter::setStartTimeMaxFilter(time_t value) -{ - m_startTimeMax = value; -} - -void EventFilter::setStartTimeFilter(time_t value) -{ - setStartTimeMinFilter(value); - setStartTimeMaxFilter(value); -} - -time_t EventFilter::getEndTimeMinFilter() const -{ - return *m_endTimeMin; -} - -time_t EventFilter::getEndTimeMaxFilter() const -{ - return *m_endTimeMax; -} - -void EventFilter::setEndTimeMinFilter(time_t value) -{ - m_endTimeMin = value; -} - -void EventFilter::setEndTimeMaxFilter(time_t value) -{ - m_endTimeMax = value; -} - -void EventFilter::setEndTimeFilter(time_t value) -{ - setEndTimeMinFilter(value); - setEndTimeMaxFilter(value); -} - -std::string EventFilter::getLocationFilter() const -{ - return *m_location; -} - -void EventFilter::setLocationFilter(const std::string &value) -{ - m_location = value; -} - -std::vector EventFilter::getRecurrenceFilter() -const -{ - return m_recurrence; -} - -void EventFilter::addRecurrenceFilter(CalendarEvent::EventRecurrence value) -{ - m_recurrence.push_back(value); -} - -std::vector EventFilter::getStatusFilter() const -{ - return m_status; -} - -void EventFilter::addStatusFilter(CalendarEvent::EventStatus value) -{ - m_status.push_back(value); -} - -time_t EventFilter::getAlarmTimeMinFilter() const -{ - return *m_alarmTimeMin; -} - -time_t EventFilter::getAlarmTimeMaxFilter() const -{ - return *m_alarmTimeMax; -} - -void EventFilter::setAlarmTimeMinFilter(time_t value) -{ - m_alarmTimeMin = value; -} - -void EventFilter::setAlarmTimeMaxFilter(time_t value) -{ - m_alarmTimeMax = value; -} - -void EventFilter::setAlarmTimeFilter(time_t value) -{ - setAlarmTimeMinFilter(value); - setAlarmTimeMaxFilter(value); -} - -std::vector EventFilter::getAlarmTypeFilter() -const -{ - return m_alarmType; -} - -void EventFilter::addAlarmTypeFilter(CalendarEvent::EventAlarmType value) -{ - m_alarmType.push_back(value); -} - -std::string EventFilter::getCategoryFilter() const -{ - return *m_category; -} - -void EventFilter::setCategoryFilter(const std::string &category) -{ - m_category = category; -} - -bool EventFilter::getIdIsSet() const -{ - return !m_id.IsNull(); -} - -bool EventFilter::getCalendarIdIsSet() const -{ - return !m_calendarId.IsNull(); -} - -bool EventFilter::getDescriptionIsSet() const -{ - return !m_description.IsNull(); -} - -bool EventFilter::getSubjectIsSet() const -{ - return !m_subject.IsNull(); -} - -bool EventFilter::getStartTimeMinIsSet() const -{ - return !m_startTimeMin.IsNull(); -} - -bool EventFilter::getStartTimeMaxIsSet() const -{ - return !m_startTimeMax.IsNull(); -} - -bool EventFilter::getEndTimeMinIsSet() const -{ - return !m_endTimeMin.IsNull(); -} - -bool EventFilter::getEndTimeMaxIsSet() const -{ - return !m_endTimeMax.IsNull(); -} - -bool EventFilter::getLocationIsSet() const -{ - return !m_location.IsNull(); -} - -bool EventFilter::getRecurrenceIsSet() const -{ - return !m_recurrence.empty(); -} - -bool EventFilter::getStatusIsSet() const -{ - return !m_status.empty(); -} - -bool EventFilter::getAlarmTimeMinIsSet() const -{ - return !m_alarmTimeMin.IsNull(); -} - -bool EventFilter::getAlarmTimeMaxIsSet() const -{ - return !m_alarmTimeMax.IsNull(); -} - -bool EventFilter::getAlarmTypeIsSet() const -{ - return !m_alarmType.empty(); -} - -bool EventFilter::getCategoryIsSet() const -{ - return !m_category.IsNull(); -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Calendar/EventFilter.h b/src/modules/API/Calendar/EventFilter.h deleted file mode 100644 index a829570..0000000 --- a/src/modules/API/Calendar/EventFilter.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file EventFilter.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_FILTER_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_FILTER_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventFilter -{ - public: - - EventFilter(); - virtual ~EventFilter(); - - std::string getIdFilter() const; - void setIdFilter(const std::string &value); - - int getCalendarIdFilter() const; - void setCalendarIdFilter(int value); - - std::string getDescriptionFilter() const; - void setDescriptionFilter(const std::string &value); - - std::string getSubjectFilter() const; - void setSubjectFilter(const std::string &value); - - std::time_t getStartTimeMinFilter() const; - std::time_t getStartTimeMaxFilter() const; - void setStartTimeMinFilter(std::time_t value); - void setStartTimeMaxFilter(std::time_t value); - void setStartTimeFilter(std::time_t value); - - std::time_t getEndTimeMinFilter() const; - std::time_t getEndTimeMaxFilter() const; - void setEndTimeMinFilter(std::time_t value); - void setEndTimeMaxFilter(std::time_t value); - void setEndTimeFilter(std::time_t value); - - std::string getLocationFilter() const; - void setLocationFilter(const std::string &value); - - std::vector getRecurrenceFilter() const; - void addRecurrenceFilter(CalendarEvent::EventRecurrence value); - - std::vector getStatusFilter() const; - void addStatusFilter(CalendarEvent::EventStatus value); - - std::time_t getAlarmTimeMinFilter() const; - std::time_t getAlarmTimeMaxFilter() const; - void setAlarmTimeMinFilter(std::time_t value); - void setAlarmTimeMaxFilter(std::time_t value); - void setAlarmTimeFilter(std::time_t value); - - std::vector getAlarmTypeFilter() const; - void addAlarmTypeFilter(CalendarEvent::EventAlarmType value); - - std::string getCategoryFilter() const; - void setCategoryFilter(const std::string &category); - - bool getIdIsSet() const; - bool getCalendarIdIsSet() const; - bool getDescriptionIsSet() const; - bool getSubjectIsSet() const; - bool getStartTimeMinIsSet() const; - bool getStartTimeMaxIsSet() const; - bool getEndTimeMinIsSet() const; - bool getEndTimeMaxIsSet() const; - bool getLocationIsSet() const; - bool getRecurrenceIsSet() const; - bool getStatusIsSet() const; - bool getAlarmTimeMinIsSet() const; - bool getAlarmTimeMaxIsSet() const; - bool getAlarmTypeIsSet() const; - bool getCategoryIsSet() const; - - protected: - DPL::Optional m_id; - DPL::Optional m_calendarId; - DPL::Optional m_description; - DPL::Optional m_subject; - DPL::Optional m_startTimeMin; - DPL::Optional m_startTimeMax; - DPL::Optional m_endTimeMin; - DPL::Optional m_endTimeMax; - DPL::Optional m_location; - std::vector m_recurrence; - std::vector m_status; - std::vector m_alarmType; - DPL::Optional m_alarmTimeMin; - DPL::Optional m_alarmTimeMax; - DPL::Optional m_category; -}; - -typedef DPL::SharedPtr EventFilterPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_FILTER_H_ diff --git a/src/modules/API/Calendar/EventFindEvents.h b/src/modules/API/Calendar/EventFindEvents.h deleted file mode 100644 index 790e630..0000000 --- a/src/modules/API/Calendar/EventFindEvents.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_FIND_EVENTS_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_FIND_EVENTS_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventFindEvents : public Commons::IEvent -{ - /* user is responsible to free objects inside list */ - std::vector m_events; //OUTPUT: result list - bool m_result; //OUTPUT: operation result - EventFilterPtr m_filter; //INPUT: filters - int m_firstEvent; //INPUT: index of first found event to include on list - int m_lastEvent; //INPUT: index of last found event to include on list - public: - void setFirstEvent(int value) - { - m_firstEvent = value; - } - int getFirstEvent() const - { - return m_firstEvent; - } - void setLastEvent(int value) - { - m_lastEvent = value; - } - int getLastEvent() const - { - return m_lastEvent; - } - void setFilter(EventFilterPtr value) - { - m_filter = value; - } - EventFilterPtr getFilter() const - { - return m_filter; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void addEvent(CalendarEventPtr value) - { - m_events.push_back(value); - } - std::vector getEvents() - { - return m_events; - } - EventFindEvents() : m_result(false), - m_firstEvent(0), - m_lastEvent(-1) - { - } - ~EventFindEvents() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventFindEventsPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_FIND_EVENTS_H_ diff --git a/src/modules/API/Calendar/EventGetCalendars.h b/src/modules/API/Calendar/EventGetCalendars.h deleted file mode 100644 index 0999de2..0000000 --- a/src/modules/API/Calendar/EventGetCalendars.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_GET_CALENDARS_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_GET_CALENDARS_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventGetCalendars : public Commons::IEvent -{ - std::vector m_calendars; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void addCalendar(ICalendarPtr value) - { - m_calendars.push_back(value); - } - std::vector getCalendars() const - { - return m_calendars; - } - EventGetCalendars() : m_result(false) - { - } - ~EventGetCalendars() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventGetCalendarsPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_UPDATE_EVENT_H_ diff --git a/src/modules/API/Calendar/EventUpdateEvent.h b/src/modules/API/Calendar/EventUpdateEvent.h deleted file mode 100644 index 31aaf95..0000000 --- a/src/modules/API/Calendar/EventUpdateEvent.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_IEVENT_UPDATE_EVENT_H_ -#define WRTDEVICEAPIS_CALENDAR_IEVENT_UPDATE_EVENT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class EventUpdateEvent : public Commons::IEvent -{ - CalendarEventPtr m_event; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setEvent(CalendarEventPtr value) - { - m_event = value; - } - CalendarEventPtr getEvent() const - { - return m_event; - } - - EventUpdateEvent() : m_event(NULL), - m_result(false) - { - } - ~EventUpdateEvent() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventUpdateEventPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_IEVENT_UPDATE_EVENT_H_ diff --git a/src/modules/API/Calendar/ICalendar.cpp b/src/modules/API/Calendar/ICalendar.cpp deleted file mode 100644 index 1f0052b..0000000 --- a/src/modules/API/Calendar/ICalendar.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ICalendar.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ICalendar.h" -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -ICalendar::ICalendar() : - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD), - m_id(0), - m_accountId(0), - m_type(DEVICE_CALENDAR) -{ -} - -ICalendar::~ICalendar() -{ -} - -void ICalendar::createEvent(const EventCreateEventPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ICalendar::addEvent(const EventAddEventPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ICalendar::updateEvent(const EventUpdateEventPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ICalendar::deleteEvent(const EventDeleteEventPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ICalendar::findEvents(const EventFindEventsPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Calendar/ICalendar.h b/src/modules/API/Calendar/ICalendar.h deleted file mode 100644 index 9a2b67b..0000000 --- a/src/modules/API/Calendar/ICalendar.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ICalendar.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_ICALENDAR_H_ -#define WRTDEVICEAPIS_CALENDAR_ICALENDAR_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class ICalendar : - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver -{ - public: - - typedef enum - { - SIM_CALENDAR, - DEVICE_CALENDAR - } CalendarType; - - ICalendar(); - virtual ~ICalendar(); - virtual void createEvent(const EventCreateEventPtr &event); - virtual void addEvent(const EventAddEventPtr &event); - virtual void updateEvent(const EventUpdateEventPtr &event); - virtual void deleteEvent(const EventDeleteEventPtr &event); - virtual void findEvents(const EventFindEventsPtr &event); - - virtual std::string getName() const - { - return m_name; - } - virtual void setName(const std::string &value) - { - m_name = value; - } - virtual CalendarType getType() const - { - return m_type; - } - virtual void setType(const CalendarType value) - { - m_type = value; - } - virtual int getId() const - { - return m_id; - } - virtual void setId(const int value) - { - m_id = value; - } - virtual int getAccountId() const - { - return m_accountId; - } - virtual void setAccountId(const int value) - { - m_accountId = value; - } - protected: - int m_id; - int m_accountId; - std::string m_name; - CalendarType m_type; - - virtual void OnRequestReceived(const EventAddEventPtr &event) = 0; - virtual void OnRequestReceived(const EventDeleteEventPtr &event) = 0; - virtual void OnRequestReceived(const EventUpdateEventPtr &event) = 0; - virtual void OnRequestReceived(const EventFindEventsPtr &event) = 0; - virtual void OnRequestReceived(const EventCreateEventPtr &event) = 0; -}; - -typedef DPL::SharedPtr ICalendarPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_ICALENDAR_H_ diff --git a/src/modules/API/Calendar/ICalendarManager.cpp b/src/modules/API/Calendar/ICalendarManager.cpp deleted file mode 100644 index 23b9557..0000000 --- a/src/modules/API/Calendar/ICalendarManager.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ICalendarManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ICalendarManager.h" -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -ICalendarManager::ICalendarManager() : - Commons::EventRequestReceiver( - Commons::ThreadEnum::CALENDAR_THREAD) -{ -} - -ICalendarManager::~ICalendarManager() -{ -} - -void ICalendarManager::getCalendars(const EventGetCalendarsPtr &event) -{ - LogDebug("entered"); - PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Calendar/ICalendarManager.h b/src/modules/API/Calendar/ICalendarManager.h deleted file mode 100644 index 404b72a..0000000 --- a/src/modules/API/Calendar/ICalendarManager.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ICalendarManager.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_ICALENDAR_MANAGER_H_ -#define WRTDEVICEAPIS_CALENDAR_ICALENDAR_MANAGER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { -namespace Api { - -class ICalendarManager : - public Commons::EventRequestReceiver -{ - public: - ICalendarManager(); - virtual ~ICalendarManager(); - virtual void getCalendars(const EventGetCalendarsPtr &event); - protected: - virtual void OnRequestReceived(const EventGetCalendarsPtr &event) = 0; -}; - -typedef DPL::SharedPtr ICalendarManagerPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_ICALENDAR_MANAGER_H_ diff --git a/src/modules/API/Calendar/config.cmake b/src/modules/API/Calendar/config.cmake deleted file mode 100644 index b112cc1..0000000 --- a/src/modules/API/Calendar/config.cmake +++ /dev/null @@ -1,15 +0,0 @@ -get_current_path() - -set(API_CALENDAR_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_CALENDAR - ${CURRENT_PATH}/CalendarEvent.cpp - ${CURRENT_PATH}/CalendarFactory.cpp - ${CURRENT_PATH}/EventFilter.cpp - ${CURRENT_PATH}/ICalendar.cpp - ${CURRENT_PATH}/ICalendarManager.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Camera/CameraFactory.cpp b/src/modules/API/Camera/CameraFactory.cpp deleted file mode 100644 index 9c3c588..0000000 --- a/src/modules/API/Camera/CameraFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "CameraFactory.h" -#include "ICameraManager.h" -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -ICameraManager& CameraFactory::getCameraManagerObject() -{ - static WrtDeviceApis::Camera::CameraManager camManagerInstance; - return camManagerInstance; -} - -CameraFactory& CameraFactory::getInstance() -{ - static CameraFactory theInstance; - return theInstance; -} - -} -} -} diff --git a/src/modules/API/Camera/CameraFactory.h b/src/modules/API/Camera/CameraFactory.h deleted file mode 100644 index 40ea87d..0000000 --- a/src/modules/API/Camera/CameraFactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * Created on: 2010-06-28 - * Author: kmajewski - */ - -#ifndef WRTDEVICEAPIS_CAMERA_CAMERAFACTORY_H_ -#define WRTDEVICEAPIS_CAMERA_CAMERAFACTORY_H_ - -#include "ICameraManager.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class CameraFactory : private DPL::Noncopyable -{ - private: - /** - * Private constructor to provide singleton - */ - CameraFactory() - {} - - public: - - /** - * Get camera manager - */ - ICameraManager& getCameraManagerObject(); - - /** - * Get singleton instance - */ - static CameraFactory& getInstance(); -}; - -} -} -} -#endif /* WRTPLUGINSCAMERAFACTORY_H_ */ diff --git a/src/modules/API/Camera/EventBeginRecording.h b/src/modules/API/Camera/EventBeginRecording.h deleted file mode 100644 index e74cae6..0000000 --- a/src/modules/API/Camera/EventBeginRecording.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_IEVENTBEGINRECORDING_H_ -#define WRTDEVICEAPIS_CAMERA_IEVENTBEGINRECORDING_H_ - -#include -#include -#include "ICaptureOptions.h" -#include "SupportCameraPendingOperation.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class EventBeginRecording : - public WrtDeviceApis::Commons::IEvent, - public SupportCameraPendingOperation -{ -public: - /* - * Sets the capture options that will be used while taking picture. - * EventTakePicture will take ownership of the object - * (it will delete it when will not be needed any more) - */ - void setCaptureOptionsRef(const ICaptureOptionsPtr &captureOptions) - { - m_captureOptions = captureOptions; - } - - explicit EventBeginRecording() : m_captureOptions(NULL) - { - } - - ICaptureOptionsPtr getCaptureOptionsRef() const {return m_captureOptions;} - -private: - ICaptureOptionsPtr m_captureOptions; -}; - -typedef DPL::SharedPtr EventBeginRecordingSharedPtr; - -} -} -} -#endif /* WRTPLUGINSIEVENTBEGINRECORDING_H_ */ diff --git a/src/modules/API/Camera/EventEndRecording.h b/src/modules/API/Camera/EventEndRecording.h deleted file mode 100644 index effcfac..0000000 --- a/src/modules/API/Camera/EventEndRecording.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_IEVENTENDRECORDING_H_ -#define WRTDEVICEAPIS_CAMERA_API_IEVENTENDRECORDING_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class EventEndRecording : - public WrtDeviceApis::Commons::IEvent -{ -}; - -typedef DPL::SharedPtr EventEndRecordingSharedPtr; - -} -} -} -#endif /* */ diff --git a/src/modules/API/Camera/EventGetCameras.h b/src/modules/API/Camera/EventGetCameras.h deleted file mode 100644 index 8f24f7e..0000000 --- a/src/modules/API/Camera/EventGetCameras.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTPLUGINSIEVENTGETCAMERAS_H_ -#define WRTPLUGINSIEVENTGETCAMERAS_H_ - -#include -#include -#include -#include -#include -#include "ICamera.h" -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class EventGetCameras : - public WrtDeviceApis::Commons::ConfigurationSupport, - public WrtDeviceApis::Commons::IEvent -{ -public: - EventGetCameras() : m_defaultCameraIndex(0) {} - - void setCamerasRef(const std::vector< ICameraSharedPtr > &cameras, - std::size_t defaultCameraIndex) - { - m_cameras = cameras; - m_defaultCameraIndex = defaultCameraIndex; - } - - ICameraSharedPtr getCamera(std::size_t index) - { - if (index >= m_cameras.size() || m_cameras.size() == 0) { - Throw(Commons::InvalidArgumentException); - } - return m_cameras[index]; - } - - ICameraSharedPtr getDefaultCamera() - { - if (m_cameras.empty()) { - LogError("There are no cameras to choose from"); - Throw(Commons::OutOfRangeException); - } - if (m_defaultCameraIndex >= m_cameras.size()) { - LogError("Default camera index is out of range"); - Throw(Commons::InvalidArgumentException); - } - return m_cameras[m_defaultCameraIndex]; - } - - std::size_t getNumberOfCameras(){ return m_cameras.size(); } - -private: - std::vector< ICameraSharedPtr > m_cameras; - std::size_t m_defaultCameraIndex; -}; - -typedef DPL::SharedPtr EventGetCamerasPtr; -} -} -} -#endif /* */ diff --git a/src/modules/API/Camera/EventGetPreviewNode.h b/src/modules/API/Camera/EventGetPreviewNode.h deleted file mode 100644 index 98534d1..0000000 --- a/src/modules/API/Camera/EventGetPreviewNode.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_EVENTGETPREVIEWNODE_H_ -#define WRTDEVICEAPIS_CAMERA_API_EVENTGETPREVIEWNODE_H_ - -#include -#include -#include "SupportCameraPendingOperation.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class EventGetPreviewNode : - public WrtDeviceApis::Commons::IEvent, - public SupportCameraPendingOperation -{ -public: - typedef void* PreviewNode; - -public: - EventGetPreviewNode() : m_node(NULL){} - - void setPreviewNode(PreviewNode node) {m_node = node;} - - PreviewNode getPreviewNode() const {return m_node;} - -private: - PreviewNode m_node; -}; - -typedef DPL::SharedPtr EventGetPreviewNodeSharedPtr; - -} -} -} -#endif // WRTDEVICEAPIS_CAMERA_API_EVENTGETPREVIEWNODE_H_ diff --git a/src/modules/API/Camera/EventTakePicture.h b/src/modules/API/Camera/EventTakePicture.h deleted file mode 100644 index 0cd9fef..0000000 --- a/src/modules/API/Camera/EventTakePicture.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_IEVENTTAKEPICTURE_H_ -#define WRTDEVICEAPIS_CAMERA_API_IEVENTTAKEPICTURE_H_ - -#include -#include -#include "ICaptureOptions.h" -#include "SupportCameraPendingOperation.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class EventTakePicture : - public WrtDeviceApis::Commons::IEvent, - public SupportCameraPendingOperation -{ - private: - ICaptureOptionsPtr m_captureOptions; - - public: - /* - * Sets the capture options that will be used while taking picture. - * EventTakePicture will take ownership of the object - * (it will delete it when will not be needed any more) - */ - void setCaptureOptionsRef(const ICaptureOptionsPtr &captureOptions) - { - m_captureOptions = captureOptions; - } - - ICaptureOptionsPtr getCaptureOptionsRef() const { return m_captureOptions;} -}; - -typedef DPL::SharedPtr EventTakePictureSharedPtr; - -} -} -} -#endif /* WRTPLUGINSIEVENTTAKEPICTURE_H_ */ diff --git a/src/modules/API/Camera/ICamera.h b/src/modules/API/Camera/ICamera.h deleted file mode 100644 index 61b2077..0000000 --- a/src/modules/API/Camera/ICamera.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_ICAMERA_H_ -#define WRTDEVICEAPIS_CAMERA_API_ICAMERA_H_ - -#include -#include -#include -#include -#include -#include -#include "EventBeginRecording.h" -#include "EventEndRecording.h" -#include "EventTakePicture.h" -#include "EventGetPreviewNode.h" - - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -typedef Commons::EventRequestReceiver - EventSupportTakePicture; -typedef Commons::EventRequestReceiver - EventSupportBeginRecording; -typedef Commons::EventRequestReceiver - EventSupportEndRecording; -typedef Commons::EventRequestReceiver - EventSupportGetPreviewNode; - -typedef Commons::IExternEventCanceler - SupportCancelRecording; -typedef Commons::IExternEventCanceler - SupportCancelTakePicture; -typedef Commons::IExternEventCanceler - SupportCancelGetPreview; -typedef Commons::ThreadEnum Thread; - -class ICamera : public EventSupportTakePicture, - public EventSupportBeginRecording, - public EventSupportEndRecording, - public EventSupportGetPreviewNode, - public SupportCancelRecording, - public SupportCancelTakePicture, - public SupportCancelGetPreview -{ -public: - ICamera() : - EventSupportTakePicture(Thread::CAMERA_THREAD), - EventSupportBeginRecording(Thread::CAMERA_THREAD), - EventSupportEndRecording(Thread::CAMERA_THREAD), - EventSupportGetPreviewNode(Thread::CAMERA_THREAD) - { - } - - virtual std::string getDescription() const - { - return ""; - } - - /** - * Takes picture - */ - void takePicture(const EventTakePictureSharedPtr &event) - { - EventSupportTakePicture::PostRequest(event); - } - - /** - * Begins recording - */ - virtual void beginRecording(const EventBeginRecordingSharedPtr &event) - { - EventSupportBeginRecording::PostRequest(event); - } - - /** - * Ends recording - */ - virtual void endRecording(const EventEndRecordingSharedPtr &event, - double delay = 0.0) - { - EventSupportEndRecording::PostRequest(event,delay); - } - - /** - * Requests preview window - */ - void createPreview(const EventGetPreviewNodeSharedPtr &event) - { - EventSupportGetPreviewNode::PostRequest(event); - } - - virtual void OnCancelEvent(const EventBeginRecordingSharedPtr& /*event*/) {} - virtual void OnCancelEvent(const EventTakePictureSharedPtr& /*event*/) {} - virtual void OnCancelEvent(const EventGetPreviewNodeSharedPtr& /*event*/) {} - - virtual void OnRequestReceived( - const EventTakePictureSharedPtr &event) = 0; - virtual void OnRequestReceived( - const EventBeginRecordingSharedPtr &event) = 0; - virtual void OnRequestReceived( - const EventEndRecordingSharedPtr &event) = 0; - virtual void OnRequestReceived( - const EventGetPreviewNodeSharedPtr &event) = 0; - - virtual ~ICamera() - { - } -}; - -typedef DPL::SharedPtr ICameraSharedPtr; - -} -} -} -#endif /* */ diff --git a/src/modules/API/Camera/ICameraFeature.h b/src/modules/API/Camera/ICameraFeature.h deleted file mode 100644 index 881dfcb..0000000 --- a/src/modules/API/Camera/ICameraFeature.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_ICAMERAFEATURE_H_ -#define WRTDEVICEAPIS_CAMERA_API_ICAMERAFEATURE_H_ - -#include -#include "IFeatureValue.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class ICameraFeature -{ - enum Types - { - //camera feature is represented by an interval. - FEATURETYPE_INTERVAL = 0, - //camera feature is represented binary. - FEATURETYPE_BINARY = 1, - //camera feature is represented by an enumeration. - FEATURETYPE_ENUMERATION = 2 - }; - - private: - //A optional description of the feature. - std::string m_description; - - //The unique feature identifier. - long m_id; - - //The type of the camera feature. - Types m_type; - - //The current value of the camera feature. - IFeatureValue m_value; - - //The default value of the camera feature. - IFeatureValue m_default; - - //A set of feature values that represents the allowed feature configurations - //IFeatureValue *m_possibleValues; - - public: - ICameraFeature(); - virtual ~ICameraFeature(); -}; - -} -} -} -#endif /* WRTPLUGINSICAMERAFEATURE_H_ */ diff --git a/src/modules/API/Camera/ICameraManager.h b/src/modules/API/Camera/ICameraManager.h deleted file mode 100644 index b9d732e..0000000 --- a/src/modules/API/Camera/ICameraManager.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_ICAMERAMANAGER_H_ -#define WRTDEVICEAPIS_CAMERA_API_ICAMERAMANAGER_H_ - -#include -#include -#include -#include -#include "EventGetCameras.h" -#include "ICamera.h" - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -typedef Commons::EventRequestReceiver - EventSupportGetCameras; - -class ICameraManager : public EventSupportGetCameras -{ -public: - /** - * Gets cameras - */ - virtual void getCameras(const EventGetCamerasPtr &event) - { - LogDebug(__FUNCTION__); - PostRequest(event); - } - - virtual ~ICameraManager() {} - -protected: - ICameraManager() : EventSupportGetCameras(Thread::CAMERA_THREAD) - {} - - virtual void OnRequestReceived(const EventGetCamerasPtr &event) = 0; - -protected: - std::vector< ICameraSharedPtr > m_cameras; -}; - -}//namespace -}//namespace -}//namespace - -#endif /* */ diff --git a/src/modules/API/Camera/ICaptureOptions.h b/src/modules/API/Camera/ICaptureOptions.h deleted file mode 100644 index 6a6fc44..0000000 --- a/src/modules/API/Camera/ICaptureOptions.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_ICAPTUREOPTIONS_H_ -#define WRTDEVICEAPIS_CAMERA_API_ICAPTUREOPTIONS_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class ICaptureOptions -{ - public: - - /** - * Available attributes - */ - enum AttributesFlags - { - SETTED_WIDTH = 1 << 0, - SETTED_HEIGHT = 1 << 1, - SETTED_FRAME_RATE = 1 << 2, - SETTED_MAX_BITRATE = 1 << 3, - SETTED_FILE_NAME = 1 << 4, - SETTED_IMAGE_RESOLUTION = 1 << 5 - }; - - /** - * Available picture details levels - */ - enum ImageResolution - { - IMAGE_RESOLUTION_HIGH, - IMAGE_RESOLUTION_LOW, - IMAGE_RESOLUTION_DEFAULT - }; - - ICaptureOptions() : - m_settedFlags(0), - m_width(0), - m_height(0), - m_frameRate(0.0), - m_imageResolution(IMAGE_RESOLUTION_DEFAULT), - m_maximumBitrate(0), - m_overwrite(true) - { - } - - virtual ~ICaptureOptions() - { - } - - /** - * Check for attribute correctness - */ - bool isAttributeValid(const AttributesFlags flag) const - { - return (flag & m_settedFlags) == flag; - } - - /** - * Gets frame rate - */ - float getFrameRate() const - { - return m_frameRate; - } - - /** - * Gets height - */ - unsigned short getHeight() const - { - return m_height; - } - - /** - * Gets video maximum bitrate - */ - unsigned long getMaximumBitrate() const - { - return m_maximumBitrate; - } - - /** - * Gets image resolution - */ - ImageResolution getImageResolution() const - { - return m_imageResolution; - } - - /** - * Gets filename - */ - std::string getFileName() const - { - return m_capturedFileName; - } - - /** - * Gets width - */ - unsigned short getWidth() const - { - return m_width; - } - - /** - * Gets whether output file should be overwritten if already exists. - * @return True if should be overwritten, false otherwise. - */ - bool getOverwrite() const - { - return m_overwrite; - } - - /** - * Sets video frame rate - */ - void setFrameRate(float frameRate) - { - this->m_frameRate = frameRate; - setFlag(SETTED_FRAME_RATE); - } - - /** - * Sets height - */ - void setHeight(unsigned short height) - { - this->m_height = height; - setFlag(SETTED_HEIGHT); - } - - /** - * Sets video maximum bitrate - */ - void setMaximumBitrate(unsigned long maximumBitrate) - { - this->m_maximumBitrate = maximumBitrate; - setFlag(SETTED_MAX_BITRATE); - } - - /** - * Sets image resolution - */ - void setImageResolution(ImageResolution imageResolution) - { - this->m_imageResolution = imageResolution; - setFlag(SETTED_IMAGE_RESOLUTION); - } - - /** - * Sets filename - */ - void setFileName(const std::string &fileName) - { - this->m_capturedFileName = fileName; - setFlag(SETTED_FILE_NAME); - } - - /** - * Sets width - */ - void setWidth(unsigned short width) - { - this->m_width = width; - setFlag(SETTED_WIDTH); - } - - /** - * Sets if output file should be overwritten if already exists. - * @param overwrite - */ - void setOverwrite(bool overwrite) - { - m_overwrite = overwrite; - } - - private: - - unsigned short m_settedFlags; - - void setFlag(AttributesFlags flag) - { - m_settedFlags = m_settedFlags | flag; - } - - //The desired width of the video or picture - unsigned short m_width; - - //The desired height of the video or picture. - unsigned short m_height; - - //The desired frame rate for video records. - float m_frameRate; - - //The desired resolution of a picture. - ImageResolution m_imageResolution; - - //The desired name of file with captured data - std::string m_capturedFileName; - - //The desired maximum bit rate of the recorded video media. - unsigned long m_maximumBitrate; - - /** - * Indicates whether file should be overwritten if already exists. - */ - bool m_overwrite; -}; - -typedef DPL::SharedPtr ICaptureOptionsPtr; - -} -} -} -#endif /* WRTPLUGINSICAPTUREOPTIONS_H_ */ diff --git a/src/modules/API/Camera/IFeatureValue.h b/src/modules/API/Camera/IFeatureValue.h deleted file mode 100644 index 1ab2cf5..0000000 --- a/src/modules/API/Camera/IFeatureValue.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_IFEATUREVALUE_H_ -#define WRTDEVICEAPIS_CAMERA_API_IFEATUREVALUE_H_ - -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -class IFeatureValue -{ - public: - enum IdType - { - ZOOM, - NO_ZOOM, - CONTRAST, - BRIGHTNESS, - COLORTEMPERATURE, - NIGHTMODE, - MANUALFOCUS, - FOCUS, - LIGHT, - FLASH - }; - private: - //The feature value identifier. - unsigned short m_id; - - //An optional description of the feature value. - std::string m_description; - - public: - IFeatureValue(); - virtual ~IFeatureValue(); -}; - -} -} -} -#endif /* WRTPLUGINSIFEATUREVALUE_H_ */ diff --git a/src/modules/API/Camera/SupportCameraPendingOperation.h b/src/modules/API/Camera/SupportCameraPendingOperation.h deleted file mode 100644 index 13e1a7d..0000000 --- a/src/modules/API/Camera/SupportCameraPendingOperation.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CAMERA_API_SUPPORT_CAMERA_PENDING_OPERATION_H_ -#define WRTDEVICEAPIS_CAMERA_API_SUPPORT_CAMERA_PENDING_OPERATION_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Camera { -namespace Api { - -typedef WrtDeviceApis::CommonsJavaScript::SupportPendingOperation - SupportCameraPendingOperation; - -} -} -} - -#endif diff --git a/src/modules/API/Camera/config.cmake b/src/modules/API/Camera/config.cmake deleted file mode 100644 index ed04c0d..0000000 --- a/src/modules/API/Camera/config.cmake +++ /dev/null @@ -1,11 +0,0 @@ -get_current_path() - -set(API_CAMERA_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_CAMERA - ${CURRENT_PATH}/CameraFactory.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Contact/Contact.cpp b/src/modules/API/Contact/Contact.cpp deleted file mode 100644 index eda5333..0000000 --- a/src/modules/API/Contact/Contact.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file Contact.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * - */ - -#include "Contact.h" - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -Contact::Contact() : - //initialize fields - m_id(-1), - m_fullNameIsSet(false), - m_firstNameIsSet(false), - m_lastNameIsSet(false), - m_phoneticNameIsSet(false), - m_companyIsSet(false), - m_titleIsSet(false), - m_photoUriIsSet(false), - m_ringTonePathIsSet(false) -{ - LogDebug("entered"); -} - -Contact::~Contact() -{ - //nothing to do in destructor - LogDebug("entered"); -} - -int Contact::getId() const -{ - //return id of contact - return m_id; -} - -void Contact::setId(int value) -{ - //set new id of contact - m_id = value; -} - -std::string Contact::getFullName() const -{ - //return fullname - //when fullname is not set then return concatendation of first name and last name - return m_fullName.empty() ? m_firstName + " " + m_lastName : m_fullName; -} - -void Contact::setFullName(const std::string &value) -{ - //set fullname value - m_fullName = value; - //mark full name as set - m_fullNameIsSet = true; -} - -std::string Contact::getFirstName() const -{ - //return first name - return m_firstName; -} - -void Contact::setFirstName(const std::string &value) -{ - //set first name - m_firstName = value; - //mark first name as set - m_firstNameIsSet = true; -} - -std::string Contact::getLastName() const -{ - //return last name - return m_lastName; -} - -void Contact::setLastName(const std::string &value) -{ - //set last name - m_lastName = value; - //mark last name as set - m_lastNameIsSet = true; -} - -const std::vector &Contact::getNickNames() const -{ - //returns nicknames array - return m_nicknames; -} - -void Contact::setNickNames(const std::vector &value) -{ - //set new nicknames - m_nicknames = value; -} - -std::string Contact::getPhoneticName() const -{ - //return phoneticName - return m_phoneticName; -} - -void Contact::setPhoneticName(const std::string &value) -{ - //set new phoneticName - m_phoneticName = value; - m_phoneticNameIsSet = true; -} - -const std::vector &Contact::getAddresses() const -{ - //return addresses array - return m_addresses; -} - -void Contact::setAddresses(const std::vector &value) -{ - //set new addresses - m_addresses = value; -} - -std::string Contact::getPhotoUri() const -{ - //return photo uri - return m_photoUri; -} - -void Contact::setPhotoUri(const std::string &value) -{ - //set new photo uri - m_photoUri = value; - //mark photo uri as set - m_photoUriIsSet = true; -} - -std::string Contact::getRingTonePath() const -{ - //return ring tone - return m_ringTonePath; -} - -void Contact::setRingTonePath(const std::string &value) -{ - //set new ring tone - m_ringTonePath = value; - //mark ringtone as set - m_ringTonePathIsSet = true; -} - -const std::vector &Contact::getPhoneNumbers() const -{ - //return phone numbers - return m_phoneNumbers; -} - -void Contact::setPhoneNumbers(const std::vector &value) -{ - //set new phone numbers - m_phoneNumbers = value; -} - -const std::vector &Contact::getEmails() const -{ - //return emails - return m_emails; -} - -void Contact::setEmails(const std::vector &value) -{ - //set new emails - m_emails = value; -} - -std::string Contact::getCompany() const -{ - //return company - return m_company; -} - -void Contact::setCompany(const std::string &value) -{ - //set new company - m_company = value; - //mark company as set - m_companyIsSet = true; -} - -std::string Contact::getTitle() const -{ - //return title - return m_title; -} - -void Contact::setTitle(const std::string &value) -{ - //set new title - m_title = value; - //mark title as set - m_titleIsSet = true; -} - -const std::vector &Contact::getGroups() const -{ - //returns groups - return m_groups; -} - -void Contact::setGroups(const std::vector &value) -{ - //set new groups - m_groups = value; -} - -bool Contact::getIdIsSet() const -{ - //return true when id is set - return m_id != -1; -} - -bool Contact::getFullNameIsSet() const -{ - //return true when fullname is set - return m_fullNameIsSet; -} - -bool Contact::getFirstNameIsSet() const -{ - //return true when first name is set - return m_firstNameIsSet; -} - -bool Contact::getLastNameIsSet() const -{ - //return true when last name is set - return m_lastNameIsSet; -} - -bool Contact::getCompanyIsSet() const -{ - //return true when company is set - return m_companyIsSet; -} - -bool Contact::getTitleIsSet() const -{ - //return true when title is set - return m_titleIsSet; -} - -bool Contact::getPhotoIsSet() const -{ - //return true when photo uri is set - return m_photoUriIsSet; -} - -bool Contact::getRingPathIsSet() const -{ - //return true when ring tone is set - return m_ringTonePathIsSet; -} - -bool Contact::getNicknameIsSet() const -{ - //return true when nicknames is set - return m_nicknames.size() != 0; -} - -bool Contact::getPhoneticIsSet() const -{ - //return true when phoneticName is set - return m_phoneticNameIsSet; -} - -bool Contact::getAddressIsSet() const -{ - //return true when addressess are set - return m_addresses.size() != 0; -} - -bool Contact::getPhoneNumberIsSet() const -{ - //return true when phone numbers are set - return m_phoneNumbers.size() != 0; -} - -bool Contact::getEmailIsSet() const -{ - //return true when emails are set - return m_emails.size() != 0; -} - -void Contact::clear() -{ - LogDebug("entered"); - //clear all fields - m_id = -1; - m_fullName.clear(); - m_firstName.clear(); - m_lastName.clear(); - m_nicknames.clear(); - m_addresses.clear(); - m_photoUri.clear(); - m_phoneNumbers.clear(); - m_emails.clear(); - m_company.clear(); - m_title.clear(); - m_groups.clear(); - //mark fields as not set - m_fullNameIsSet = false; - m_firstNameIsSet = false; - m_lastNameIsSet = false; - m_phoneticNameIsSet = false; - m_companyIsSet = false; - m_titleIsSet = false; - m_photoUriIsSet = false; - m_ringTonePathIsSet = false; -} - -ContactPtr Contact::clone() -{ - //clone object - //use defaul copy constructor - ContactPtr result(new Contact(*this)); - std::vector addresses; - std::vector phoneNumbers; - std::vector emails; - //clone internal representation of addresses - for (std::size_t i = 0; i < m_addresses.size(); ++i) { - addresses.push_back(m_addresses[i]->clone()); - } - result->setAddresses(addresses); - //clone internal representation of phone numbers - for (std::size_t i = 0; i < m_phoneNumbers.size(); ++i) { - phoneNumbers.push_back(m_phoneNumbers[i]->clone()); - } - result->setPhoneNumbers(phoneNumbers); - //clone internal representation of emails - for (std::size_t i = 0; i < m_emails.size(); ++i) { - emails.push_back(m_emails[i]->clone()); - } - result->setEmails(emails); - return result; -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Contact/Contact.h b/src/modules/API/Contact/Contact.h deleted file mode 100644 index 70e7189..0000000 --- a/src/modules/API/Contact/Contact.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Contact.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_H_ - -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class Contact; - -typedef DPL::SharedPtr ContactPtr; - -/* This object represents a single contact in address book */ -class Contact -{ - public: - Contact(); - ~Contact(); - - int getId() const; - void setId(int value); - - std::string getFullName() const; - void setFullName(const std::string &value); - - std::string getFirstName() const; - void setFirstName(const std::string &value); - - std::string getLastName() const; - void setLastName(const std::string &value); - - const std::vector &getNickNames() const; - void setNickNames(const std::vector &value); - - std::string getPhoneticName() const; - void setPhoneticName(const std::string &value); - - const std::vector &getAddresses() const; - void setAddresses(const std::vector &value); - - std::string getPhotoUri() const; - void setPhotoUri(const std::string &value); - - std::string getRingTonePath() const; - void setRingTonePath(const std::string &value); - - const std::vector &getPhoneNumbers() const; - void setPhoneNumbers(const std::vector &value); - - const std::vector &getEmails() const; - void setEmails(const std::vector &value); - - std::string getCompany() const; - void setCompany(const std::string &value); - - std::string getTitle() const; - void setTitle(const std::string &value); - - const std::vector &getGroups() const; - void setGroups(const std::vector &value); - - void clear(); - ContactPtr clone(); - - bool getIdIsSet() const; - bool getFullNameIsSet() const; - bool getFirstNameIsSet() const; - bool getLastNameIsSet() const; - bool getCompanyIsSet() const; - bool getTitleIsSet() const; - bool getPhotoIsSet() const; - bool getNicknameIsSet() const; - bool getPhoneticIsSet() const; - bool getAddressIsSet() const; - bool getPhoneNumberIsSet() const; - bool getEmailIsSet() const; - bool getRingPathIsSet() const; - - private: - int m_id; - std::string m_fullName; //display name e.g. m_firstName + m_lastName - std::string m_firstName; - std::string m_lastName; - std::vector m_nicknames; - std::string m_phoneticName; - std::vector m_addresses; - std::string m_photoUri; - std::string m_ringTonePath; - std::vector m_phoneNumbers; - std::vector m_emails; - std::string m_company; - std::string m_title; - std::vector m_groups; - - bool m_fullNameIsSet; - bool m_firstNameIsSet; - bool m_lastNameIsSet; - bool m_phoneticNameIsSet; - bool m_companyIsSet; - bool m_titleIsSet; - bool m_photoUriIsSet; - bool m_ringTonePathIsSet; -}; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_H_ \ No newline at end of file diff --git a/src/modules/API/Contact/ContactAddress.cpp b/src/modules/API/Contact/ContactAddress.cpp deleted file mode 100644 index 091f590..0000000 --- a/src/modules/API/Contact/ContactAddress.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file ContactEmail.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * - */ - -#include -#include "ContactAddress.h" - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -ContactAddress::ContactAddress() : - //initialize fields - m_id(-1), - m_countryIsSet(false), - m_regionIsSet(false), - m_countyIsSet(false), - m_cityIsSet(false), - m_streetIsSet(false), - m_streetNumberIsSet(false), - m_premisesIsSet(false), - m_additionalInformationIsSet(false), - m_postalCodeIsSet(false) -{ - //nothing to do -} - -ContactAddress::~ContactAddress() -{ - //nothing to do -} - -bool ContactAddress::compareTo(const ContactAddressPtr &address, - bool includeId, - bool includeTypes) const -{ - //compare basic fields - if ((!includeId || m_id == address->getId()) && - m_country == address->getCountry() && - m_region == address->getRegion() && - m_county == address->getCounty() && - m_city == address->getCity() && - m_street == address->getStreet() && - m_streetNumber == address->getStreetNumber() && - m_premises == address->getPremises() && - m_additionalInformation == address->getAdditionalInformation() && - m_postalCode == address->getPostalCode()) { - //if not include fields then addresses are equal - if (!includeTypes) { - return true; - } - //if types have different sizes then addresses are different - if (m_types.size() != address->getTypes().size()) { - return false; - } - //compare each type - for (size_t i = 0; i < address->getTypes().size(); i++) { - if (!isTypeOf(address->getTypes()[i])) { - return false; - } - } - return true; - } - return false; -} - -ContactAddressPtr ContactAddress::clone() const -{ - //clone object by using copy constructors - return ContactAddressPtr(new ContactAddress(*this)); -} - -std::string ContactAddress::getAsSingleString() const -{ - std::string fullAddress; - //add street and street number when not empty - if (!m_street.empty()) { - fullAddress = m_street; - if (!m_streetNumber.empty()) { - fullAddress += " " + m_streetNumber; - } - } - //add city and postal code when not empty - if (!m_city.empty()) { - if (!fullAddress.empty()) { - fullAddress += " "; - } - if (!m_postalCode.empty()) { - fullAddress += m_postalCode + " " + m_city; - } else { - fullAddress += m_city; - } - } - //add country when not empty - if (!m_country.empty()) { - if (!fullAddress.empty()) { - fullAddress += " " + m_country; - } else { - fullAddress = m_country; - } - } - if (!fullAddress.empty()) { - return fullAddress; - } - //when no data on detailed fields, then return free form field - return m_address; -} - -std::string ContactAddress::getAddress() const -{ - //return free form field for address - return m_address; -} - -void ContactAddress::setAddress(const std::string &value) -{ - //set free form field for address - m_address = value; -} - -int ContactAddress::getId() const -{ - //return id of address record - return m_id; -} - -void ContactAddress::setId(int value) -{ - //set id of address record - m_id = value; -} - -std::string ContactAddress::getCountry() const -{ - //return country - return m_country; -} - -void ContactAddress::setCountry(const std::string &value) -{ - //set new contry - m_country = value; - //mark country as set - m_countryIsSet = true; -} - -std::string ContactAddress::getRegion() const -{ - //return region - return m_region; -} - -void ContactAddress::setRegion(const std::string &value) -{ - //set new region - m_region = value; - //mark region as set - m_regionIsSet = true; -} - -std::string ContactAddress::getCounty() const -{ - //return county - return m_county; -} - -void ContactAddress::setCounty(const std::string &value) -{ - //set new county - m_county = value; - //set county as set - m_countyIsSet = true; -} - -std::string ContactAddress::getCity() const -{ - //return city - return m_city; -} - -void ContactAddress::setCity(const std::string &value) -{ - //set new city - m_city = value; - //set city as marked - m_cityIsSet = true; -} - -std::string ContactAddress::getStreet() const -{ - //return street - return m_street; -} - -void ContactAddress::setStreet(const std::string &value) -{ - //set street - m_street = value; - //mark streen as set - m_streetIsSet = true; -} - -std::string ContactAddress::getStreetNumber() const -{ - //return street number - return m_streetNumber; -} - -void ContactAddress::setStreetNumber(const std::string &value) -{ - //set street number - m_streetNumber = value; - //mark streen number as set - m_streetNumberIsSet = true; -} - -std::string ContactAddress::getPremises() const -{ - //return premises - return m_premises; -} - -void ContactAddress::setPremises(const std::string &value) -{ - //set premises - m_premises = value; - //mark premises as set - m_premisesIsSet = true; -} - -std::string ContactAddress::getAdditionalInformation() const -{ - //return additional information - return m_additionalInformation; -} - -void ContactAddress::setAdditionalInformation(const std::string &value) -{ - //set additional information - m_additionalInformation = value; - //mark additional information as set - m_additionalInformationIsSet = true; -} - -std::string ContactAddress::getPostalCode() const -{ - //returns postal code - return m_postalCode; -} - -void ContactAddress::setPostalCode(const std::string &value) -{ - //set new postal code - m_postalCode = value; - //mark postal code as set - m_postalCodeIsSet = true; -} - -std::vector ContactAddress::getTypes() -const -{ - //return address types - return m_types; -} - -void ContactAddress::addType(const ContactAddressType value) -{ - //add new type to set - m_types.push_back(value); -} - -void ContactAddress::setTypes(const std::vector &value) -{ - //set types - m_types = value; -} - -bool ContactAddress::isTypeOf(const ContactAddressType value) const -{ - //return true when address is type of type passed as argument - return std::find(m_types.begin(), m_types.end(), value) != m_types.end(); -} - -void ContactAddress::setTypeFilter(const ContactAddressType value) -{ - //clear existing types and add new one - m_types.clear(); - m_types.push_back(value); -} - -ContactAddress::ContactAddressType ContactAddress::getTypeFilter() const -{ - //return first type or undefined when non set - return m_types.size() == 0 ? CONTACT_ADDRESS_TYPE_PREF : m_types[0]; -} - -bool ContactAddress::getCountryIsSet() const -{ - //returns true when contry is set - return m_countryIsSet; -} - -bool ContactAddress::getRegionIsSet() const -{ - //returns true when region is set - return m_regionIsSet; -} - -bool ContactAddress::getCountyIsSet() const -{ - //returns true when county is set - return m_countyIsSet; -} - -bool ContactAddress::getCityIsSet() const -{ - //returns true when city is set - return m_cityIsSet; -} - -bool ContactAddress::getStreetIsSet() const -{ - //returns true when street is set - return m_streetIsSet; -} - -bool ContactAddress::getStreetNumberIsSet() const -{ - //returns true when street number is set - return m_streetNumberIsSet; -} - -bool ContactAddress::getPremisesIsSet() const -{ - //returns true when premises is set - return m_premisesIsSet; -} - -bool ContactAddress::getAdditionalInformationIsSet() const -{ - //returns true when additional information is set - return m_additionalInformationIsSet; -} - -bool ContactAddress::getPostalCodeIsSet() const -{ - //returns true when postal code is set - return m_postalCodeIsSet; -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Contact/ContactAddress.h b/src/modules/API/Contact/ContactAddress.h deleted file mode 100644 index f296dc9..0000000 --- a/src/modules/API/Contact/ContactAddress.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactEmail.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class ContactAddress; - -typedef DPL::SharedPtr ContactAddressPtr; -typedef std::vector ContactAddressPtrList; - -/* This object represents an address data of a contact */ -class ContactAddress -{ - public: - - typedef enum - { - CONTACT_ADDRESS_TYPE_WORK, - CONTACT_ADDRESS_TYPE_PREF, - CONTACT_ADDRESS_TYPE_HOME - } ContactAddressType; - - ContactAddress(); - ~ContactAddress(); - - int getId() const; - void setId(int value); - - std::string getCountry() const; - void setCountry(const std::string &value); - - std::string getRegion() const; - void setRegion(const std::string &value); - - std::string getCounty() const; - void setCounty(const std::string &value); - - std::string getCity() const; - void setCity(const std::string &value); - - std::string getStreet() const; - void setStreet(const std::string &value); - - std::string getStreetNumber() const; - void setStreetNumber(const std::string &value); - - std::string getPremises() const; - void setPremises(const std::string &value); - - std::string getAdditionalInformation() const; - void setAdditionalInformation(const std::string &value); - - std::string getPostalCode() const; - void setPostalCode(const std::string &value); - - std::vector getTypes() const; - void addType(const ContactAddressType value); - void setTypes(const std::vector &value); - bool isTypeOf(const ContactAddressType value) const; - void setTypeFilter(const ContactAddressType value); - ContactAddressType getTypeFilter() const; - - //returns m_country, ..., m_postalCode - //fields concatenated into single string - std::string getAsSingleString() const; - std::string getAddress() const; - void setAddress(const std::string &value); - - bool compareTo(const ContactAddressPtr &address, - bool includeId = false, - bool includeTypes = false) const; - ContactAddressPtr clone() const; - - bool getCountryIsSet() const; - bool getRegionIsSet() const; - bool getCountyIsSet() const; - bool getCityIsSet() const; - bool getStreetIsSet() const; - bool getStreetNumberIsSet() const; - bool getPremisesIsSet() const; - bool getAdditionalInformationIsSet() const; - bool getPostalCodeIsSet() const; - - private: - int m_id; - std::string m_country; - std::string m_region; - std::string m_county; - std::string m_city; - std::string m_street; - std::string m_streetNumber; - std::string m_premises; - std::string m_additionalInformation; - std::string m_postalCode; - std::vector m_types; - - //this field is free form fieldand should not be used. - //it holds data used by Jil standard, but fields - //m_country, ..., m_postalCode should be used instead - std::string m_address; - - bool m_countryIsSet; - bool m_regionIsSet; - bool m_countyIsSet; - bool m_cityIsSet; - bool m_streetIsSet; - bool m_streetNumberIsSet; - bool m_premisesIsSet; - bool m_additionalInformationIsSet; - bool m_postalCodeIsSet; -}; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_ADDRESS_H_ \ No newline at end of file diff --git a/src/modules/API/Contact/ContactEmail.cpp b/src/modules/API/Contact/ContactEmail.cpp deleted file mode 100644 index 414379e..0000000 --- a/src/modules/API/Contact/ContactEmail.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactEmail.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ContactEmail.h" - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -ContactEmail::ContactEmail() -{ -} - -ContactEmail::~ContactEmail() -{ -} - -std::string ContactEmail::getEmail() const -{ - return m_email; -} - -void ContactEmail::setEmail(const std::string &value) -{ - m_email = value; -} - -std::vector ContactEmail::getTypes() const -{ - return m_types; -} - -void ContactEmail::addType(ContactEmailType value) -{ - m_types.push_back(value); -} - -void ContactEmail::setTypes(const std::vector value) -{ - m_types = value; -} - -bool ContactEmail::isTypeOf(ContactEmailType value) const -{ - return std::find(m_types.begin(), m_types.end(), value) != m_types.end(); -} - -ContactEmail::ContactEmailType ContactEmail::getTypeFilter() const -{ - return m_types.size() == 0 ? CONTACT_EMAIL_TYPE_PREF : m_types[0]; -} - -void ContactEmail::setTypeFilter(ContactEmailType value) -{ - m_types.clear(); - m_types.push_back(value); -} - -ContactEmailPtr ContactEmail::clone() const -{ - return ContactEmailPtr(new ContactEmail(*this)); -} - -} -} -} diff --git a/src/modules/API/Contact/ContactEmail.h b/src/modules/API/Contact/ContactEmail.h deleted file mode 100644 index 241409e..0000000 --- a/src/modules/API/Contact/ContactEmail.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactEmail.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_EMAIL_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_EMAIL_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class ContactEmail; - -typedef DPL::SharedPtr ContactEmailPtr; -typedef std::vector ContactEmailPtrList; - -/* This object represents an email data of a contact */ -class ContactEmail -{ - public: - - typedef enum - { - CONTACT_EMAIL_TYPE_PREF, - CONTACT_EMAIL_TYPE_WORK, - CONTACT_EMAIL_TYPE_HOME - } ContactEmailType; - - ContactEmail(); - ~ContactEmail(); - std::string getEmail() const; - void setEmail(const std::string &value); - std::vector getTypes() const; - void addType(ContactEmailType value); - void setTypes(const std::vector value); - bool isTypeOf(ContactEmailType value) const; - //methods to use when object is used as filter, not email data container - ContactEmailType getTypeFilter() const; - void setTypeFilter(ContactEmailType value); - ContactEmailPtr clone() const; - private: - std::string m_email; - std::vector m_types; -}; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_EMAIL_H_ \ No newline at end of file diff --git a/src/modules/API/Contact/ContactFactory.cpp b/src/modules/API/Contact/ContactFactory.cpp deleted file mode 100644 index e5a58a0..0000000 --- a/src/modules/API/Contact/ContactFactory.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactFactory.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ContactFactory.h" -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -IContactManagerPtr ContactFactory::createContactManager() -{ - static IContactManagerPtr result(new ContactManager()); - return result; -} - -ContactFactory& ContactFactory::getInstance() -{ - static ContactFactory theInstance; - return theInstance; -} - -} -} // Api -} // WrtDeviceApis diff --git a/src/modules/API/Contact/ContactFactory.h b/src/modules/API/Contact/ContactFactory.h deleted file mode 100644 index 9026c5e..0000000 --- a/src/modules/API/Contact/ContactFactory.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactFactory.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_FACTORY_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_FACTORY_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class ContactFactory : private DPL::Noncopyable -{ - private: - ContactFactory() - { - } - public: - static ContactFactory& getInstance(); - IContactManagerPtr createContactManager(); -}; - -} -} // Api -} // WrtDeviceApis - -#endif //WRTDEVICEAPIS_CONTACT_CONTACT_FACTORY_H_ diff --git a/src/modules/API/Contact/ContactFilter.cpp b/src/modules/API/Contact/ContactFilter.cpp deleted file mode 100644 index ac6ead4..0000000 --- a/src/modules/API/Contact/ContactFilter.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactFilter.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ContactFilter.h" - -namespace { -const int CONTACT_FILTER_UNDEFINED_CONTACT_ID = -1; -} - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -ContactFilter::ContactFilter() : - m_id(CONTACT_FILTER_UNDEFINED_CONTACT_ID), - m_fullNameIsSet(false), - m_firstNameIsSet(false), - m_lastNameIsSet(false), - m_phoneticNameIsSet(false), - m_companyIsSet(false), - m_titleIsSet(false), - m_groupIsSet(false) -{ -} - -ContactFilter::~ContactFilter() -{ -} - -int ContactFilter::getIdFilter() const -{ - return m_id; -} - -void ContactFilter::setIdFilter(int value) -{ - m_id = value; -} - -bool ContactFilter::getIdIsSet() const -{ - return m_id != CONTACT_FILTER_UNDEFINED_CONTACT_ID; -} - -std::string ContactFilter::getFullNameFilter() const -{ - return m_fullName; -} - -void ContactFilter::setFullNameFilter(const std::string &value) -{ - m_fullName = value; - m_fullNameIsSet = true; -} - -bool ContactFilter::getFullNameIsSet() const -{ - return m_fullNameIsSet; -} - -std::string ContactFilter::getFirstNameFilter() const -{ - return m_firstName; -} - -void ContactFilter::setFirstNameFilter(const std::string &value) -{ - m_firstName = value; - m_firstNameIsSet = true; -} - -bool ContactFilter::getFirstNameIsSet() const -{ - return m_firstNameIsSet; -} - -std::string ContactFilter::getLastNameFilter() const -{ - return m_lastName; -} - -void ContactFilter::setLastNameFilter(const std::string &value) -{ - m_lastName = value; - m_lastNameIsSet = true; -} - -bool ContactFilter::getLastNameIsSet() const -{ - return m_lastNameIsSet; -} - -std::string ContactFilter::getPhoneticNameFilter() const -{ - return m_phoneticName; -} - -void ContactFilter::setPhoneticNameFilter(const std::string &value) -{ - m_phoneticName = value; - m_phoneticNameIsSet = true; -} - -bool ContactFilter::getPhoneticNameIsSet() const -{ - return m_phoneticNameIsSet; -} - -std::string ContactFilter::getCompanyFilter() const -{ - return m_company; -} - -void ContactFilter::setCompanyFilter(const std::string &value) -{ - m_company = value; - m_companyIsSet = true; -} - -bool ContactFilter::getCompanyIsSet() const -{ - return m_companyIsSet; -} - -std::string ContactFilter::getTitleFilter() const -{ - return m_title; -} - -void ContactFilter::setTitleFilter(const std::string &value) -{ - m_title = value; - m_titleIsSet = true; -} - -bool ContactFilter::getTitleIsSet() const -{ - return m_titleIsSet; -} - -const std::vector &ContactFilter::getPhoneNumberFilter() -const -{ - return m_phoneNumber; -} - -void ContactFilter::setPhoneNumberFilter( - const std::vector &value) -{ - m_phoneNumber = value; -} - -bool ContactFilter::getPhoneNumberIsSet() const -{ - return m_phoneNumber.size() != 0; -} - -const std::vector &ContactFilter::getEmailFilter() const -{ - return m_email; -} - -void ContactFilter::setEmailFilter(const std::vector &value) -{ - m_email = value; -} - -bool ContactFilter::getEmailIsSet() const -{ - return m_email.size() != 0; -} - -const std::vector &ContactFilter::getNickNameFilter() -{ - return m_nickname; -} - -void ContactFilter::setNickNameFilter(const std::vector &value) -{ - m_nickname = value; -} - -bool ContactFilter::getNickNameIsSet() const -{ - return m_nickname.size() != 0; -} - -const std::vector &ContactFilter::getAddressFilter() -{ - return m_address; -} - -void ContactFilter::setAddressFilter( - const std::vector &value) -{ - m_address = value; -} - -bool ContactFilter::getAddressIsSet() const -{ - return m_address.size() != 0; -} - -std::string ContactFilter::getGroupFilter() const -{ - return m_group; -} - -void ContactFilter::setGroupFilter(const std::string &value) -{ - m_group = value; - m_groupIsSet = true; -} - -bool ContactFilter::getGroupIsSet() const -{ - return m_groupIsSet; -} - -} -} -} diff --git a/src/modules/API/Contact/ContactFilter.h b/src/modules/API/Contact/ContactFilter.h deleted file mode 100644 index dda0a23..0000000 --- a/src/modules/API/Contact/ContactFilter.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactFilter.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_FILTER_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_FILTER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* This class is used as filter while searching contacts */ -class ContactFilter -{ - public: - - ContactFilter(); - virtual ~ContactFilter(); - - int getIdFilter() const; - void setIdFilter(int value); - - std::string getFullNameFilter() const; - void setFullNameFilter(const std::string &value); - - std::string getFirstNameFilter() const; - void setFirstNameFilter(const std::string &value); - - std::string getLastNameFilter() const; - void setLastNameFilter(const std::string &value); - - std::string getPhoneticNameFilter() const; - void setPhoneticNameFilter(const std::string &value); - - std::string getCompanyFilter() const; - void setCompanyFilter(const std::string &value); - - std::string getTitleFilter() const; - void setTitleFilter(const std::string &value); - - const std::vector &getPhoneNumberFilter() const; - void setPhoneNumberFilter(const std::vector &value); - - const std::vector &getEmailFilter() const; - void setEmailFilter(const std::vector &value); - - const std::vector &getNickNameFilter(); - void setNickNameFilter(const std::vector &value); - - const std::vector &getAddressFilter(); - void setAddressFilter(const std::vector &value); - - std::string getGroupFilter() const; - void setGroupFilter(const std::string &value); - - bool getIdIsSet() const; - bool getFullNameIsSet() const; - bool getFirstNameIsSet() const; - bool getLastNameIsSet() const; - bool getPhoneticNameIsSet() const; - - bool getCompanyIsSet() const; - bool getTitleIsSet() const; - bool getPhoneNumberIsSet() const; - bool getEmailIsSet() const; - bool getNickNameIsSet() const; - - bool getAddressIsSet() const; - bool getGroupIsSet() const; - - protected: - int m_id; - std::string m_fullName; //display name e.g. m_firstName + m_lastName - std::string m_firstName; - std::string m_lastName; - std::string m_phoneticName; - - std::string m_company; - std::string m_title; - std::vector m_phoneNumber; - std::vector m_email; - std::vector m_nickname; - - std::vector m_address; - std::string m_group; - - bool m_fullNameIsSet; - bool m_firstNameIsSet; - bool m_lastNameIsSet; - bool m_phoneticNameIsSet; - bool m_companyIsSet; - bool m_titleIsSet; - bool m_groupIsSet; -}; - -typedef DPL::SharedPtr ContactFilterPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_FILTER_H_ diff --git a/src/modules/API/Contact/ContactPhoneNumber.cpp b/src/modules/API/Contact/ContactPhoneNumber.cpp deleted file mode 100644 index 85f7bdd..0000000 --- a/src/modules/API/Contact/ContactPhoneNumber.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactPhoneNumber.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "ContactPhoneNumber.h" - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -ContactPhoneNumber::ContactPhoneNumber() -{ -} - -ContactPhoneNumber::~ContactPhoneNumber() -{ -} - -std::string ContactPhoneNumber::getNumber() const -{ - return m_number; -} - -void ContactPhoneNumber::setNumber(const std::string &value) -{ - m_number = value; -} - -std::vector ContactPhoneNumber:: - getTypes() const -{ - return m_types; -} - -void ContactPhoneNumber::addType(const ContactPhoneNumberType value) -{ - m_types.push_back(value); -} - -void ContactPhoneNumber::setTypes( - const std::vector value) -{ - m_types = value; -} - -bool ContactPhoneNumber::isTypeOf( - ContactPhoneNumber::ContactPhoneNumberType value) const -{ - return std::find(m_types.begin(), m_types.end(), value) != m_types.end(); -} - -ContactPhoneNumber::ContactPhoneNumberType ContactPhoneNumber::getTypeFilter() -const -{ - return m_types.size() == 0 ? CONTACT_PHONE_NUMBER_TYPE_PREF : m_types[0]; -} - -void ContactPhoneNumber::setTypeFilter( - ContactPhoneNumber::ContactPhoneNumberType value) -{ - m_types.clear(); - m_types.push_back(value); -} - -ContactPhoneNumberPtr ContactPhoneNumber::clone() const -{ - return ContactPhoneNumberPtr(new ContactPhoneNumber(*this)); -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Contact/ContactPhoneNumber.h b/src/modules/API/Contact/ContactPhoneNumber.h deleted file mode 100644 index 6ccab85..0000000 --- a/src/modules/API/Contact/ContactPhoneNumber.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactPhoneNumber.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_PHONE_NUMBER_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_PHONE_NUMBER_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class ContactPhoneNumber; - -typedef DPL::SharedPtr ContactPhoneNumberPtr; -typedef std::vector ContactPhoneNumberPtrList; -typedef DPL::SharedPtr ContactPhoneNumberPtrListPtr; - -/* This object represents a phone number data of a contact */ -class ContactPhoneNumber -{ - public: - - typedef enum - { - CONTACT_PHONE_NUMBER_TYPE_WORK, - CONTACT_PHONE_NUMBER_TYPE_PREF, - CONTACT_PHONE_NUMBER_TYPE_HOME, - CONTACT_PHONE_NUMBER_TYPE_VOICE, - CONTACT_PHONE_NUMBER_TYPE_FAX, - CONTACT_PHONE_NUMBER_TYPE_MSG, - CONTACT_PHONE_NUMBER_TYPE_CELL, - CONTACT_PHONE_NUMBER_TYPE_PAGER, - CONTACT_PHONE_NUMBER_TYPE_BBS, - CONTACT_PHONE_NUMBER_TYPE_MODEM, - CONTACT_PHONE_NUMBER_TYPE_CAR, - CONTACT_PHONE_NUMBER_TYPE_ISDN, - CONTACT_PHONE_NUMBER_TYPE_VIDEO, - CONTACT_PHONE_NUMBER_TYPE_PCS - } ContactPhoneNumberType; - - ContactPhoneNumber(); - ~ContactPhoneNumber(); - std::string getNumber() const; - void setNumber(const std::string &value); - std::vector getTypes() const; - void addType(const ContactPhoneNumberType value); - void setTypes(const std::vector value); - bool isTypeOf(ContactPhoneNumberType value) const; - //methods to use when object is used as filter, not email data container - ContactPhoneNumberType getTypeFilter() const; - void setTypeFilter(ContactPhoneNumberType value); - ContactPhoneNumberPtr clone() const; - - private: - std::string m_number; - std::vector m_types; -}; - -} -} -} - -#endif \ No newline at end of file diff --git a/src/modules/API/Contact/EventAddContact.h b/src/modules/API/Contact/EventAddContact.h deleted file mode 100644 index 0af519e..0000000 --- a/src/modules/API/Contact/EventAddContact.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_ADD_CONTACT_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_ADD_CONTACT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while adding new contact */ -class EventAddContact : public Commons::IEvent -{ - bool m_result; - ContactPtr m_contact; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setContact(const ContactPtr &contact) - { - m_contact = contact; - } - ContactPtr getContact() const - { - return m_contact; - } - - EventAddContact() : m_result(false), - m_contact(NULL) - { - } - virtual ~EventAddContact() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventAddContactPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_ADD_CONTACT_H_ diff --git a/src/modules/API/Contact/EventAddGroup.h b/src/modules/API/Contact/EventAddGroup.h deleted file mode 100644 index b0d92ed..0000000 --- a/src/modules/API/Contact/EventAddGroup.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_ADD_GROUP_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_ADD_GROUP_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while adding new group */ -class EventAddGroup : public Commons::IEvent -{ - bool m_result; - std::string m_groupName; - public: - void setGroupName(const std::string &value) - { - m_groupName = value; - } - std::string getGroupName() const - { - return m_groupName; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - - EventAddGroup() : m_result(false) - { - } - virtual ~EventAddGroup() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventAddGroupPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_ADD_GROUP_H_ diff --git a/src/modules/API/Contact/EventDeleteContact.h b/src/modules/API/Contact/EventDeleteContact.h deleted file mode 100644 index 2b7faeb..0000000 --- a/src/modules/API/Contact/EventDeleteContact.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_DELETE_CONTACT_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_DELETE_CONTACT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while deleting contact */ -class EventDeleteContact : public Commons::IEvent< - EventDeleteContact> -{ - ContactFilterPtr m_filter; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setFilter(const ContactFilterPtr &contact) - { - m_filter = contact; - } - ContactFilterPtr getFilter() const - { - return m_filter; - } - EventDeleteContact() : m_filter(NULL), - m_result(false) - { - } - virtual ~EventDeleteContact() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventDeleteContactPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_DELETE_CONTACT_H_ diff --git a/src/modules/API/Contact/EventDeleteGroup.h b/src/modules/API/Contact/EventDeleteGroup.h deleted file mode 100644 index 7923087..0000000 --- a/src/modules/API/Contact/EventDeleteGroup.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_DELETE_GROUP_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_DELETE_GROUP_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while deleting a group */ -class EventDeleteGroup : public Commons::IEvent -{ - bool m_result; - std::string m_groupName; - public: - void setGroupName(const std::string &value) - { - m_groupName = value; - } - std::string getGroupName() const - { - return m_groupName; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - - EventDeleteGroup() : m_result(false) - { - } - ~EventDeleteGroup() - { - } -}; - -typedef DPL::SharedPtr EventDeleteGroupPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_DELETE_GROUP_H_ diff --git a/src/modules/API/Contact/EventExportVCard.h b/src/modules/API/Contact/EventExportVCard.h deleted file mode 100644 index dba2927..0000000 --- a/src/modules/API/Contact/EventExportVCard.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_EXPORT_VCARD_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_EXPORT_VCARD_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while exporting VCard file */ -class EventExportVCard : public Commons::IEvent -{ - bool m_result; - std::vector m_pathToFiles; - std::vector m_contacts; - public: - void setContacts(const std::vector &value) - { - m_contacts = value; - } - std::vector getContacts() const - { - return m_contacts; - } - void setPathToFiles(const std::vector &value) - { - m_pathToFiles = value; - } - std::vector getPathToFiles() const - { - return m_pathToFiles; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - - EventExportVCard() : m_result(false) - { - } - virtual ~EventExportVCard() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventExportVCardPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_EXPORT_VCARD_H_ diff --git a/src/modules/API/Contact/EventFindContacts.h b/src/modules/API/Contact/EventFindContacts.h deleted file mode 100644 index 4806928..0000000 --- a/src/modules/API/Contact/EventFindContacts.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while searching contacts */ -class EventFindContacts : public Commons::IEvent -{ - bool m_result; - std::vector m_contacts; - ContactFilterPtr m_filter; - int m_startIndex; - int m_endIndex; - //this variable allows to use only one type per contact objects (check Contact object and contained subobjects) - //e.g. if contact has the same email as PREF and WORK, we can get 2 record with 1 type in each record, or singe record with 2 types within it. - bool m_useSingleTypes; - - //this variable is not revelant to perform operation, - //but allows to store additional data to finish further operations in callback function. - IContactEventPrivateDataPtr m_privateData; - public: - void setContactEventPrivateData(const IContactEventPrivateDataPtr &value) - { - m_privateData = value; - } - IContactEventPrivateDataPtr getContactEventPrivateData() const - { - return m_privateData; - } - void setStartIndex(int value) - { - m_startIndex = value; - } - int getStartIndex() const - { - return m_startIndex; - } - void setEndIndex(int value) - { - m_endIndex = value; - } - int getEndIndex() const - { - return m_endIndex; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setUseSignleTypes(bool value) - { - m_useSingleTypes = value; - } - bool getUseSignleTypes() const - { - return m_useSingleTypes; - } - void setFilter(const ContactFilterPtr &filter) - { - m_filter = filter; - } - ContactFilterPtr getFilter() const - { - return m_filter; - } - void addContact(const ContactPtr &contact) - { - m_contacts.push_back(contact); - } - const std::vector &getContacts() const - { - return m_contacts; - } - void setContacts(const std::vector &value) - { - m_contacts = value; - } - - EventFindContacts() : m_result(false), - m_filter(NULL), - m_startIndex(-1), - m_endIndex(-1), - m_useSingleTypes(true) - { - } - virtual ~EventFindContacts() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventFindContactsPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_FIND_CONTACT_H_ diff --git a/src/modules/API/Contact/EventFindGroup.h b/src/modules/API/Contact/EventFindGroup.h deleted file mode 100644 index 37ff57b..0000000 --- a/src/modules/API/Contact/EventFindGroup.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_FIND_GROUP_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_FIND_GROUP_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while searching group */ -class EventFindGroup : public Commons::IEvent -{ - bool m_result; - std::string m_groupName; //can be used as regular expressions mask or empty for all groups - std::vector m_foundGroups; - public: - void addFoundGroup(const std::string &value) - { - m_foundGroups.push_back(value); - } - const std::vector &getFoundGroups() const - { - return m_foundGroups; - } - void setFoundGroups(const std::vector &value) - { - m_foundGroups = value; - } - void setGroupName(const std::string &value) - { - m_groupName = value; - } - std::string getGroupName() const - { - return m_groupName; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - EventFindGroup() : m_result(false) - { - } - virtual ~EventFindGroup() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventFindGroupPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_FIND_GROUP_H_ diff --git a/src/modules/API/Contact/EventGetAddressBookItemCount.h b/src/modules/API/Contact/EventGetAddressBookItemCount.h deleted file mode 100644 index d2b4a92..0000000 --- a/src/modules/API/Contact/EventGetAddressBookItemCount.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_GET_ADDRESSBOOKITEM_COUNT_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_GET_ADDRESSBOOKITEM_COUNT_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while getting address books count */ -class EventGetAddressBookItemCount : - public Commons::IEvent -{ - bool m_result; - unsigned int m_numberOfAddressBookItems; - public: - void setNumberOfAddressBookItems(unsigned int value) - { - m_numberOfAddressBookItems = value; - } - unsigned int getNumberOfAddressBookItems() const - { - return m_numberOfAddressBookItems; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - - EventGetAddressBookItemCount() : m_result(false), - m_numberOfAddressBookItems(0) - { - } - virtual ~EventGetAddressBookItemCount() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr -EventGetAddressBookItemCountPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_GET_ADDRESSBOOKITEM_COUNT_H_ diff --git a/src/modules/API/Contact/EventGetAddressBooks.h b/src/modules/API/Contact/EventGetAddressBooks.h deleted file mode 100644 index 2c52a9e..0000000 --- a/src/modules/API/Contact/EventGetAddressBooks.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_GET_PHONEBOOKS_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_GET_PHONEBOOKS_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while getting address books */ -class EventGetAddressBooks : public Commons::IEvent -{ - bool m_result; - std::vector m_books; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void addAddressBook(const IAddressBookObjectPtr &addressBook) - { - m_books.push_back(addressBook); - } - const std::vector &getBooks() const - { - return m_books; - } - - EventGetAddressBooks() : m_result(false) - { - } - virtual ~EventGetAddressBooks() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventGetAddressBooksPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_GET_PHONEBOOKS_H_ diff --git a/src/modules/API/Contact/EventGetOwnerInfo.h b/src/modules/API/Contact/EventGetOwnerInfo.h deleted file mode 100644 index b505efc..0000000 --- a/src/modules/API/Contact/EventGetOwnerInfo.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file EventGetOwnerInfo.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_GET_OWNER_INFO_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_GET_OWNER_INFO_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while getting phone's owner data */ -class EventGetOwnerInfo : public Commons::IEvent -{ - bool m_result; - bool m_dataFound; - ContactPtr m_ownerInfo; - public: - void setOwnerInfo(const ContactPtr &value) - { - m_ownerInfo = value; - } - ContactPtr getOwnerInfo() const - { - return m_ownerInfo; - } - void setDataFound(bool value) - { - m_dataFound = value; - } - bool getDataFound() const - { - return m_dataFound; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - EventGetOwnerInfo() : - m_result(false), - m_dataFound(false) - { - } - virtual ~EventGetOwnerInfo() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventGetOwnerInfoPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_GET_OWNER_INFO_H_ diff --git a/src/modules/API/Contact/EventUpdateContact.h b/src/modules/API/Contact/EventUpdateContact.h deleted file mode 100644 index 6c1b63c..0000000 --- a/src/modules/API/Contact/EventUpdateContact.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_CONTACT_EVENT_UPDATE_CONTACT_H_ -#define WRTDEVICEAPIS_CONTACT_EVENT_UPDATE_CONTACT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* Event sent while updating contact */ -class EventUpdateContact : public Commons::IEvent< - EventUpdateContact> -{ - bool m_result; - ContactPtr m_contact; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setContact(const ContactPtr &contact) - { - m_contact = contact; - } - ContactPtr getContact() const - { - return m_contact; - } - EventUpdateContact() : m_result(false), - m_contact(NULL) - { - } - virtual ~EventUpdateContact() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr EventUpdateContactPtr; - -} -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_CONTACT_EVENT_UPDATE_CONTACT_H_ diff --git a/src/modules/API/Contact/IAddressBook.cpp b/src/modules/API/Contact/IAddressBook.cpp deleted file mode 100644 index 4afc69c..0000000 --- a/src/modules/API/Contact/IAddressBook.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IAddressBook.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include "IAddressBook.h" -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -IAddressBookObject::IAddressBookObject(BookType type) : - //initialize all receivers to work on CONTACT_THREAD thread - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - m_bookType(type) -{ - //Nothing to do - LogDebug("entered"); -} - -IAddressBookObject::~IAddressBookObject() -{ - //Nothing to do - LogDebug("entered"); -} - -IAddressBookObject::BookType IAddressBookObject::getType() const -{ - //return address book type: sim or device - return m_bookType; -} - -void IAddressBookObject::addContact(const EventAddContactPtr &event) -{ - Commons::EventRequestReceiver< EventAddContact >::PostRequest(event); -} - -void IAddressBookObject::updateContact(const EventUpdateContactPtr &event) -{ - Commons::EventRequestReceiver< EventUpdateContact >::PostRequest(event); -} - -void IAddressBookObject::deleteContact(const EventDeleteContactPtr &event) -{ - Commons::EventRequestReceiver< EventDeleteContact >::PostRequest(event); -} - -void IAddressBookObject::findContacts(const EventFindContactsPtr &event) -{ - Commons::EventRequestReceiver< EventFindContacts >::PostRequest(event); -} - -void IAddressBookObject::getNumberOfContact( - const EventGetAddressBookItemCountPtr &event) -{ - Commons::EventRequestReceiver< EventGetAddressBookItemCount >::PostRequest( - event); -} - -void IAddressBookObject::addGroup(const EventAddGroupPtr &event) -{ - Commons::EventRequestReceiver< EventAddGroup >::PostRequest(event); -} - -void IAddressBookObject::deleteGroup(const EventDeleteGroupPtr &event) -{ - Commons::EventRequestReceiver< EventDeleteGroup >::PostRequest(event); -} - -void IAddressBookObject::findGroup(const EventFindGroupPtr &event) -{ - Commons::EventRequestReceiver< EventFindGroup >::PostRequest(event); -} - -void IAddressBookObject::exportToVCard(const EventExportVCardPtr &event) -{ - Commons::EventRequestReceiver< EventExportVCard >::PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Contact/IAddressBook.h b/src/modules/API/Contact/IAddressBook.h deleted file mode 100644 index 00427af..0000000 --- a/src/modules/API/Contact/IAddressBook.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IAddressBook.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_ -#define WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class IAddressBookObject : - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver, - public IContactEventPrivateData -{ - public: - typedef enum - { - SIMBook, - PhoneBook - } BookType; - - virtual ~IAddressBookObject(); - explicit IAddressBookObject(BookType type); - - virtual void addContact(const EventAddContactPtr &event); - virtual void updateContact(const EventUpdateContactPtr &event); - virtual void findContacts(const EventFindContactsPtr &event); - virtual void deleteContact(const EventDeleteContactPtr &event); - virtual void getNumberOfContact( - const EventGetAddressBookItemCountPtr &event); - virtual void addGroup(const EventAddGroupPtr &event); - virtual void deleteGroup(const EventDeleteGroupPtr &event); - virtual void findGroup(const EventFindGroupPtr &event); - virtual void exportToVCard(const EventExportVCardPtr &event); - - virtual BookType getType() const; - virtual std::string getName() const = 0; - virtual void setName(const std::string &value) = 0; - - protected: - BookType m_bookType; - - virtual void OnRequestReceived(const EventAddContactPtr &event) = 0; - virtual void OnRequestReceived(const EventUpdateContactPtr &event) = 0; - virtual void OnRequestReceived(const EventDeleteContactPtr &event) = 0; - virtual void OnRequestReceived(const EventFindContactsPtr &event) = 0; - virtual void OnRequestReceived( - const EventGetAddressBookItemCountPtr &event) = 0; - virtual void OnRequestReceived(const EventAddGroupPtr &event) = 0; - virtual void OnRequestReceived(const EventDeleteGroupPtr &event) = 0; - virtual void OnRequestReceived(const EventFindGroupPtr &event) = 0; - virtual void OnRequestReceived(const EventExportVCardPtr &event) = 0; -}; - -typedef DPL::SharedPtr IAddressBookObjectPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_IADDRESSBOOK_H_ diff --git a/src/modules/API/Contact/IContactEventPrivateData.h b/src/modules/API/Contact/IContactEventPrivateData.h deleted file mode 100644 index 603efd7..0000000 --- a/src/modules/API/Contact/IContactEventPrivateData.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactEventPrivateData.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_EVENT_PRIVATE_DATA_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_EVENT_PRIVATE_DATA_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -/* This is base class for objects stored as private data inside some contact events */ -class IContactEventPrivateData -{ -}; - -typedef DPL::SharedPtr IContactEventPrivateDataPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_EVENT_PRIVATE_DATA_H_ \ No newline at end of file diff --git a/src/modules/API/Contact/IContactManager.cpp b/src/modules/API/Contact/IContactManager.cpp deleted file mode 100644 index f9e0d49..0000000 --- a/src/modules/API/Contact/IContactManager.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IContactManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include -#include "IContactManager.h" - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -IContactManager::IContactManager() : - //initialize all receivers to work on CONTACT_THREAD thread - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::CONTACT_THREAD) -{ - //Nothing to do -} - -IContactManager::~IContactManager() -{ - //Nothing to do -} - -void IContactManager::getOwnerInfo(const EventGetOwnerInfoPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void IContactManager::getAddressBooks(const EventGetAddressBooksPtr &event) -{ - Commons::EventRequestReceiver< EventGetAddressBooks >::PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Contact/IContactManager.h b/src/modules/API/Contact/IContactManager.h deleted file mode 100644 index 9913af2..0000000 --- a/src/modules/API/Contact/IContactManager.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IContactManager.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_ICONTACT_MANAGER_H_ -#define WRTDEVICEAPIS_CONTACT_ICONTACT_MANAGER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { -namespace Api { - -class IContactManager : - public Commons::EventRequestReceiver, - public Commons::EventRequestReceiver -{ - public: - IContactManager(); - virtual ~IContactManager(); - virtual void getAddressBooks(const EventGetAddressBooksPtr &event); - virtual void getOwnerInfo(const EventGetOwnerInfoPtr &event); - protected: - virtual void OnRequestReceived(const EventGetAddressBooksPtr &event) = 0; - virtual void OnRequestReceived(const EventGetOwnerInfoPtr &event) = 0; -}; - -typedef DPL::SharedPtr IContactManagerPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_CONTACT_ICALENDAR_MANAGER_H_ diff --git a/src/modules/API/Contact/config.cmake b/src/modules/API/Contact/config.cmake deleted file mode 100644 index 6c418ef..0000000 --- a/src/modules/API/Contact/config.cmake +++ /dev/null @@ -1,18 +0,0 @@ -get_current_path() - -set(API_CONTACT_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_CONTACT - ${CURRENT_PATH}/Contact.cpp - ${CURRENT_PATH}/ContactFilter.cpp - ${CURRENT_PATH}/ContactAddress.cpp - ${CURRENT_PATH}/ContactEmail.cpp - ${CURRENT_PATH}/ContactPhoneNumber.cpp - ${CURRENT_PATH}/ContactFactory.cpp - ${CURRENT_PATH}/IAddressBook.cpp - ${CURRENT_PATH}/IContactManager.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Filesystem/IManager.cpp b/src/modules/API/Filesystem/IManager.cpp index c4073d7..7644767 100644 --- a/src/modules/API/Filesystem/IManager.cpp +++ b/src/modules/API/Filesystem/IManager.cpp @@ -27,6 +27,11 @@ IManager& IManager::getInstance() return instance; } +bool IManager::fileExists(const std::string &file) +{ + return WrtDeviceApis::Filesystem::Manager::fileExists(file); +} + IManager::IManager() : Commons::EventRequestReceiver( Commons::ThreadEnum::FILESYSTEM_THREAD), diff --git a/src/modules/API/Filesystem/IManager.h b/src/modules/API/Filesystem/IManager.h index dbd5396..0f13dcf 100644 --- a/src/modules/API/Filesystem/IManager.h +++ b/src/modules/API/Filesystem/IManager.h @@ -46,6 +46,7 @@ class IManager : { public: static IManager& getInstance(); + static bool fileExists(const std::string &file); virtual ~IManager() = 0; diff --git a/src/modules/API/Haptics/EventPlayBeep.h b/src/modules/API/Haptics/EventPlayBeep.h deleted file mode 100644 index a7ac84e..0000000 --- a/src/modules/API/Haptics/EventPlayBeep.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventPlayBeep.h - * @author Hoseon LEE (hoseon46.lee@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_HAPTICS_EVENTPLAYBEEP_H_ -#define WRTDEVICEAPIS_HAPTICS_EVENTPLAYBEEP_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -class EventPlayBeep; - -typedef DPL::SharedPtr EventPlayBeepPtr; - -/* - * - */ -class EventPlayBeep : public Commons::IEvent -{ - public: - explicit EventPlayBeep(const long duration, - const int volume) : - m_duration(duration), - m_volume(volume) - { - } - - long getDuration() const - { - return m_duration; - } - - int getVolume() const - { - return m_volume; - } - - private: - const long m_duration; - const int m_volume; -}; -} // Api -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_EVENTPLAYBEEP_H_ */ diff --git a/src/modules/API/Haptics/EventStartMotor.h b/src/modules/API/Haptics/EventStartMotor.h deleted file mode 100644 index ff2e3dd..0000000 --- a/src/modules/API/Haptics/EventStartMotor.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventStartMotor.h - * @author Hoseon LEE (hoseon46.lee@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_HAPTICS_EVENTSTARTVIBRATER_H_ -#define WRTDEVICEAPIS_HAPTICS_EVENTSTARTVIBRATER_H_ - -#include -#include -#include "HapticPattern.h" - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -class EventStartMotor; - -typedef DPL::SharedPtr EventStartMotorPtr; - -/* - * - */ -class EventStartMotor : public Commons::IEvent -{ - public: - explicit EventStartMotor(const long duration, - const HapticPatternPtr& pattern) : - m_duration(duration), - m_pattern(pattern) - { - } - - long getDuration() const - { - return m_duration; - } - - const HapticPatternPtr getPatternRef() const - { - return m_pattern; - } - - private: - const long m_duration; - const HapticPatternPtr m_pattern; -}; -} // Apis -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_EVENTSTARTVIBRATER_H_ */ diff --git a/src/modules/API/Haptics/HapticPattern.cpp b/src/modules/API/Haptics/HapticPattern.cpp deleted file mode 100644 index e117167..0000000 --- a/src/modules/API/Haptics/HapticPattern.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file HapticPattern.cpp - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#include "HapticPattern.h" -#include - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -void HapticPattern::addInterval(unsigned long duration, - bool vibrate) -{ - if (0 == duration) { - return; - } - - // empty sequence - if (0 == m_sequence.size()) { - m_startsActive = vibrate; - m_sequence.push_back(duration); - return; - } - - // check if last interval is action or pause - bool lastVibrates = m_startsActive ^ ((m_sequence.size() & 0x1) == 0); - - if (lastVibrates == vibrate) { - *m_sequence.rbegin() += duration; // extend last interval - } else { - m_sequence.push_back(duration); // add new interval - } -} - -bool HapticPattern::isActive(size_t interval) const -{ - if (interval >= m_sequence.size()) { - ThrowMsg(Commons::OutOfRangeException, - "Interval index is out of haptic sequence range"); - } - - return m_startsActive ^ ((interval & 0x1) != 0); -} - -unsigned long HapticPattern::duration(size_t interval) const -{ - if (interval >= m_sequence.size()) { - return 0; - } - - return m_sequence[interval]; -} -} // Api -} // Haptics -} // WrtDeviceApis diff --git a/src/modules/API/Haptics/HapticPattern.h b/src/modules/API/Haptics/HapticPattern.h deleted file mode 100644 index 553d44c..0000000 --- a/src/modules/API/Haptics/HapticPattern.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file HapticPattern.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_HAPTIC_HAPTICPATTERN_H_ -#define WRTDEVICEAPIS_HAPTIC_HAPTICPATTERN_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -/* - * - */ -class HapticPattern : public DPL::Noncopyable -{ - public: - // adds another interval to the sequence - void addInterval(unsigned long duration, - bool active); - - // sequence length - size_t length() const - { - return m_sequence.size(); - } - - // returns true if during given interval the haptic action is on - // throws Commons::OutOfRangeException - bool isActive(size_t interval) const; - - // returns duration of given interval - unsigned long duration(size_t interval) const; - - private: - // If true, the sequence starts with haptic action (not pause) - bool m_startsActive; - - // A sequence of action/pause intervals - std::vector m_sequence; -}; - -typedef DPL::SharedPtr HapticPatternPtr; -} // Api -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTIC_HAPTICPATTERN_H_ */ diff --git a/src/modules/API/Haptics/IManager.cpp b/src/modules/API/Haptics/IManager.cpp deleted file mode 100644 index e7da013..0000000 --- a/src/modules/API/Haptics/IManager.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include "IManager.h" - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -IManager& IManager::getInstance() -{ - return Manager::getInstance(); -} - -IManager::~IManager() -{ -} -} // Api -} // Haptics -} // WrtDeviceApis diff --git a/src/modules/API/Haptics/IManager.h b/src/modules/API/Haptics/IManager.h deleted file mode 100644 index 5fab01a..0000000 --- a/src/modules/API/Haptics/IManager.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_HAPTICS_IMANAGER_H_ -#define WRTDEVICEAPIS_HAPTICS_IMANAGER_H_ - -#include -#include -#include "IMotor.h" - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -class IManager : public DPL::Noncopyable -{ - public: - static IManager& getInstance(); - - public: - virtual ~IManager() = 0; - - /** - * Gets specified haptic motor. - * @param index Index of a motor to get (1-based). - * @return Haptic motor. - * @throw OutOfRangeException If index is greater than available motors. - * @throw UnsupportedException If current platform doesn't support it. - * @remarks On some platforms passing 0 as index may return motor object - * which represents all available motors as one. - */ - virtual IMotor* getMotor(std::size_t index) const = 0; - - /** - * Gets number of available haptic motors. - * @return Number of motors. - */ - virtual std::size_t getMotorsCount() const = 0; -}; -} // Api -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_IMANAGER_H_ */ diff --git a/src/modules/API/Haptics/IMotor.cpp b/src/modules/API/Haptics/IMotor.cpp deleted file mode 100644 index 09072de..0000000 --- a/src/modules/API/Haptics/IMotor.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IMotor.h" - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -IMotor::~IMotor() -{ -} -} // Api -} // Hpatics -} // WrtDeviceApis diff --git a/src/modules/API/Haptics/IMotor.h b/src/modules/API/Haptics/IMotor.h deleted file mode 100644 index 70bebc8..0000000 --- a/src/modules/API/Haptics/IMotor.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_HAPTICS_IMOTOR_H_ -#define WRTDEVICEAPIS_HAPTICS_IMOTOR_H_ - -#include -#include "HapticPattern.h" -#include "EventStartMotor.h" -#include "EventPlayBeep.h" - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -class IMotor -{ - public: - virtual ~IMotor() = 0; - - /** - * Runs this haptic motor. - * Result of this operation might be different for different motor types, - * e.g. it may cause phone to vibrate. - * @param duration Number of miliseconds action should last. - * @throw PlatformException If platform error occurs. - */ - virtual void run(unsigned long duration) = 0; - - /** - * Runs vibration pattern on this haptic motor. - * Result of this operation might be different for different motor types, - * e.g. it may cause phone to vibrate. - * @param pattern sequence of haptic actions. - * @throw PlatformException If platform error occurs. - */ - virtual void run(const HapticPatternPtr& pattern) = 0; - - /** - * Runs vibration with event. - * Result of this operation might be different for different motor types, - * e.g. it may cause phone to vibrate. - * @param The event argument is event included duration & pattern. - * @throw PlatformException If platform error occurs. - */ - virtual void run(const EventStartMotorPtr& event) = 0; - - /** - * Stops this haptic motor. - * @throw PlatformException If platform error occurs. - */ - virtual void stopMotor() = 0; - - /** - * Cancel this haptic motor. - * @throw PlatformException If platform error occurs. - */ - virtual void stopVibration() = 0; - - /** - run beep in motor - e.g. it may cause phone to beep. - @param volume - @duration duration Number of miliseconds action should last. - **/ - virtual int playBeep(unsigned long duration, - int volume) = 0; - - /** - run beep in motor - e.g. it may cause phone to beep. - @param event - **/ - virtual void playBeep(const EventPlayBeepPtr& event) = 0; - - /** - stop beep in motor - e.g. it may cause phone to stop beep. - **/ - virtual void stopBeep() = 0; -}; - -typedef DPL::SharedPtr IMotorPtr; -} // Api -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_IMOTOR_H_ */ diff --git a/src/modules/API/Haptics/Types.h b/src/modules/API/Haptics/Types.h deleted file mode 100644 index 216c3df..0000000 --- a/src/modules/API/Haptics/Types.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_HAPTICS_TYPES_H_ -#define WRTDEVICEAPIS_HAPTICS_TYPES_H_ - -namespace WrtDeviceApis { -namespace Haptics { -namespace Api { -/** - * Type representing feedback level. - */ -typedef unsigned short Feedback; - -/** - * Value representing feedback turned off. - */ -const Feedback NO_FEEDBACK = 0; - -/** - * Value representing the lowest feedback level. - */ -const Feedback FEEDBACK_MIN = 1; - -/** - * Value representing the highest volume level. - */ -const Feedback FEEDBACK_MAX = 100; -} // Api -} // Haptics -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_HAPTICS_TYPES_H_ diff --git a/src/modules/API/Haptics/config.cmake b/src/modules/API/Haptics/config.cmake deleted file mode 100644 index 4852213..0000000 --- a/src/modules/API/Haptics/config.cmake +++ /dev/null @@ -1,13 +0,0 @@ -get_current_path() - -set(API_HAPTICS_PATH - ${CURRENT_PATH} - PARENT_SCOPE - ) - -set(SRCS_API_HAPTICS - ${CURRENT_PATH}/IManager.cpp - ${CURRENT_PATH}/IMotor.cpp - ${CURRENT_PATH}/HapticPattern.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/MMPlayer/EventOpen.h b/src/modules/API/MMPlayer/EventOpen.h index c3857c4..7d3eeb8 100644 --- a/src/modules/API/MMPlayer/EventOpen.h +++ b/src/modules/API/MMPlayer/EventOpen.h @@ -24,7 +24,6 @@ #include #include -#include #include namespace WrtDeviceApis { @@ -36,7 +35,6 @@ class EventOpen : public Commons::IEvent private: IMMPlayerPtr m_player; std::string m_filename; - Commons::IWrtWrapperPtr m_wrtWrapper; public: /** @@ -50,17 +48,11 @@ class EventOpen : public Commons::IEvent { return m_filename; } - Commons::IWrtWrapperPtr getWrtWrapper() const - { - return m_wrtWrapper; - } EventOpen(const IMMPlayerPtr &player, - const std::string &filename, - const Commons::IWrtWrapperPtr &wrapper = Commons::IWrtWrapperPtr()) : + const std::string &filename) : m_player(player), - m_filename(filename), - m_wrtWrapper(wrapper) + m_filename(filename) { } }; diff --git a/src/modules/API/Messaging/AttachmentFactory.cpp b/src/modules/API/Messaging/AttachmentFactory.cpp deleted file mode 100644 index 42b2e9f..0000000 --- a/src/modules/API/Messaging/AttachmentFactory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file AttachmentFactory.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include -#include -#include "AttachmentFactory.h" -#include "Attachments.h" -#include - -using namespace WrtDeviceApis::Commons; - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -IAttachmentPtr AttachmentFactory::createAttachment(const std::string& fullPath, - bool isVirtualPath) -{ - LogDebug("enter"); - IAttachmentPtr attachment(new Attachment(fullPath, isVirtualPath)); - if (!attachment->getIsCreatedProperly()) { - ThrowMsg(Commons::InvalidArgumentException, - "Attachment couldn't be created"); - } - return attachment; -} - -} -} -} diff --git a/src/modules/API/Messaging/AttachmentFactory.h b/src/modules/API/Messaging/AttachmentFactory.h deleted file mode 100644 index 82fb01f..0000000 --- a/src/modules/API/Messaging/AttachmentFactory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file AttachmentFactory.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef ATTACHMENTFACTORY_H -#define ATTACHMENTFACTORY_H - -#include -#include "IAttachment.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -//-------------------------------------------------------------------------- - -class AttachmentFactory -{ - public: - - /** - * Generate attachment object - * @param[in] fullPath path to file - * @param[in] isVirtualPath false when path is real file system path, true when it's path on file system exposed to user - */ - static IAttachmentPtr createAttachment(const std::string& fullPath, - bool isVirtualPath); -}; - -} -} -} - -#endif diff --git a/src/modules/API/Messaging/Attachments.cpp b/src/modules/API/Messaging/Attachments.cpp deleted file mode 100644 index ebcc04e..0000000 --- a/src/modules/API/Messaging/Attachments.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IAttachment.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include "Attachments.h" -#include "AttachmentFactory.h" - -extern "C" { -#include -#include -} - -using namespace WrtDeviceApis::Commons; -using namespace std; - -//-------------------------------------------------------------------------- -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -Attachments::Attachments() : - m_validAttachments(false) -{ - LogDebug("enter"); -} - -Attachments::~Attachments() -{ - LogDebug("enter"); -} - -IAttachmentPtr Attachments::appendAttachment(const std::string& fullPath, - bool isVirtualPath) -{ - LogDebug("enter, fullPath=" << fullPath); - IAttachmentPtr tmpAttach = AttachmentFactory::createAttachment( - fullPath, - isVirtualPath); - m_validAttachments = false; - m_attachments.push_back(tmpAttach); - return tmpAttach; -} - -void Attachments::appendAttachment(const IAttachmentPtr& attachment) -{ - LogDebug("enter"); - m_validAttachments = false; - m_attachments.push_back(attachment); -} - -void Attachments::appendAttachments(const vector& attachments) -{ - LogDebug("enter"); - back_insert_iterator< vector >biit(m_attachments); - copy(attachments.begin(), attachments.end(), biit); -} - -size_t Attachments::getAttachmentsCount() const -{ - LogDebug("enter"); - return m_attachments.size(); -} - -IAttachmentPtr Attachments::getAttachment(const size_t index) const -{ - LogDebug("enter"); - if (index >= m_attachments.size()) { - ThrowMsg(OutOfRangeException, "Trying to get attachment out of range"); - } - return m_attachments[index]; -} - -void Attachments::removeAttachment(const size_t index) -{ - LogDebug("enter"); - if (index >= m_attachments.size()) { - ThrowMsg(OutOfRangeException, "Trying to get attachment out of range"); - } - m_validAttachments = false; - m_attachments.erase(m_attachments.begin() + index); -} - -void Attachments::removeAttachment(const IAttachmentPtr& attachment) -{ - m_attachments.erase( - remove(m_attachments.begin(), m_attachments.end(), attachment), - m_attachments.end()); -} - -vector Attachments::getAttachments() const -{ - LogDebug("enter"); - return m_attachments; -} - -vector Attachments::getAttachmentsFullPaths() const -{ - vector retVal; - - for (size_t i = 0; i < m_attachments.size(); i++) { - retVal.push_back(m_attachments[i]->getFullPath()); - } - return retVal; -} - -vector Attachments::getAttachmentsShortNames() const -{ - vector retVal; - - for (size_t i = 0; i < m_attachments.size(); i++) { - retVal.push_back(m_attachments[i]->getShortName()); - } - return retVal; -} - -void Attachments::setAttachments(const vector& attachments, - bool isVirtualPath) -{ - vector::const_iterator it = attachments.begin(); - - m_attachments.clear(); - while (it != attachments.end()) { - appendAttachment(*it, isVirtualPath); - ++it; - } -} - -void Attachments::setAttachments(const vector& attachments) -{ - m_attachments = attachments; - m_validAttachments = false; -} - -bool Attachments::isAttachmentsValid() const -{ - return m_validAttachments; -} - -void Attachments::setAttachmentsValidity(bool state) -{ - m_validAttachments = state; -} - -const vector& Attachments::getAttachmentsRef() const -{ - return m_attachments; -} - -void Attachments::saveAttachment(const string& /*destFileName*/, - const IAttachmentPtr& /*attachment*/) -{ - // possible move it as a virtual function - to be clarified - LogError("N/A"); - //TODO -} - -void Attachments::setAttachmentWithExpand(const size_t index, - const std::string& fullPath, - bool isVirtualPath) -{ - // expand if needed - if (index >= m_attachments.size()) { - m_attachments.resize(index + 1); // resize with empty ptr - } - IAttachmentPtr tmpAttach = AttachmentFactory::createAttachment( - fullPath, - isVirtualPath); - m_attachments[index] = tmpAttach; - m_validAttachments = false; -} - -void Attachments::reverse() -{ - std::reverse(m_attachments.begin(), m_attachments.end()); -} - -void Attachments::insertAttachment(const size_t index, - const std::string& fullPath, - bool isVirtualPath) -{ - IAttachmentPtr tmpAttach = AttachmentFactory::createAttachment( - fullPath, - isVirtualPath); - m_attachments.insert(m_attachments.begin() + index, tmpAttach); - m_validAttachments = false; -} - -void Attachments::insertAttachmentWithExpand(const size_t index, - const std::string& fullPath, - bool isVirtualPath) -{ - // expand if needed - if (index >= m_attachments.size()) { - m_attachments.resize(index); // resize with empty ptr - } - IAttachmentPtr tmpAttach = AttachmentFactory::createAttachment( - fullPath, - isVirtualPath); - m_attachments.insert(m_attachments.begin() + index, tmpAttach); - m_validAttachments = false; -} - -} -} -} - diff --git a/src/modules/API/Messaging/Attachments.h b/src/modules/API/Messaging/Attachments.h deleted file mode 100644 index 830c8ca..0000000 --- a/src/modules/API/Messaging/Attachments.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Attachments.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef ATTACHMENTS_H -#define ATTACHMENTS_H - -#include -#include -#include -#include "IMessagingTypes.h" -#include "IAttachment.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -//-------------------------------------------------------------------------- - -class Attachments -{ - std::vector m_attachments; - - public: // fields - - private: - - bool m_validAttachments; - - public: // methods - - Attachments(); - - virtual ~Attachments(); - - /** - * method for append attachment into list - * @param[in] fullPath - path for attachment - * @return AttachmentPtr - if file exist create attachment object - * it is possible to modify name, etc. - * @throw InvalidArgumentException - if file not exist - */ - IAttachmentPtr appendAttachment(const std::string& fullPath, - bool isVirtualPath); - - /** - * method for append attachment into list - * @param[in] attachment - attachment to be added - */ - void appendAttachment(const IAttachmentPtr& attachment); - - /** - * method for append attachments list - * @param[in] attachments - attachment list - */ - void appendAttachments(const std::vector& attachments); - - /** - * get attachment count - * @return attachment count - */ - size_t getAttachmentsCount() const; - - /** - * get attachment object at index - * @param[in] index - index of attachment to get - * @return attachment object - * @throw OutOfRangeException if index is out of range - */ - IAttachmentPtr getAttachment(const size_t index) const; - - /** - * remove attachment at the index - * @param[in] index - index of attachment to get - * @return void - * @throw OutOfRangeException if index is out of range - */ - void removeAttachment(const size_t index); - - /** - * remove attachment at the index - * @param[in] attachment - AttachmentPtr object - * @return void - * @throw OutOfRangeException if index is out of range - */ - void removeAttachment(const IAttachmentPtr& attachment); - - /** - * get all attachments vector - * @return attachment vector - */ - std::vector getAttachments() const; - - /** - * get all attachments full path vector - * @return attachment path vector - */ - std::vector getAttachmentsFullPaths() const; - - /** - * get all attachments names vector - * @return attachment names vector - */ - std::vector getAttachmentsShortNames() const; - - /** - * get all attachments vector reference - * @return attachment vector - */ - const std::vector& getAttachmentsRef() const; - - /** - * set attachments - * @param[in] attachments - vector of and attachments full path - * @throw InvalidArgumentException - if file not exist - */ - void setAttachments(const std::vector& attachments, - bool isVirtualPath); - - /** - * set attachmentsPtr - * @param[in] attachments - vector of AttachmentPtr - */ - void setAttachments(const std::vector& attachments); - - /** - * check if attachments are modified and need update in platform - * @return bool - */ - bool isAttachmentsValid() const; - - /** - * setting validity after update - * @param[in] state - state for validity to set - */ - void setAttachmentsValidity(bool state); - - /** - * saving attachment file to selected destination file - * @param[in] destFileName - destination file to save attachment - * @param[in] attachment - attachment to be saved - */ - void saveAttachment(const std::string& destFileName, - const IAttachmentPtr& attachment); - - /** - * sets attachment at given position and expands array if needed - * @param[in] index - position - * @param[in] fullPath - path for attachment - * @throw InvalidArgumentException - if file not exist - */ - void setAttachmentWithExpand(const size_t index, - const std::string& fullPath, - bool isVirtualPath); - - /** - * The reverse() method reverses the order of the elements in an array - * (makes the last element first, and the first element last). - */ - void reverse(); - - /** - * Creates new attachment and inserts it at given position - * @param[in] index position - * @param[in] fullPath - path for attachment - * @param[in] isVirtualPath - true if path is virtual - * @throw InvalidArgumentException - if file not exist - */ - void insertAttachment(const size_t index, - const std::string& fullPath, - bool isVirtualPath); - - /** - * Creates new attachment and inserts it at given position and expands array if needed - * @param[in] index position - * @param[in] fullPath - path for attachment - * @param[in] isVirtualPath - true if path is virtual - * @throw InvalidArgumentException - if file not exist - */ - void insertAttachmentWithExpand(const size_t index, - const std::string& fullPath, - bool isVirtualPath); -}; - -typedef DPL::SharedPtr AttachmentsPtr; - -} -} -} - -#endif diff --git a/src/modules/API/Messaging/BccRecipient.cpp b/src/modules/API/Messaging/BccRecipient.cpp deleted file mode 100644 index ef3f0eb..0000000 --- a/src/modules/API/Messaging/BccRecipient.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file BccRecipient.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "BccRecipient.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -BccRecipient::BccRecipient() : - m_bccRecipients(new Recipients()) -{ -} - -BccRecipient::~BccRecipient() -{ -} - -void BccRecipient::setBccValidity(bool state) -{ - m_bccRecipients->setValid(state); -} - -bool BccRecipient::getBccValidity() const -{ - return m_bccRecipients->isValid(); -} - -Recipients BccRecipient::getBccRecipients() const -{ - return *m_bccRecipients; -} - -void BccRecipient::setBccRecipients(const Recipients& value) -{ - *m_bccRecipients = value; -} - -void BccRecipient::appendBccRecipients(const std::string & value) -{ - m_bccRecipients->appendRecipient(value); -} - -void BccRecipient::appendBccRecipients(const Recipients& value) -{ - *m_bccRecipients += value; -} - -void BccRecipient::removeBccRecipients(const Recipients& value) -{ - *m_bccRecipients -= value; -} - -RecipientsPtr BccRecipient::getBccRecipientsPtr() const -{ - return m_bccRecipients; -} - -} -} -} diff --git a/src/modules/API/Messaging/BccRecipient.h b/src/modules/API/Messaging/BccRecipient.h deleted file mode 100644 index a48e4b0..0000000 --- a/src/modules/API/Messaging/BccRecipient.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file BccRecipient.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef BCCRECIPIENT_H -#define BCCRECIPIENT_H - -#include -#include "Recipient.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -class BccRecipient -{ - private: // fields - - RecipientsPtr m_bccRecipients; - - public: - - BccRecipient(); - - virtual ~BccRecipient(); - - void setBccValidity(bool state); - - bool getBccValidity() const; - - Recipients getBccRecipients() const; - - RecipientsPtr getBccRecipientsPtr() const; - - void appendBccRecipients(const std::string & value); - - void appendBccRecipients(const Recipients& value); - - void removeBccRecipients(const Recipients& value); - - void setBccRecipients(const Recipients& value); -}; - -} -} -} - -#endif diff --git a/src/modules/API/Messaging/Body.cpp b/src/modules/API/Messaging/Body.cpp deleted file mode 100644 index ab99a4f..0000000 --- a/src/modules/API/Messaging/Body.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Body.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "Body.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -Body::Body() : - m_body(""), - m_validBody(false) -{ -} - -Body::~Body() -{ -} - -void Body::setBody(const std::string& value) -{ - m_body = value; - m_validBody = false; -} - -std::string Body::getBody() const -{ - return m_body; -} - -const std::string& Body::getBodyRef() const -{ - return m_body; -} - -bool Body::isBodyValid() const -{ - return m_validBody; -} - -void Body::setBodyValidity(bool state) -{ - m_validBody = state; -} - -} -} -} diff --git a/src/modules/API/Messaging/Body.h b/src/modules/API/Messaging/Body.h deleted file mode 100644 index 83342e5..0000000 --- a/src/modules/API/Messaging/Body.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Body.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef BODY_H -#define BODY_H - -#include - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -//-------------------------------------------------------------------------- - -class Body -{ - private: // fields - - /** - * body value - */ - std::string m_body; - - /** - * information if abstract message body has been changed and need update - * in low level - */ - bool m_validBody; - - public: // methods - - Body(); - - virtual ~Body(); - - /** - * setter of body value - */ - void setBody(const std::string& value); - - /** - * getter of body value - */ - std::string getBody() const; - - /** - * getter of body value - */ - const std::string& getBodyRef() const; - - /** - * check body validity - * */ - bool isBodyValid() const; - - /** - * set body validity - * */ - void setBodyValidity(bool state); -}; - -} -} -} - -#endif diff --git a/src/modules/API/Messaging/CallbackNumber.cpp b/src/modules/API/Messaging/CallbackNumber.cpp deleted file mode 100644 index a493705..0000000 --- a/src/modules/API/Messaging/CallbackNumber.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CallbackNumber.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include "CallbackNumber.h" -#include "CallbackNumber.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { - -CallbackNumber::CallbackNumber() : - m_callbackNumber(""), - m_validCallbackNumber(false) -{ -} - -CallbackNumber::~CallbackNumber() -{ -} - -void CallbackNumber::setCallbackNumber(const std::string& value) -{ - LogDebug("set callbackNumber=" << value); - m_callbackNumber = value; - m_validCallbackNumber = false; -} - -std::string CallbackNumber::getCallbackNumber() const -{ - return m_callbackNumber; -} - -const std::string& CallbackNumber::getCallbackNumberRef() const -{ - return m_callbackNumber; -} - -bool CallbackNumber::isCallbackNumberValid() const -{ - return m_validCallbackNumber; -} - -void CallbackNumber::setCallbackNumberValidity(bool state) -{ - m_validCallbackNumber = state; -} -} -} -} diff --git a/src/modules/API/Messaging/CallbackNumber.h b/src/modules/API/Messaging/CallbackNumber.h deleted file mode 100644 index bc14122..0000000 --- a/src/modules/API/Messaging/CallbackNumber.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CallbackNumber.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef CALLBACKNUMBER_H -#define CALLBACKNUMBER_H - -#include - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -//-------------------------------------------------------------------------- - -class CallbackNumber -{ - private: // fields - - /** - * CallbackNumber value - */ - std::string m_callbackNumber; - - /** - * information if abstract message body has been changed and need update - * in low level - */ - bool m_validCallbackNumber; - - public: // methods - - CallbackNumber(); - - virtual ~CallbackNumber(); - - /** - * setter of CallbackNumber value - */ - void setCallbackNumber(const std::string& value); - - /** - * getter of CallbackNumber value - */ - std::string getCallbackNumber() const; - - /** - * getter of CallbackNumber value - */ - const std::string& getCallbackNumberRef() const; - - /** - * check CallbackNumber validity - * */ - bool isCallbackNumberValid() const; - - /** - * set CallbackNumber validity - * */ - void setCallbackNumberValidity(bool state); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/CcRecipient.cpp b/src/modules/API/Messaging/CcRecipient.cpp deleted file mode 100644 index 84bb2c3..0000000 --- a/src/modules/API/Messaging/CcRecipient.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CcRecipient.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "CcRecipient.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -CcRecipient::CcRecipient() : - m_ccRecipients(new Recipients()) -{ -} - -CcRecipient::~CcRecipient() -{ -} - -void CcRecipient::setCcValidity(bool state) -{ - m_ccRecipients->setValid(state); -} - -bool CcRecipient::getCcValidity(void) const -{ - return m_ccRecipients->isValid(); -} - -Recipients CcRecipient::getCcRecipients() const -{ - return *m_ccRecipients; -} - -RecipientsPtr CcRecipient::getCcRecipientsPtr() const -{ - return m_ccRecipients; -} - -void CcRecipient::appendCcRecipients(const std::string & value) -{ - m_ccRecipients->appendRecipient(value); -} - -void CcRecipient::appendCcRecipients(const Recipients& value) -{ - *m_ccRecipients += value; -} - -void CcRecipient::removeCcRecipients(const Recipients& value) -{ - *m_ccRecipients -= value; -} - -void CcRecipient::setCcRecipients(const Recipients& value) -{ - *m_ccRecipients = value; -} - -} -} -} diff --git a/src/modules/API/Messaging/CcRecipient.h b/src/modules/API/Messaging/CcRecipient.h deleted file mode 100644 index 9575ffc..0000000 --- a/src/modules/API/Messaging/CcRecipient.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CcRecipient.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef CCRECIPIENT_H -#define CCRECIPIENT_H - -#include -#include "Recipient.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -//-------------------------------------------------------------------------- - -class CcRecipient -{ - private: // fields - - RecipientsPtr m_ccRecipients; - - public: - - CcRecipient(); - - virtual ~CcRecipient(); - - void setCcValidity(bool state); - - bool getCcValidity(void) const; - - Recipients getCcRecipients() const; - - RecipientsPtr getCcRecipientsPtr() const; - - void appendCcRecipients(const std::string & value); - - void appendCcRecipients(const Recipients& value); - - void removeCcRecipients(const Recipients& value); - - void setCcRecipients(const Recipients& value); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/EmailAccountInfo.cpp b/src/modules/API/Messaging/EmailAccountInfo.cpp deleted file mode 100644 index 47ec90b..0000000 --- a/src/modules/API/Messaging/EmailAccountInfo.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include -#include -#include "EmailAccountInfo.h" - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -EmailAccountInfo::EmailAccountInfo(int id, - const std::string& name, - const std::string& address) : - m_name(name), - m_address(address) -{ - std::stringstream stream; - stream << id; - if (stream.fail()) { - ThrowMsg(Commons::UnknownException, - "Couldn't convert e-mail account id"); - } - m_id = stream.str(); -} - -EmailAccountInfo::EmailAccountInfo(const std::string& id, - const std::string& name, - const std::string& address) : - m_id(id), - m_name(name), - m_address(address) -{ -} - -int EmailAccountInfo::getIntId() const -{ - int result = 0; - std::stringstream stream(m_id); - stream >> result; - if (stream.fail()) { - ThrowMsg(Commons::UnknownException, - "Couldn't convert e-mail account id"); - } - return result; -} - -std::string EmailAccountInfo::getId() const -{ - return m_id; -} - -std::string EmailAccountInfo::getName() const -{ - return m_name; -} - -std::string EmailAccountInfo::getAddress() const -{ - return m_address; -} - -bool EmailAccountInfo::operator==(const EmailAccountInfo& account) const -{ - return (m_id == account.m_id && - m_name == account.m_name && - m_address == account.m_address); -} -}} -} diff --git a/src/modules/API/Messaging/EmailAccountInfo.h b/src/modules/API/Messaging/EmailAccountInfo.h deleted file mode 100644 index 16c230d..0000000 --- a/src/modules/API/Messaging/EmailAccountInfo.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_MESSAGING_EMAILACCOUNTINFO_H_ -#define WRTDEVICEAPIS_MESSAGING_EMAILACCOUNTINFO_H_ - -#include - -namespace WrtDeviceApis { -namespace Messaging{ -namespace Api { -class EmailAccountInfo -{ - public: - EmailAccountInfo(int id, - const std::string& name, - const std::string& address); - - EmailAccountInfo(const std::string& id, - const std::string& name, - const std::string& address); - - int getIntId() const; - - std::string getId() const; - - std::string getName() const; - - std::string getAddress() const; - - bool operator==(const EmailAccountInfo& account) const; - - private: - std::string m_id; - std::string m_name; - std::string m_address; -}; -} -} -} -#endif // WRTDEVICEAPIS_MESSAGING_EMAILACCOUNTINFO_H_ diff --git a/src/modules/API/Messaging/EmitterMessageReceived.cpp b/src/modules/API/Messaging/EmitterMessageReceived.cpp deleted file mode 100644 index 6fcc435..0000000 --- a/src/modules/API/Messaging/EmitterMessageReceived.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include "EmitterMessageReceived.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MessageFilterPtr EmitterMessageReceived::getFilter() const -{ - return m_filter; -} - -void EmitterMessageReceived::setFilter(const MessageFilterPtr& filter) -{ - m_filter = filter; -} -}} // Api -} // WrtDeviceApis diff --git a/src/modules/API/Messaging/EmitterMessageReceived.h b/src/modules/API/Messaging/EmitterMessageReceived.h deleted file mode 100644 index 56f5e32..0000000 --- a/src/modules/API/Messaging/EmitterMessageReceived.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_MESSAGING_EMITTERMESSAGERECEIVED_H_ -#define WRTDEVICEAPIS_MESSAGING_EMITTERMESSAGERECEIVED_H_ - -#include -#include -#include "EventMessageReceived.h" -#include "MessageFilter.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EmitterMessageReceived : public Commons::ListenerEventEmitter< - EventMessageReceived> -{ - public: - virtual MessageFilterPtr getFilter() const; - virtual void setFilter(const MessageFilterPtr& filter); - - private: - MessageFilterPtr m_filter; -}; - -typedef DPL::SharedPtr EmitterMessageReceivedPtr; -} // Api -} // WrtDeviceApis -} -#endif // WRTDEVICEAPIS_MESSAGING_EMITTERMESSAGERECEIVED_H_ diff --git a/src/modules/API/Messaging/EventDeleteMessage.h b/src/modules/API/Messaging/EventDeleteMessage.h deleted file mode 100644 index c2f5780..0000000 --- a/src/modules/API/Messaging/EventDeleteMessage.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventDeleteMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef EVENTDELETEMESSAGE_H -#define EVENTDELETEMESSAGE_H - -#include - -#include -#include "IMessaging.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventDeleteMessage; - -typedef DPL::SharedPtr EventDeleteMessagePtr; - -class EventDeleteMessage : - public WrtDeviceApis::Commons::IEvent -{ - public: - - IMessagePtr msg; - - virtual void clearOnCancel() - { - } -}; -} -}} -#endif diff --git a/src/modules/API/Messaging/EventFindMessage.h b/src/modules/API/Messaging/EventFindMessage.h deleted file mode 100644 index 9971170..0000000 --- a/src/modules/API/Messaging/EventFindMessage.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventFindMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef EVENTFINDMESSAGE_H -#define EVENTFINDMESSAGE_H - -#include -#include -#include -#include "IMessage.h" -#include "MessageFilter.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventFindMessage; - -typedef DPL::SharedPtr EventFindMessagePtr; - -class EventFindMessage : - public WrtDeviceApis::Commons::IEvent -{ - public: - - // input parameters - MessageFilterPtr messageFilter; - std::vector messageTypes; - std::vector folderTypes; - - //output parameter - std::vector msgs; - - virtual void clearOnCancel() - { - } -}; -} -}} -#endif diff --git a/src/modules/API/Messaging/EventMessageReceived.cpp b/src/modules/API/Messaging/EventMessageReceived.cpp deleted file mode 100644 index ba801c4..0000000 --- a/src/modules/API/Messaging/EventMessageReceived.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include "EventMessageReceived.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -EventMessageReceived::~EventMessageReceived() -{ -} - -const IMessagePtr EventMessageReceived::getMessage() const -{ - return m_message; -} - -void EventMessageReceived::setMessage(const IMessagePtr& message) -{ - m_message = message; -} -}} // Api -} // WrtDeviceApis diff --git a/src/modules/API/Messaging/EventMessageReceived.h b/src/modules/API/Messaging/EventMessageReceived.h deleted file mode 100644 index fc11aaa..0000000 --- a/src/modules/API/Messaging/EventMessageReceived.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventReceiveMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef WRTDEVICEAPIS_MESSAGING_EVENTMESSAGERECEIVED_H_ -#define WRTDEVICEAPIS_MESSAGING_EVENTMESSAGERECEIVED_H_ - -#include -#include -#include "IMessage.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventMessageReceived : public Commons::ListenerEvent< - EventMessageReceived> -{ - public: - virtual ~EventMessageReceived(); - - const IMessagePtr getMessage() const; - void setMessage(const IMessagePtr& message); - - private: - IMessagePtr m_message; -}; - -typedef DPL::SharedPtr EventMessageReceivedPtr; -} // Api -} // WrtDeviceApis -} -#endif // WRTDEVICEAPIS_MESSAGING_EVENTMESSAGERECEIVED_H_ diff --git a/src/modules/API/Messaging/EventOnSendingFailed.h b/src/modules/API/Messaging/EventOnSendingFailed.h deleted file mode 100644 index 2159bb1..0000000 --- a/src/modules/API/Messaging/EventOnSendingFailed.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file EventOnSendingFailed.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef EVENTONSENDINGFAILED_H_ -#define EVENTONSENDINGFAILED_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -/* - * - */ -class EventOnSendingFailed : public Commons::ListenerEvent< - EventOnSendingFailed> -{ - public: - typedef enum - { - NO_NETWORKING, - NO_CONNECTION, - BAD_PAYLOAD, - UNKNOWN - } ErrorCode; - - EventOnSendingFailed() - { - } - - void setError(ErrorCode error) - { - m_error = error; - } - - ErrorCode getError() const - { - return m_error; - } - - private: - ErrorCode m_error; -}; - -typedef DPL::SharedPtr EventOnSendingFailedPtr; -typedef Commons::ListenerEventEmitter -EventOnSendingFailedEmitter; -typedef DPL::SharedPtr -EventOnSendingFailedEmitterPtr; -} // Api -} // WrtDeviceApis -} -#endif /* EVENTONSENDINGFAILED_H_ */ diff --git a/src/modules/API/Messaging/EventSendMessage.h b/src/modules/API/Messaging/EventSendMessage.h deleted file mode 100644 index b3d9d8f..0000000 --- a/src/modules/API/Messaging/EventSendMessage.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventSendMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef EVENTSENDMESSAGE_H -#define EVENTSENDMESSAGE_H - -#include -#include -#include - -#include -#include "IMessaging.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventSendMessage; - -typedef DPL::SharedPtr EventSendMessagePtr; - -class EventSendMessage : - public WrtDeviceApis::Commons::IEvent -{ -public: - struct RecipientSendResult - { - RecipientSendResult(const std::string& recipient, bool send) - : recipient(recipient), - send(send) - { } - std::string recipient; - bool send; - }; - - explicit EventSendMessage(const IMessagePtr& message) - : m_message(message), - m_store(false) - { } - - IMessagePtr getMessage() const - { - return m_message; - } - - bool getStore() const - { - return m_store; - } - - void setStore(bool store) - { - m_store = store; - } - - void addRecipientSendResult(const std::string& recipient, bool send) - { - m_results.push_back(RecipientSendResult(recipient, send)); - } - - void addRecipientsSendResult(const std::vector& recipients, - bool send) - { - for_each(recipients.begin(), - recipients.end(), - [&m_results, &send](const std::string& recipient) - { - m_results.push_back(RecipientSendResult(recipient, send)); - }); - } - - std::vector getRecipientSendResults() const - { - return m_results; - } - - private: - IMessagePtr m_message; - bool m_store; - std::vector m_results; -}; -} -}} -#endif diff --git a/src/modules/API/Messaging/EventUpdateMessage.h b/src/modules/API/Messaging/EventUpdateMessage.h deleted file mode 100644 index 22f5a02..0000000 --- a/src/modules/API/Messaging/EventUpdateMessage.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventUpdateMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef EVENTUPDATEMESSAGE_H -#define EVENTUPDATEMESSAGE_H - -#include - -#include -#include "IMessaging.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventUpdateMessage; - -typedef DPL::SharedPtr EventUpdateMessagePtr; - -class EventUpdateMessage : - public WrtDeviceApis::Commons::IEvent -{ - public: - - IMessagePtr msg; - - virtual void clearOnCancel() - { - } -}; - -typedef Commons::EventAnswerReceiver< Api::EventUpdateMessage > -EventUpdateMessageAnswerReceiver; -} -}} -#endif diff --git a/src/modules/API/Messaging/From.cpp b/src/modules/API/Messaging/From.cpp deleted file mode 100644 index eeb5fcd..0000000 --- a/src/modules/API/Messaging/From.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file From.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "From.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -From::From() : - m_from(""), - m_validFrom(false) -{ -} - -From::~From() -{ -} - -void From::setFrom(const std::string& value) -{ - m_from = value; - m_validFrom = false; -} - -std::string From::getFrom() const -{ - return m_from; -} - -const std::string& From::getFromRef() const -{ - return m_from; -} - -void From::setFromValidity(bool val) -{ - m_validFrom = val; -} - -bool From::getFromValidity() const -{ - return m_validFrom; -} -}} -} diff --git a/src/modules/API/Messaging/From.h b/src/modules/API/Messaging/From.h deleted file mode 100644 index 09e5145..0000000 --- a/src/modules/API/Messaging/From.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file From.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef FROM_H -#define FROM_H - -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class From -{ - private: // fields - - /** - * from value - */ - std::string m_from; - - /** - * information if abstract message from has been changed and need update - * in low level - */ - bool m_validFrom; - - public: // methods - - From(); - - virtual ~From(); - - /** - * setter of from value - */ - void setFrom(const std::string& value); - - /** - * getter of from value - */ - std::string getFrom() const; - - const std::string& getFromRef() const; - - void setFromValidity(bool val); - - bool getFromValidity() const; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IAttachment.cpp b/src/modules/API/Messaging/IAttachment.cpp deleted file mode 100644 index 6a1d7f3..0000000 --- a/src/modules/API/Messaging/IAttachment.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IAttachment.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include -#include "IAttachment.h" - -extern "C" { -#include -#include -} - -using namespace WrtDeviceApis::Commons; -using namespace std; - -//-------------------------------------------------------------------------- -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IAttachment::IAttachment() : - m_validAttachment(false) -{ -} - -void IAttachment::init(const string& fullPath, - bool isVirtualPath) -{ - Try - { - struct stat buffer; - std::string l_fullPath; - - if (isVirtualPath) { - LogDebug("translating path"); - l_fullPath = getRealPath(fullPath); - } else { - l_fullPath = fullPath; - } - - LogDebug("real path " << l_fullPath); - - char buff[PATH_MAX + 1]; - if (NULL == realpath(l_fullPath.c_str(), buff)) { - std::string errnoString = DPL::GetErrnoString(); - LogError("get full path problem " << errnoString); - ThrowMsg(InvalidArgumentException, - "get full path problem " << errnoString); - } - if (-1 == lstat(buff, &buffer)) { - LogError("Attachment file not exist"); - ThrowMsg(InvalidArgumentException, "Attachment file not exist"); - } - if (!S_ISREG(buffer.st_mode)) { - LogError("Attachment file not exist"); - ThrowMsg(InvalidArgumentException, "Attachment file not exist"); - } - m_fileSize = buffer.st_size; - m_attachFullPath = l_fullPath; - makeShortName(); - m_isCreatedProperly = true; - } - - Catch(Commons::Exception) { - LogError("attachment not created properly"); - m_isCreatedProperly = false; - } -} - -IAttachment::~IAttachment() -{ - LogDebug("enter"); -} - -string IAttachment::getShortName() const -{ - return m_attachShortName; -} - -string IAttachment::getFullPath() const -{ - return m_attachFullPath; -} - -unsigned int IAttachment::getFileSize() const -{ - return m_fileSize; -} - -std::string IAttachment::getMimeType() const -{ - return m_mimeType; -} - -void IAttachment::setMimeType(const std::string &mimeType) -{ - m_mimeType = mimeType; -} - -bool IAttachment::getIsCreatedProperly() const -{ - return m_isCreatedProperly; -} - -void IAttachment::rename(const string& newName) -{ - // path for attachment is still not changed - m_attachShortName = newName; - m_validAttachment = false; -} - -void IAttachment::makeShortName() -{ - size_t pos; - // 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"); - Throw(InvalidArgumentException); - } - m_attachShortName = m_attachFullPath.substr(pos + 1); -} - -} -} -} diff --git a/src/modules/API/Messaging/IAttachment.h b/src/modules/API/Messaging/IAttachment.h deleted file mode 100644 index 897dad6..0000000 --- a/src/modules/API/Messaging/IAttachment.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IAttachment.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IATTACHMENT_H -#define IATTACHMENT_H - -#include -#include -#include "IMessagingTypes.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IAttachment; -typedef DPL::SharedPtr IAttachmentPtr; - -//-------------------------------------------------------------------------- - -class IAttachment -{ - protected: // fields - - /** - * value of attachment full path name - */ - std::string m_attachFullPath; - - /** - * value of attachment short name used to display in message - */ - std::string m_attachShortName; - - /** - * value of attachment file size - */ - unsigned int m_fileSize; - - /** - * value of attachment mime type - */ - std::string m_mimeType; - - /** - * information if abstract message attachment has been changed and need - * update in low level - * only name may be changed, not path - */ - bool m_validAttachment; - - bool m_isCreatedProperly; - - public: // methods - - explicit IAttachment(); - - void init(const std::string& fullPath, - bool isVirtualPath); - - virtual ~IAttachment(); - - /** - * getter of attachment name (only name without path) value - */ - std::string getShortName() const; - - /** - * getter of attachment name (full path) value - */ - std::string getFullPath() const; - - /** - * getter of attachment size - */ - unsigned int getFileSize() const; - - /** - * getter of attachment mime type - */ - std::string getMimeType() const; - - /** - * setter of attachment mime type - */ - void setMimeType(const std::string &mimeType); - - /** - * getter of attachment valid - */ - bool getIsCreatedProperly() const; - - /** - * rename short name value of attachment - */ - void rename(const std::string& newName); - - private: - - void makeShortName(); - - virtual std::string getRealPath(const std::string &path) const = 0; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IBinarySms.cpp b/src/modules/API/Messaging/IBinarySms.cpp deleted file mode 100644 index d9e8053..0000000 --- a/src/modules/API/Messaging/IBinarySms.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IBinarySms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "IBinarySms.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IBinarySms::IBinarySms(const std::string& id) : - IMessage(BINARYSMS, id) -{ - LogDebug("enter"); -} - -IBinarySms::~IBinarySms() -{ - LogDebug("enter"); -} -}} -} diff --git a/src/modules/API/Messaging/IBinarySms.h b/src/modules/API/Messaging/IBinarySms.h deleted file mode 100644 index 768edad..0000000 --- a/src/modules/API/Messaging/IBinarySms.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IBinarySms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IBINARYSMS_H -#define IBINARYSMS_H - -#include "IMessage.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class IBinarySms; -typedef DPL::SharedPtr IBinarySmsPtr; - -class IBinarySms : - virtual public IMessage -{ - public: // fields - - public: // methods - - explicit IBinarySms(const std::string& id = ""); - - virtual ~IBinarySms(); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IEmail.cpp b/src/modules/API/Messaging/IEmail.cpp deleted file mode 100644 index 1c71764..0000000 --- a/src/modules/API/Messaging/IEmail.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IEmail.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "IEmail.h" -#include - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IEmail::IEmail(const string& id) : IMessage(EMAIL, id) -{ - LogInfo("enter"); -} - -IEmail::~IEmail() -{ - LogInfo("enter"); -} - -IEmail & IEmail::operator <<(const VirtualMessage& msg) -{ - setBody(msg.getBodyRef()); - setFolderType(msg.getCurrentFolder()); - setCurrentUserFolder(msg.getCurrentUserFolder()); - setFrom(msg.getFromRef()); - setDateTime(msg.getDateTime()); - setSourceAddress(msg.getSourceAddress()); - setToRecipients(msg.getToRecipients()); - - setAttachments(msg.getAttachments()); - setBccRecipients(msg.getBccRecipients()); - setCcRecipients(msg.getCcRecipients()); - setSubject(msg.getSubjectRef()); - - return *this; -} -}} -} diff --git a/src/modules/API/Messaging/IEmail.h b/src/modules/API/Messaging/IEmail.h deleted file mode 100644 index 82bff21..0000000 --- a/src/modules/API/Messaging/IEmail.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IEmail.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IEMAIL_H -#define IEMAIL_H - -#include -#include -#include "VirtualMessage.h" -#include "IMessage.h" -#include "Subject.h" -#include "ToRecipient.h" -#include "CcRecipient.h" -#include "BccRecipient.h" -#include "Attachments.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IEmail : virtual public IMessage, - public CcRecipient, - public BccRecipient, - public Attachments -{ - public: - explicit IEmail(const std::string& id = ""); - - virtual ~IEmail(); - - IEmail & operator <<(const VirtualMessage& msg); - - virtual int getAccountId() const = 0; -}; - -typedef DPL::SharedPtr IEmailPtr; -} -} -} -#endif // IEMAIL_H - diff --git a/src/modules/API/Messaging/IEmailAccount.cpp b/src/modules/API/Messaging/IEmailAccount.cpp deleted file mode 100644 index ce4fc51..0000000 --- a/src/modules/API/Messaging/IEmailAccount.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IEmailAccount.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include "IEmailAccount.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IEmailAccount::IEmailAccount() : - m_currentAccount("", "", ""), - m_validAccount(false) -{ -} - -IEmailAccount::~IEmailAccount() -{ -} - -void IEmailAccount::setCurrentEmailAccount(const EmailAccountInfo& account) -{ - std::vector accounts = getEmailAccounts(); - if (std::find(accounts.begin(), accounts.end(), - account) != accounts.end()) { - m_currentAccount = account; - } else { - ThrowMsg(Commons::InvalidArgumentException, - "Wrong account name, account not exist"); - } -} - -EmailAccountInfo IEmailAccount::getCurrentEmailAccount() const -{ - return m_currentAccount; -} - -bool IEmailAccount::isCurrentAccountValid() const -{ - return m_validAccount; -} - -void IEmailAccount::setCurrentAccountValid(bool state) -{ - m_validAccount = state; -} -}} -} diff --git a/src/modules/API/Messaging/IEmailAccount.h b/src/modules/API/Messaging/IEmailAccount.h deleted file mode 100644 index 997aa5b..0000000 --- a/src/modules/API/Messaging/IEmailAccount.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EmailAccount.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IEMAILACCOUNT_H -#define IEMAILACCOUNT_H - -#include -#include "EmailAccountInfo.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IEmailAccount -{ - public: - IEmailAccount(); - - virtual ~IEmailAccount(); - - /** - * get avialable emails accounts - */ - virtual std::vector getEmailAccounts() const = 0; - - /** - * setter of current email account value - */ - void setCurrentEmailAccount(const EmailAccountInfo& value); - - /** - * getter of current email account value - */ - EmailAccountInfo getCurrentEmailAccount() const; - - /** - * check validity state - */ - bool isCurrentAccountValid() const; - - /** - * setter for validity state - */ - void setCurrentAccountValid(bool state); - - private: - - /** - * abstract value of current email account - */ - EmailAccountInfo m_currentAccount; - - /** - * information if abstract message current account has been changed - * and need update in low level - */ - bool m_validAccount; -}; -} -} -} -#endif // IEMAILACCOUNT_H diff --git a/src/modules/API/Messaging/IMessage.cpp b/src/modules/API/Messaging/IMessage.cpp deleted file mode 100644 index a78c075..0000000 --- a/src/modules/API/Messaging/IMessage.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMessage.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include "IMessage.h" -#include "EventSendMessage.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IMessage::IMessage(const MessageType msgType, - const string& id) : - m_id(id), - m_msgType(msgType), - m_readStatus(false), - m_validReadStatus(false), - m_folder(DRAFTBOX), - m_requestReceiver(NULL), - m_sendMessageEvent(NULL) -{ - LogDebug("message creation, msgId=" << m_id << ", msgType=" << m_msgType); - - //initialize dateTime of message - time_t rawtime; - time(&rawtime); - tm* local = localtime(&rawtime); - if (local) { - m_dateTime = *local; - } else { - LogError("Failed to initialize message dateTime"); - } -} - -IMessage::~IMessage() -{ - LogDebug("destroying message, msgId=" << m_id << ", msgType=" << m_msgType); -} - -string IMessage::getId() const -{ - return m_id; -} - -const string& IMessage::getIdRef() const -{ - return m_id; -} - -MessageType IMessage::getMessageType() const -{ - return m_msgType; -} - -struct tm IMessage::getDateTime() const -{ - return m_dateTime; -} - -string IMessage::convertId(int arg) const -{ - ostringstream stream; - stream << arg; - return stream.str(); -} - -int IMessage::convertId(const string& arg) const -{ - int retVal = 0; - istringstream(arg) >> retVal; - return retVal; -} - -void IMessage::setId(const string& value) -{ - m_id = value; -} - -void IMessage::setDateTime(const tm dateTime) -{ - m_dateTime = dateTime; -} - -void IMessage::setReadStatus(bool state) -{ - m_validReadStatus = false; - m_readStatus = state; -} - -void IMessage::setSize(int size) -{ - m_size = size; -} - -int IMessage::getSize() const -{ - return m_size; -} - -bool IMessage::isRead() const -{ - return m_readStatus; -} - -bool IMessage::isReadStatusValid() const -{ - return m_validReadStatus; -} - -void IMessage::setReadStatusValidity(bool valid) -{ - m_validReadStatus = valid; -} - -FolderType IMessage::getCurrentFolder() const -{ - return m_folder; -} - -void IMessage::setFolderType(FolderType folder) -{ - m_folder = folder; -} - -string IMessage::getCurrentUserFolder() const -{ - if (m_folder != USERDEFINED_FOLDER) { - LogError("folder is not user folder type"); - Throw(Commons::UnknownException); - } - return m_userFolderName; -} - -void IMessage::setCurrentUserFolder(const std::string& arg) -{ - m_userFolderName = arg; -} - -bool IMessage::validatePhoneNumber(std::string& number) -{ - LogDebug("testing number=" << number); - pcrecpp::RE re("[^0-9#\\+\\*]?"); - re.GlobalReplace("", &number); - if (number.empty()) { - LogError("wrong phoneNumber=" << number); - return false; - } - LogDebug("phoneNumber=" << number); - - return true; -} - -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"); - return false; - } - } - return true; -} - -bool IMessage::validateEmailAddr(const std::string& email) -{ - if (email.empty()) { - return false; - } - pcrecpp::RE re( - "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}" - "\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\" - ".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$" - ); - if (re.FullMatch(email)) { - LogDebug("emailAddress=" << email); - return true; - } - LogError("wrong emailAddress=" << email); - return false; -} - -void IMessage::setEmitter(const EventOnSendingFailedEmitterPtr& emitter) -{ - m_emitter = emitter; -} - -EventOnSendingFailedEmitterPtr IMessage::getEmitter() const -{ - return m_emitter; -} - -void IMessage::setSendMessageEvent(const EventSendMessagePtr &event) -{ - m_sendMessageEvent = event; -} - -EventSendMessagePtr IMessage::getSendMessageEvent() const -{ - return m_sendMessageEvent; -} - -void IMessage::setRequestReceiver(ReqReceiverMessage* reqReceiver) -{ - m_requestReceiver = reqReceiver; -} - -ReqReceiverMessage* IMessage::getRequestReceiver() const -{ - return m_requestReceiver; -} -}} -} diff --git a/src/modules/API/Messaging/IMessage.h b/src/modules/API/Messaging/IMessage.h deleted file mode 100644 index cdb48f4..0000000 --- a/src/modules/API/Messaging/IMessage.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IMESSAGE_H -#define IMESSAGE_H - -#include -#include -#include -#include -#include "IMessagingTypes.h" -#include "ToRecipient.h" -#include "Body.h" -#include "From.h" -#include "SourceAddress.h" -#include "MessagePriority.h" -#include "CallbackNumber.h" -#include "ValidityPeriodHours.h" -#include "Subject.h" -#include "EventOnSendingFailed.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class EventSendMessage; -typedef DPL::SharedPtr EventSendMessagePtr; - -//-------------------------------------------------------------------------- - -class IMessage; -typedef DPL::SharedPtr IMessagePtr; - -//-------------------------------------------------------------------------- - -class ReqReceiverMessage; - -//-------------------------------------------------------------------------- - -class IMessage : - public DPL::EnableSharedFromThis, - public ToRecipient, - public Body, - public From, - public SourceAddress, - public MessagePriority, - public CallbackNumber, - public ValidityPeriodHours, - public Subject -{ - private: // fields - - /** - * id of message - */ - std::string m_id; - - /** - * message type value - */ - const MessageType m_msgType; - - /** - * Message creation date time - */ - struct tm m_dateTime; - - /** - * Message read status - */ - bool m_readStatus; - - /** - * Read status validity. - */ - bool m_validReadStatus; - - /** - * Message size in bytes - */ - int m_size; - - /** - * Message current folder - */ - FolderType m_folder; - - /** - * User folder name - */ - std::string m_userFolderName; - - /* - * Event emitter. Used when there is one global callback function - */ - EventOnSendingFailedEmitterPtr m_emitter; - - /* - * Request receiver. Used when there are callback funtions assigned at function executing scope - */ - ReqReceiverMessage *m_requestReceiver; - - /* - * SendMessage event. Used when there are callback funtions assigned at function executing scope - */ - EventSendMessagePtr m_sendMessageEvent; - - protected: - void setSize(int size); - - public: // methods - - /** - * constructor of abstraction message - * @param[in] msgType - type of message according to MessageType - * @param[in] id - id of message, if id is empty, new message will be - * created, othercase message will be read from low - * level message - */ - explicit IMessage(const MessageType msgType, - const std::string& id = ""); - - virtual ~IMessage(); - - /** - * method is used to send message specyfied type - * @throw PlatformException Thrown when sending fail - */ - virtual void send() = 0; - - /** - * method is used to cancel sending message - * @throw PlatformException Thrown when sending fail - */ - virtual void sendCancel() = 0; - - /** - * method used to update all fields in lower level - * @param[in] draftsOnly - if true only draft messages can be - * fully updated. Other messages can only have read flag changed - * @throw PlatformException Thrown when update fail - */ - virtual void update(bool draftsOnly = false) = 0; - - /** - * method used to read all data from low level message - * @throw PlatformException Thrown when reading message fail - */ - virtual void readAllData() = 0; - - /** - * method used to get current storage folder - */ - virtual FolderType getCurrentFolder() const; - - /** - * method used to get current user folder name - */ - virtual std::string getCurrentUserFolder() const; - - /** - * method used to set current user folder name - */ - void setCurrentUserFolder(const std::string& arg); - - /** - * method used to move message to new folder - * @param[in] newFolder - destination folder - * @throw PlatformException Thrown when move message to folder fail - */ - virtual void moveToFolder(const FolderType newFolder) = 0; - - /** - * method used to move message to user defined new folder - * @param[in] newFolder - users destination folder - * @throw PlatformException Thrown when move message to folder fail - */ - virtual void moveToFolder(const std::string& newFolder) = 0; - - /** - * method used to copy message to new folder (create new message with - * new message id) - * @param[in] newFolder - destination folder - * @throw PlatformException Thrown when copy message to folder fail - */ - virtual void copyToFolder(const FolderType newFolder) = 0; - - /** - * method used to copy message to user defined new folder - * @param[in] newFolder - users destination folder - * @throw PlatformException Thrown when move message to folder fail - */ - virtual void copyToFolder(const std::string& newFolder) = 0; - - /** - * method used to identify message type - */ - MessageType getMessageType() const; - - /** - * method used to get message id - */ - std::string getId() const; - - /** - * method used to get message size - */ - int getSize() const; - - /** - * method used to get message id - */ - virtual const std::string& getIdRef() const; - - /** - * used for get tm struct - */ - struct tm getDateTime() const; - - /** - * Is message already been read - */ - virtual bool isRead() const; - - /** - * Is message already been read - */ - virtual void setReadStatus(bool state); - - /** - * Returns true if read status is valid - */ - bool isReadStatusValid() const; - - /** - * Sets read status validity - */ - void setReadStatusValidity(bool valid); - - /** - * Remove message - * @throw PlatformException Thrown when remove message fail - */ - virtual void remove() = 0; - - /** - * convert id from int to string - */ - virtual std::string convertId(int arg) const; - - /** - * convert id from string to int - */ - virtual int convertId(const std::string& arg) const; - - /** - * set message id - */ - void setId(const std::string& id); - - /** - * set date time - */ - void setDateTime(const tm dateTime); - - /** - * set current folder - */ - virtual void setFolderType(FolderType folder); - - /** - * validate phone number, if fail return false - * if number contains wrong characters, then cut them - */ - bool validatePhoneNumber(std::string& number); - - /** - * validate email address, if fail return false - */ - bool validateEmailAddr(const Recipients& addr); - - /** - * validate email address, if fail return false - */ - bool validateEmailAddr(const std::string& email); - - /* - * Sets event emitter - */ - void setEmitter(const EventOnSendingFailedEmitterPtr& emitter); - - /* - * Gets event emitter - */ - EventOnSendingFailedEmitterPtr getEmitter() const; - - void setSendMessageEvent(const EventSendMessagePtr &event); - - EventSendMessagePtr getSendMessageEvent() const; - - void setRequestReceiver(ReqReceiverMessage* reqReceiver); - - ReqReceiverMessage* getRequestReceiver() const; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IMessaging.cpp b/src/modules/API/Messaging/IMessaging.cpp deleted file mode 100644 index 1884b19..0000000 --- a/src/modules/API/Messaging/IMessaging.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMessaging.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "IMessaging.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IMessaging& IMessaging::getInstance() -{ - return Messaging::getInstance(); -} - -IMessaging::~IMessaging() -{ -} -}} -} diff --git a/src/modules/API/Messaging/IMessaging.h b/src/modules/API/Messaging/IMessaging.h deleted file mode 100644 index 98eed03..0000000 --- a/src/modules/API/Messaging/IMessaging.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMessaging.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IMESSAGING_H -#define IMESSAGING_H - -#include -#include "IMessagingTypes.h" -#include "ISms.h" -#include "IBinarySms.h" -#include "IMms.h" -#include "IEmail.h" -#include "VirtualMessage.h" -#include "MessageFactory.h" -#include "IEmailAccount.h" -#include "MessageFilter.h" -#include "EmitterMessageReceived.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IMessaging : private DPL::Noncopyable, - public IEmailAccount -{ - public: - static IMessaging& getInstance(); - - public: - virtual ~IMessaging() = 0; - - virtual void getNumberOfMessages(MessageType msgType, - FolderType folder, - int* readed, - int* unReaded) = 0; - - virtual std::vector findMessages( - const std::vector& msgTypes, - FolderType folder, - const Api::MessageFilterPtr& filter) = 0; - - virtual std::vector findMessages( - const std::vector& msgTypes, - const std::string &folder, - const Api::MessageFilterPtr& filter) = 0; - - virtual std::vector getMessageIds(MessageType msgType, - FolderType folder) = 0; - - virtual void createFolder(MessageType msgType, - const std::string& userFolder) = 0; - - virtual void deleteFolder(MessageType msgType, - const std::string& userFolder) = 0; - - virtual std::vector getFolderNames(MessageType msgType) = 0; - - virtual void addOnMessageReceived(const EmitterMessageReceivedPtr& emitter) - = 0; - - virtual void removeOnMessageReceived(EmitterMessageReceived::IdType id) = 0; - - virtual void fetchEmailHeaders() = 0; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IMessagingTypes.h b/src/modules/API/Messaging/IMessagingTypes.h deleted file mode 100644 index 8a068ae..0000000 --- a/src/modules/API/Messaging/IMessagingTypes.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMessagingTypes.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IMESSAGINGTYPES_H -#define IMESSAGINGTYPES_H - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -enum MessageType -{ - SMS, - BINARYSMS, - MMS, - EMAIL, - VIRTUAL_MESSAGE, - MESSAGETYPE_COUNT -}; - -//-------------------------------------------------------------------------- - -enum FolderType -{ - INBOX, - OUTBOX, - SENTBOX, - DRAFTBOX, - SPAMBOX, - ALL_FOLDERS, - USERDEFINED_FOLDER, - FOLDERTYPE_COUNT -}; - -//-------------------------------------------------------------------------- - -enum AddressType -{ - TO_ADDRESS, - CC_ADDRESS, - BCC_ADDRESS, - ADDRESS_COUNT -}; -} -} - -} -#endif diff --git a/src/modules/API/Messaging/IMms.cpp b/src/modules/API/Messaging/IMms.cpp deleted file mode 100644 index 459f9de..0000000 --- a/src/modules/API/Messaging/IMms.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "IMms.h" -#include "ValidityPeriodHours.h" -#include - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IMms::IMms(const string& id) : - IMessage(MMS, id), - m_mmsType(MULTIPART_MIXED) -{ - LogInfo("enter"); -} - -IMms::~IMms() -{ - LogInfo("enter"); -} - -IMms::MMSType IMms::getMmsType() const -{ - return m_mmsType; -} - -void IMms::setMmsType(MMSType type) -{ - m_mmsType = type; -} - -IMms & IMms::operator <<(const VirtualMessage& msg) -{ - setBody(msg.getBodyRef()); - setFolderType(msg.getCurrentFolder()); - setCurrentUserFolder(msg.getCurrentUserFolder()); - setFrom(msg.getFromRef()); - setDateTime(msg.getDateTime()); - setSourceAddress(msg.getSourceAddress()); - setToRecipients(msg.getToRecipients()); - setValidityPeriodHours(msg.getValidityPeriodHours()); - - setAttachments(msg.getAttachments()); - setBccRecipients(msg.getBccRecipients()); - setCcRecipients(msg.getCcRecipients()); - setSubject(msg.getSubjectRef()); - - return *this; -} -}} -} diff --git a/src/modules/API/Messaging/IMms.h b/src/modules/API/Messaging/IMms.h deleted file mode 100644 index 47847ea..0000000 --- a/src/modules/API/Messaging/IMms.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IMMS_H -#define IMMS_H - -#include -#include -#include "VirtualMessage.h" -#include "IMessage.h" -#include "Subject.h" -#include "ToRecipient.h" -#include "CcRecipient.h" -#include "BccRecipient.h" -#include "Attachments.h" -#include "IMmsSlides.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IMms; -typedef DPL::SharedPtr IMmsPtr; - -class IMms : - virtual public IMessage, - virtual public IMmsSlides, - public CcRecipient, - public BccRecipient, - public Attachments -{ - public: // fields - - enum MMSType - { - MULTIPART_MIXED = 0, - MULTIPART_RELATED = 1 - }; - - public: // methods - - explicit IMms(const std::string& id = ""); - - virtual ~IMms(); - - /** - * geter for mms type - * */ - virtual MMSType getMmsType() const; - - /** - * seter for mms type - * */ - virtual void setMmsType(MMSType type); - - IMms & operator <<(const VirtualMessage& msg); - - private: - MMSType m_mmsType; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IMmsSlide.h b/src/modules/API/Messaging/IMmsSlide.h deleted file mode 100644 index afc6693..0000000 --- a/src/modules/API/Messaging/IMmsSlide.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMmsSlide.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IMMSSLIDE_H -#define IMMSSLIDE_H - -#include - -#include "IMmsSlideProperties.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IMmsSlide; -typedef DPL::SharedPtr IMmsSlidePtr; - -class IMmsSlide : - public IMmsSlidePropertyImage, - public IMmsSlidePropertyAudio, - public IMmsSlidePropertyText, - public IMmsSlidePropertyVideo -{ - public: - typedef unsigned long Ulong; - - public: // methods - - virtual ~IMmsSlide() - { - } - - /** - * Get duration - */ - virtual Ulong getDuration() const = 0; - - /** - * Set duration - * @param[in] - value in miliseconds - */ - virtual void setDuration(Ulong duration) = 0; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IMmsSlideProperties.h b/src/modules/API/Messaging/IMmsSlideProperties.h deleted file mode 100644 index c3396c1..0000000 --- a/src/modules/API/Messaging/IMmsSlideProperties.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file IMmsSlideProperties.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef IMMS_SLIDE_PROPERTIES_H -#define IMMS_SLIDE_PROPERTIES_H - -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IMmsSlidePropertyImage -{ - public: - typedef unsigned long Ulong; - - public: - - virtual ~IMmsSlidePropertyImage() - { - } - - /** - * get image filename - * */ - virtual const std::string& getImageFilename() const = 0; - - /** - * get image filename - * @param[in] picture filename - * @throw MMS_MESSAGE_SIZE_EXCEEDED_ERROR - * @throw MMS_VIDEO_SLIDE_ERROR - * */ - virtual void setImageFilename(const std::string& filename) = 0; - - /** - * get imageBegin - * begining of image presentation within a slide in milisecond - * */ - virtual Ulong getImageBegin() const = 0; - - /** - * set imageBegin; - * begining of image presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setImageBegin(Ulong value) = 0; - - /** - * get imageEnd - * end of image presentation within a slide in milisecond - * */ - virtual Ulong getImageEnd() const = 0; - - /** - * set imageBegin; - * end of image presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setImageEnd(Ulong value) = 0; -}; - -//-------------------------------------------------------------------------- - -class IMmsSlidePropertyAudio -{ - public: - typedef unsigned long Ulong; - - public: - - virtual ~IMmsSlidePropertyAudio() - { - } - - /** - * get audio filename - * */ - virtual const std::string& getAudioFilename() const = 0; - - /** - * get audio filename - * @param[in] audio filename - * @throw MMS_MESSAGE_SIZE_EXCEEDED_ERROR - * @throw MMS_VIDEO_SLIDE_ERROR - * */ - virtual void setAudioFilename(const std::string& filename) = 0; - - /** - * get audio begin - * begining of image presentation within a slide in milisecond - * */ - virtual Ulong getAudioBegin() const = 0; - - /** - * set audio begin; - * begining of audio presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setAudioBegin(Ulong value) = 0; - - /** - * get audioEnd - * end of audio presentation within a slide in milisecond - * */ - virtual Ulong getAudioEnd() const = 0; - - /** - * set audioEnd; - * end of audio presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setAudioEnd(Ulong value) = 0; -}; - -//-------------------------------------------------------------------------- - -class IMmsSlidePropertyText -{ - public: - typedef unsigned long Ulong; - - public: - - virtual ~IMmsSlidePropertyText() - { - } - - /** - * get text filename - * */ - virtual const std::string& getTextFilename() const = 0; - - /** - * get text filename - * @param[in] text filename - * @throw MMS_MESSAGE_SIZE_EXCEEDED_ERROR - * @throw MMS_VIDEO_SLIDE_ERROR - * */ - virtual void setTextFilename(const std::string& filename) = 0; - - /** - * get text begin - * begining of text presentation within a slide in milisecond - * */ - virtual Ulong getTextBegin() const = 0; - - /** - * set text begin; - * begining of text presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setTextBegin(Ulong value) = 0; - - /** - * get textEnd - * end of text presentation within a slide in milisecond - * */ - virtual Ulong getTextEnd() const = 0; - - /** - * set textEnd; - * end of text presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setTextEnd(Ulong value) = 0; -}; - -//-------------------------------------------------------------------------- - -class IMmsSlidePropertyVideo -{ - public: - typedef unsigned long Ulong; - - public: - - virtual ~IMmsSlidePropertyVideo() - { - } - - /** - * get video filename - * */ - virtual const std::string& getVideoFilename() const = 0; - - /** - * get video filename - * @param[in] vdeo filename - * @throw MMS_MESSAGE_SIZE_EXCEEDED_ERROR - * @throw MMS_VIDEO_SLIDE_ERROR - * */ - virtual void setVideoFilename(const std::string& filename) = 0; - - /** - * get video begin - * begining of video presentation within a slide in milisecond - * */ - virtual Ulong getVideoBegin() const = 0; - - /** - * set video begin; - * begining of video presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setVideoBegin(Ulong value) = 0; - - /** - * get videoEnd - * end of video presentation within a slide in milisecond - * */ - virtual Ulong getVideoEnd() const = 0; - - /** - * set videoEnd; - * end of video presentation within a slide in milisecond - * @param[in] - value in miliseconds - * */ - virtual void setVideoEnd(Ulong value) = 0; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/IMmsSlides.h b/src/modules/API/Messaging/IMmsSlides.h deleted file mode 100644 index f6b1132..0000000 --- a/src/modules/API/Messaging/IMmsSlides.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file IMmsSlides.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef IMMS_SLIDES_H -#define IMMS_SLIDES_H - -#include - -#include "IMmsSlide.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class IMmsSlides -{ - public: - - virtual ~IMmsSlides() - { - } - - /** - * create empty slide - * @return shared pointer to created IMmsSlide - * */ - virtual IMmsSlidePtr createEmptySlide() const = 0; - - /** - * check data validity - * @return true if slides are valid - * or false if one or more slide need update - * */ - virtual bool checkSlidesValidity() const = 0; - - /** - * set data validity - * */ - virtual void setSlidesValidity(bool state) = 0; - - /** - * set slides - * */ - virtual void setSlides(const std::vector& slides) = 0; - - /** - * add slide to mms object - * */ - virtual void addSlide(const IMmsSlidePtr& slide) = 0; - - /** - * get slide count - * @return number of slides in mms - * */ - virtual size_t getSlideCount() const = 0; - - /** - * get slide by number - * @return shared pointer to IMmsSlide - * @throw INVALID_ARGUMENT_EXCEPTION - * if argument is wrong - * */ - virtual IMmsSlidePtr getSlide(size_t nb) const = 0; - - /** - * get slides - * @return vector of slides from Mms - * */ - virtual std::vector getSlides() const = 0; - - /** - * replace slide - * @throw INVALID_ARGUMENT_EXCEPTION - * if argument is wrong - * */ - virtual void replaceSlide(size_t pos, - const IMmsSlidePtr& slide) = 0; - - /** - * remove slide - * @throw INVALID_ARGUMENT_EXCEPTION - * if argument is wrong - * */ - virtual void removeSlide(size_t pos) = 0; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/ISms.cpp b/src/modules/API/Messaging/ISms.cpp deleted file mode 100644 index dba4ecb..0000000 --- a/src/modules/API/Messaging/ISms.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ISms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "ISms.h" -#include - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -ISms::ISms(const string& id) : - IMessage(SMS, id) -{ - LogInfo("enter"); -} - -ISms::~ISms() -{ - LogInfo("enter"); -} - -ISms & ISms::operator <<(const VirtualMessage& msg) -{ - setBody(msg.getBodyRef()); - setFolderType(msg.getCurrentFolder()); - setCurrentUserFolder(msg.getCurrentUserFolder()); - setFrom(msg.getFromRef()); - setDateTime(msg.getDateTime()); - setSourceAddress(msg.getSourceAddress()); - setToRecipients(msg.getToRecipients()); - setCallbackNumber(getCallbackNumberRef()); - setValidityPeriodHours(msg.getValidityPeriodHours()); - - return *this; -} -}} -} diff --git a/src/modules/API/Messaging/ISms.h b/src/modules/API/Messaging/ISms.h deleted file mode 100644 index d532395..0000000 --- a/src/modules/API/Messaging/ISms.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ISms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef ISMS_H -#define ISMS_H - -#include "IMessage.h" -#include "CallbackNumber.h" -#include "VirtualMessage.h" -#include "ValidityPeriodHours.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class ISms; -typedef DPL::SharedPtr ISmsPtr; - -class ISms : - virtual public IMessage -{ - public: // fields - - public: // methods - - explicit ISms(const std::string& id = ""); - - virtual ~ISms(); - - ISms & operator <<(const VirtualMessage& msg); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/MessageEventPrivateData.h b/src/modules/API/Messaging/MessageEventPrivateData.h deleted file mode 100644 index 9c9575a..0000000 --- a/src/modules/API/Messaging/MessageEventPrivateData.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessageEventPrivateData.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef MESSAGEEVENTPRIVATEDATA_H_ -#define MESSAGEEVENTPRIVATEDATA_H_ - -#include -#include -#include "IMessage.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -/* - * I cannot put IMessagePtr directly in EventOnSendingFailed because the IMessage contains an emitter based on this event - * and I get recurring include dependency and I don't want to mix standard pointers with shared pointers. - */ -class MessageEventPrivateData : public Platform::IEventPrivateData -{ - public: - explicit MessageEventPrivateData(const IMessagePtr& message) : m_message( - message) - { - } - - IMessagePtr GetMessage() const - { - return m_message; - } - - private: - IMessagePtr m_message; -}; - -typedef DPL::SharedPtr MessageEventPrivateDataPtr; -} // Api -} // WrtDeviceApis -} -#endif /* MESSAGEEVENTPRIVATEDATA_H_ */ diff --git a/src/modules/API/Messaging/MessageFactory.cpp b/src/modules/API/Messaging/MessageFactory.cpp deleted file mode 100644 index 8943d12..0000000 --- a/src/modules/API/Messaging/MessageFactory.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessageFactory.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include -#include -#include -#include "MessageFactory.h" - -using namespace WrtDeviceApis::Commons; - - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -IMessagePtr MessageFactory::createMessage(const MessageType msgType, - const std::string& id) -{ - LogInfo("enter"); - IMessage* retVal = NULL; - switch (msgType) { - case SMS: - LogDebug("creation sms message"); - retVal = new Sms(id); - break; - - case BINARYSMS: - LogDebug("creation binary sms message"); - retVal = new BinarySms(id); - break; - - case MMS: - LogDebug("creation mms message"); - retVal = new Mms(id); - break; - - case EMAIL: - LogDebug("creation email message"); - retVal = new Email(id); - break; - - default: - LogError("creation error, unknown message type"); - break; - } - return IMessagePtr(retVal); -} - -IMessagePtr MessageFactory::createMessage(const MessageType msgType, - const int id) -{ - std::ostringstream stream; - stream << id; - std::string idStr = stream.str(); - return createMessage(msgType, idStr); -} - -IMessagePtr MessageFactory::createVirtualMessage() -{ - return IMessagePtr(new VirtualMessage()); -} - -VirtualMessagePtr MessageFactory::convertToVirtualMessage(IMessagePtr msg) -{ - VirtualMessagePtr tmp = DPL::DynamicPointerCast(msg); - if (!tmp) { - ThrowMsg(ConversionException, - "Conversion IMessage to VirtualMessagePtr error"); - } - return tmp; -} - -ISmsPtr MessageFactory::convertToSms(IMessagePtr msg) -{ - ISmsPtr tmp = DPL::DynamicPointerCast(msg); - if (!tmp) { - ThrowMsg(ConversionException, "Conversion IMessage to ISms error"); - } - return tmp; -} - -IBinarySmsPtr MessageFactory::convertToBinarySms(IMessagePtr msg) -{ - IBinarySmsPtr tmp = DPL::DynamicPointerCast(msg); - if (!tmp) { - ThrowMsg(ConversionException, "Conversion IMessage to IBinarySms error"); - } - return tmp; -} - -IMmsPtr MessageFactory::convertToMms(IMessagePtr msg) -{ - IMmsPtr tmp = DPL::DynamicPointerCast(msg); - if (!tmp) { - ThrowMsg(ConversionException, "Conversion IMessage to IMms error"); - } - return tmp; -} - -IEmailPtr MessageFactory::convertToEmail(IMessagePtr msg) -{ - IEmailPtr tmp = DPL::DynamicPointerCast(msg); - if (!tmp) { - ThrowMsg(ConversionException, "Conversion IMessage to IEmail error"); - } - return tmp; -} -} -} -} diff --git a/src/modules/API/Messaging/MessageFactory.h b/src/modules/API/Messaging/MessageFactory.h deleted file mode 100644 index a389f4b..0000000 --- a/src/modules/API/Messaging/MessageFactory.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessageFactory.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MESSAGEFACTORY_H -#define MESSAGEFACTORY_H - -#include -#include "IMessaging.h" -#include "IMessage.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class MessageFactory -{ - public: - - /** - * Generate message specyfied type - * @param[in] msgType type of message to create - * @param[in] id if id is set, then is trying to read existing message - * from storage by specyfid if - */ - static IMessagePtr createMessage(const MessageType msgType, - const std::string& id = ""); - - /** - * Generate message specyfied type - * @param[in] msgType type of message to create - * @param[in] int id - * from storage by specyfid if - */ - static IMessagePtr createMessage(const MessageType msgType, - const int id); - - /** - * Generate virtual message specyfied type, without platform projection - * @param[in] msgType type of message to create - */ - static IMessagePtr createVirtualMessage(); - - /** - * Convert abstract message (IMessage) to virtual message - * @param[in] msg - pointer to message to convert - * @throw ConversionException if conversion fail - */ - static VirtualMessagePtr convertToVirtualMessage(IMessagePtr msg); - - /** - * Convert abstract message (IMessage) to abstract sms (ISms) - * @param[in] msg - pointer to message to convert - * @throw ConversionException if conversion fail - */ - static ISmsPtr convertToSms(IMessagePtr msg); - - /** - * Convert abstract message (IMessage) to abstract binary sms (IBinarySms) - * @param[in] msg - pointer to message to convert - * @throw ConversionException if conversion fail - */ - static IBinarySmsPtr convertToBinarySms(IMessagePtr msg); - - /** - * Convert abstract message (IMessage) to abstract Mms (IMms) - * @param[in] msg - pointer to message to convert - * @throw ConversionException if conversion fail - */ - static IMmsPtr convertToMms(IMessagePtr msg); - - /** - * Convert abstract message (IMessage) to abstract email (IEmail) - * @param[in] msg - pointer to message to convert - * @throw ConversionException if conversion fail - */ - static IEmailPtr convertToEmail(IMessagePtr msg); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/MessageFilter.cpp b/src/modules/API/Messaging/MessageFilter.cpp deleted file mode 100644 index f2dd4de..0000000 --- a/src/modules/API/Messaging/MessageFilter.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessageFilter.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "MessageFilter.h" -#include -#include -#include - -namespace { -const time_t MKTIME_ERROR = static_cast(-1); -const int YEAR_OFFSET = 1900; -} - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MessageFilter::MessageFilter() : - m_msgIdCheck(false), - m_startTimeCheck(false), - m_endTimeCheck(false), - m_toCheck(false), - m_ccCheck(false), - m_bccCheck(false), - m_subjectCheck(false), - m_bodyCheck(false), - m_isReadCheck(false), - m_fromCheck(false), - m_messagePriorityCheck(false) -{ - LogDebug("message filter creation"); -} - -MessageFilter::~MessageFilter() -{ -} - -void MessageFilter::setMsgId(const std::string& value) -{ - m_msgId = value; - m_msgIdCheck = true; -} - -void MessageFilter::setTo(const Recipients& value) -{ - m_to = value; - m_toCheck = true; -} - -void MessageFilter::setCc(const Recipients& value) -{ - m_cc = value; - m_ccCheck = true; -} - -void MessageFilter::setBcc(const Recipients& value) -{ - m_bcc = value; - m_bccCheck = true; -} - -void MessageFilter::setSubject(const std::string& value) -{ - m_subject = value; - m_subjectCheck = true; -} - -void MessageFilter::setBody(const std::string& value) -{ - m_body = value; - m_bodyCheck = true; -} - -void MessageFilter::setFrom(const string& value) -{ - m_from = value; - m_fromCheck = true; -} - -void MessageFilter::setStartTime(const time_t& value) -{ - m_startTime = value; - m_startTimeCheck = true; -} - -void MessageFilter::setEndTime(const time_t& value) -{ - m_endTime = value; - m_endTimeCheck = true; -} - -void MessageFilter::setIsRead(bool value) -{ - m_isRead = value; - m_isReadCheck = true; -} - -void MessageFilter::setMessagePriority(const MessagePriority::Priority& value) -{ - m_messagePriority = value; - m_messagePriorityCheck = true; -} - -pcrecpp::RE MessageFilter::reCreate(const std::string& value) const -{ - // conversion example: - // ^$ <- (empty string) - // ^a$ <- a - // ^a.* <- a% - // .*a$ <- %a - // .*a.* <- %a% - // ^\..*a.* <- .%a% - - string tmpRe; - if (!value.empty()) { - tmpRe = Commons::preparePercent(value); - } - return pcrecpp::RE(tmpRe); -} - -bool MessageFilter::idCheck(const std::string& value) const -{ - if (m_msgIdCheck) { - pcrecpp::RE l_re = reCreate(m_msgId); - if (!l_re.FullMatch(value)) { - return false; - } - } - return true; -} - -bool MessageFilter::timeCheck(tm value) const -{ - if (value.tm_year > YEAR_OFFSET) { - value.tm_year -= YEAR_OFFSET; - } - time_t time = mktime(&value); - if (MKTIME_ERROR == time) { - return false; - } - - return (!m_startTimeCheck || - time >= m_startTime) && (!m_endTimeCheck || time <= m_endTime); -} - -bool MessageFilter::bodyCheck(const std::string& value) const -{ - if (m_bodyCheck) { - pcrecpp::RE l_re = reCreate(m_body); - if (!l_re.FullMatch(value)) { - return false; - } - } - return true; -} - -bool MessageFilter::toCheck(const Recipients& value) const -{ - if (m_toCheck) { - return recipientCheck(m_to, value); - } - return true; -} - -bool MessageFilter::ccCheck(const Recipients& value) const -{ - if (m_ccCheck) { - return recipientCheck(m_cc, value); - } - return true; -} - -bool MessageFilter::bccCheck(const Recipients& value) const -{ - if (m_bccCheck) { - return recipientCheck(m_bcc, value); - } - return true; -} - -bool MessageFilter::recipientCheck(const Recipients& filter, - const Recipients& value) const -{ - size_t vsize = value.getRecipientSize(); - - // every filter element must have at least one match - for (size_t i = 0; i < filter.getRecipientSize(); i++) { - pcrecpp::RE l_re = reCreate(filter.getRecipient(i)); - - bool match = false; - - // go through all message recipients to find matching one - for (size_t v = 0; v < vsize; ++v) { - if (l_re.PartialMatch(value.getRecipient(v))) { - match = true; - break; - } - } - - if (!match) { - // none of supplied message recipients was matching this filter element - return false; - } - } - return true; -} - -bool MessageFilter::fromCheck(const std::string& value) const -{ - if (m_fromCheck) { - pcrecpp::RE l_re = reCreate(m_from); - if (!l_re.FullMatch(value)) { - return false; - } - } - return true; -} - -bool MessageFilter::subjectCheck(const std::string & value) const -{ - if (m_subjectCheck) { - pcrecpp::RE l_re = reCreate(m_subject); - if (!l_re.FullMatch(value)) { - return false; - } - } - return true; -} - -bool MessageFilter::isReadCheck(bool value) const -{ - if (m_isReadCheck) { - return (m_isRead == value); - } - return true; -} - -bool MessageFilter::priorityCheck(MessagePriority::Priority value) const -{ - if (m_messagePriorityCheck) { - return (m_messagePriority == value); - } - return true; -} - -bool MessageFilter::isValid() const -{ - if (m_msgIdCheck || m_startTimeCheck || m_endTimeCheck || m_toCheck || - m_ccCheck || m_bccCheck || m_subjectCheck || m_bodyCheck || m_isRead || - m_isReadCheck || m_fromCheck || m_messagePriorityCheck) { - return true; - } - - return false; -} - -bool MessageFilter::compare(const ISmsPtr & msg) const -{ - if (m_ccCheck || - m_bccCheck || - m_subjectCheck || - m_messagePriorityCheck) { - // sms do not support this properties, so find has no effect - return false; - } - - return ( - idCheck(msg->getId()) && - bodyCheck(msg->getBody()) && - toCheck(msg->getToRecipients()) && - isReadCheck(msg->isRead()) && - timeCheck(msg->getDateTime()) && - fromCheck(msg->getFrom()) - ); -} - -bool MessageFilter::compare(const IMmsPtr & msg) const -{ - if (m_ccCheck || - m_bccCheck || - m_messagePriorityCheck) { - // mms do not support this properties, so find has no effect - return false; - } - - return ( - idCheck(msg->getId()) && - subjectCheck(msg->getSubject()) && - bodyCheck(msg->getBody()) && - toCheck(msg->getToRecipients()) && - isReadCheck(msg->isRead()) && - timeCheck(msg->getDateTime()) && - fromCheck(msg->getFrom()) - ); -} - -bool MessageFilter::compare(const IEmailPtr & msg) const -{ - return ( - idCheck(msg->getId()) && - subjectCheck(msg->getSubject()) && - bodyCheck(msg->getBody()) && - fromCheck(msg->getFrom()) && - toCheck(msg->getToRecipients()) && - ccCheck(msg->getCcRecipients()) && - bccCheck(msg->getBccRecipients()) && - isReadCheck(msg->isRead()) && - priorityCheck(msg->getPriority()) && - timeCheck(msg->getDateTime()) - ); -} -}} -} diff --git a/src/modules/API/Messaging/MessageFilter.h b/src/modules/API/Messaging/MessageFilter.h deleted file mode 100644 index 3093081..0000000 --- a/src/modules/API/Messaging/MessageFilter.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessageFilter.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MESSAGEFILTER_H -#define MESSAGEFILTER_H - -#include -#include -#include - -#include "MessagePriority.h" -#include "Recipient.h" -#include "ISms.h" -#include "IMms.h" -#include "IEmail.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class MessageFilter; - -typedef DPL::SharedPtr MessageFilterPtr; - -class MessageFilter -{ - private: // fields - - std::string m_msgId; - bool m_msgIdCheck; - - time_t m_startTime; - bool m_startTimeCheck; - - time_t m_endTime; - bool m_endTimeCheck; - - Recipients m_to; - bool m_toCheck; - - Recipients m_cc; - bool m_ccCheck; - - Recipients m_bcc; - bool m_bccCheck; - - std::string m_subject; - bool m_subjectCheck; - - std::string m_body; - bool m_bodyCheck; - - bool m_isRead; - bool m_isReadCheck; - - std::string m_from; - bool m_fromCheck; - - MessagePriority::Priority m_messagePriority; - bool m_messagePriorityCheck; - - public: // methods - - /** - * constructor of messageFilter - */ - MessageFilter(); - - virtual ~MessageFilter(); - - void setMsgId(const std::string& value); - - void setTo(const Recipients& value); // the same as destination address - - void setCc(const Recipients& value); - - void setBcc(const Recipients& value); - - void setSubject(const std::string& value); - - void setBody(const std::string& value); - - void setFrom(const std::string& value); //email account from email was sent - - void setStartTime(const time_t& value); - - void setEndTime(const time_t& value); - - void setIsRead(bool value); - - void setMessagePriority(const MessagePriority::Priority& value); - - bool isValid() const; - - bool compare(const ISmsPtr& msg) const; - - bool compare(const IMmsPtr& msg) const; - - bool compare(const IEmailPtr& msg) const; - - private: - pcrecpp::RE reCreate(const std::string& value) const; - - bool idCheck(const std::string& value) const; - - bool timeCheck(tm value) const; - - bool bodyCheck(const std::string& value) const; - - bool toCheck(const Recipients& value) const; - - bool ccCheck(const Recipients& value) const; - - bool bccCheck(const Recipients& value) const; - - bool recipientCheck(const Recipients& filter, - const Recipients& value) const; - - bool fromCheck(const std::string& value) const; - - bool subjectCheck(const std::string& value) const; - - bool isReadCheck(bool value) const; - - bool priorityCheck(MessagePriority::Priority value) const; -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/MessagePriority.cpp b/src/modules/API/Messaging/MessagePriority.cpp deleted file mode 100644 index 7c990cd..0000000 --- a/src/modules/API/Messaging/MessagePriority.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MessagePriority.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "MessagePriority.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MessagePriority::MessagePriority() : - m_priority(NORMAL), - m_validPriority(false) -{ -} - -void MessagePriority::setPriority(MessagePriority::Priority value) -{ - m_priority = value; - m_validPriority = false; -} - -MessagePriority::Priority MessagePriority::getPriority() const -{ - return m_priority; -} - -bool MessagePriority::isPriorityValid() const -{ - return m_validPriority; -} - -void MessagePriority::setPriorityValid(bool state) -{ - m_validPriority = state; -} -}} -} diff --git a/src/modules/API/Messaging/MessagePriority.h b/src/modules/API/Messaging/MessagePriority.h deleted file mode 100644 index 16e4632..0000000 --- a/src/modules/API/Messaging/MessagePriority.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file MessagePriority.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MESSAGEPRIORITY_H -#define MESSAGEPRIORITY_H - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class MessagePriority -{ - public: - enum Priority - { - LOW, - NORMAL, - HIGH - }; - - public: - MessagePriority(); - - /** - * setter of MessagePriority value - */ - void setPriority(Priority value); - - /** - * getter of MessagePriority value - */ - Priority getPriority() const; - - /** - * check MessagePriority validity - * */ - bool isPriorityValid() const; - - /** - * set MessagePriority validity - * */ - void setPriorityValid(bool state); - - private: - /** - * MessagePriority value - */ - Priority m_priority; - - /** - * information if abstract message MessagePriority has been changed and need update - * in low level - */ - bool m_validPriority; -}; -} -} -} -#endif // MESSAGEPRIORITY_H diff --git a/src/modules/API/Messaging/MmsSlide.cpp b/src/modules/API/Messaging/MmsSlide.cpp deleted file mode 100644 index c44fc8a..0000000 --- a/src/modules/API/Messaging/MmsSlide.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file MmsSlide.cpp - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "MmsSlide.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MmsSlide::MmsSlide() : m_duration(0) -{ -} - -MmsSlide::~MmsSlide() -{ -} - -unsigned long MmsSlide::getDuration() const -{ - return m_duration; -} - -void MmsSlide::setDuration(Ulong duration) -{ - m_duration = duration; -} - -const std::string& MmsSlide::getImageFilename() const -{ - return m_image.getFilename(); -} - -void MmsSlide::setImageFilename(const std::string& filename) -{ - m_image.setFilename(filename); -} - -unsigned long MmsSlide::getImageBegin() const -{ - return m_image.getStartTime(); -} - -void MmsSlide::setImageBegin(Ulong value) -{ - m_image.setStartTime(value); -} - -unsigned long MmsSlide::getImageEnd() const -{ - return m_image.getEndTime(); -} - -void MmsSlide::setImageEnd(Ulong value) -{ - m_image.setEndTime(value); -} - -const std::string& MmsSlide::getAudioFilename() const -{ - return m_audio.getFilename(); -} - -void MmsSlide::setAudioFilename(const std::string& filename) -{ - m_audio.setFilename(filename); -} - -unsigned long MmsSlide::getAudioBegin() const -{ - return m_audio.getStartTime(); -} - -void MmsSlide::setAudioBegin(Ulong value) -{ - m_audio.setStartTime(value); -} - -unsigned long MmsSlide::getAudioEnd() const -{ - return m_audio.getEndTime(); -} - -void MmsSlide::setAudioEnd(Ulong value) -{ - m_audio.setEndTime(value); -} - -const std::string& MmsSlide::getTextFilename() const -{ - return m_text.getFilename(); -} - -void MmsSlide::setTextFilename(const std::string& filename) -{ - m_text.setFilename(filename); -} - -unsigned long MmsSlide::getTextBegin() const -{ - return m_text.getStartTime(); -} - -void MmsSlide::setTextBegin(Ulong value) -{ - m_text.setStartTime(value); -} - -unsigned long MmsSlide::getTextEnd() const -{ - return m_text.getEndTime(); -} - -void MmsSlide::setTextEnd(Ulong value) -{ - m_text.setEndTime(value); -} - -const std::string& MmsSlide::getVideoFilename() const -{ - return m_video.getFilename(); -} - -void MmsSlide::setVideoFilename(const std::string& filename) -{ - m_video.setFilename(filename); -} - -unsigned long MmsSlide::getVideoBegin() const -{ - return m_video.getStartTime(); -} - -void MmsSlide::setVideoBegin(Ulong value) -{ - m_video.setStartTime(value); -} - -unsigned long MmsSlide::getVideoEnd() const -{ - return m_video.getEndTime(); -} - -void MmsSlide::setVideoEnd(Ulong value) -{ - m_video.setEndTime(value); -} -}} -} diff --git a/src/modules/API/Messaging/MmsSlide.h b/src/modules/API/Messaging/MmsSlide.h deleted file mode 100644 index fef2bfc..0000000 --- a/src/modules/API/Messaging/MmsSlide.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file MmsSlide.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef MMS_SLIDE_H -#define MMS_SLIDE_H - -#include "IMmsSlide.h" -#include "MmsSlideProperty.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class MmsSlide : public virtual IMmsSlide -{ - public: - MmsSlide(); - - virtual ~MmsSlide(); - - //duration - virtual Ulong getDuration() const; - virtual void setDuration(Ulong duration); - - //image - virtual const std::string& getImageFilename() const; - virtual void setImageFilename(const std::string& filename); - virtual Ulong getImageBegin() const; - virtual void setImageBegin(Ulong value); - virtual Ulong getImageEnd() const; - virtual void setImageEnd(Ulong value); - - //audio - virtual const std::string& getAudioFilename() const; - virtual void setAudioFilename(const std::string& filename); - virtual Ulong getAudioBegin() const; - virtual void setAudioBegin(Ulong value); - virtual Ulong getAudioEnd() const; - virtual void setAudioEnd(Ulong value); - - //text - virtual const std::string& getTextFilename() const; - virtual void setTextFilename(const std::string& filename); - virtual Ulong getTextBegin() const; - virtual void setTextBegin(Ulong value); - virtual Ulong getTextEnd() const; - virtual void setTextEnd(Ulong value); - - //video - virtual const std::string& getVideoFilename() const; - virtual void setVideoFilename(const std::string& filename); - virtual Ulong getVideoBegin() const; - virtual void setVideoBegin(Ulong value); - virtual Ulong getVideoEnd() const; - virtual void setVideoEnd(Ulong value); - - private: - Ulong m_duration; - - MmsSlideProperty m_image; - MmsSlideProperty m_audio; - MmsSlideProperty m_text; - MmsSlideProperty m_video; -}; -} -}} -#endif diff --git a/src/modules/API/Messaging/MmsSlideProperty.cpp b/src/modules/API/Messaging/MmsSlideProperty.cpp deleted file mode 100644 index 4f89fba..0000000 --- a/src/modules/API/Messaging/MmsSlideProperty.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file MmsSlideProperty.cpp - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "MmsSlideProperty.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MmsSlideProperty::MmsSlideProperty() : - m_filename(""), - m_startTime(0), - m_endTime(0) -{ -} - -MmsSlideProperty::~MmsSlideProperty() -{ -} - -const std::string& MmsSlideProperty::getFilename() const -{ - return m_filename; -} - -unsigned long MmsSlideProperty::getStartTime() const -{ - return m_startTime; -} - -unsigned long MmsSlideProperty::getEndTime() const -{ - return m_endTime; -} - -void MmsSlideProperty::setFilename(const std::string& value) -{ - m_filename = value; -} - -void MmsSlideProperty::setStartTime(Ulong value) -{ - m_startTime = value; -} - -void MmsSlideProperty::setEndTime(Ulong value) -{ - m_endTime = value; -} -}} -} diff --git a/src/modules/API/Messaging/MmsSlideProperty.h b/src/modules/API/Messaging/MmsSlideProperty.h deleted file mode 100644 index e4990f8..0000000 --- a/src/modules/API/Messaging/MmsSlideProperty.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file MmsSlideProperty.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef MMS_SLIDE_PROPERTY_H -#define MMS_SLIDE_PROPERTY_H - -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class MmsSlideProperty -{ - private: - typedef unsigned long Ulong; - - private: - - std::string m_filename; - - Ulong m_startTime; - - Ulong m_endTime; - - public: - - MmsSlideProperty(); - - virtual ~MmsSlideProperty(); - - /** - * getters for filename - * */ - virtual const std::string& getFilename() const; - - /** - * getters for startTime - * */ - virtual Ulong getStartTime() const; - - /** - * getters for endTime - * */ - virtual Ulong getEndTime() const; - - /** - * setters for filename - * */ - virtual void setFilename(const std::string& value); - - /** - * setters for start time - * */ - virtual void setStartTime(Ulong value); - - /** - * setters for end time - * */ - virtual void setEndTime(Ulong value); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/MmsSlides.cpp b/src/modules/API/Messaging/MmsSlides.cpp deleted file mode 100644 index 0f85ef6..0000000 --- a/src/modules/API/Messaging/MmsSlides.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MmsSlides.cpp - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "MmsSlides.h" -#include "MmsSlide.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -MmsSlides::MmsSlides() : m_valid(false) -{ -} - -MmsSlides::~MmsSlides() -{ -} - -bool MmsSlides::checkSlidesValidity() const -{ - return m_valid; -} - -void MmsSlides::setSlidesValidity(bool state) -{ - m_valid = state; -} - -void MmsSlides::setSlides(const std::vector& slides) -{ - m_slides = slides; -} - -IMmsSlidePtr MmsSlides::createEmptySlide() const -{ - IMmsSlide* slide = NULL; - slide = new MmsSlide; - - return IMmsSlidePtr(slide); -} - -void MmsSlides::addSlide(const IMmsSlidePtr& slide) -{ - m_slides.push_back(slide); -} - -size_t MmsSlides::getSlideCount() const -{ - return m_slides.size(); -} - -IMmsSlidePtr MmsSlides::getSlide(size_t nb) const -{ - if (nb >= m_slides.size()) { - //TODO -exception? - } - return m_slides[nb]; -} - -std::vector MmsSlides::getSlides() const -{ - return m_slides; -} - -void MmsSlides::replaceSlide(size_t pos, - const IMmsSlidePtr& slide) -{ - if (pos >= m_slides.size()) { - //TODO - } else { - //m_slides.erase(m_slides.begin()+pos); - m_slides[pos] = slide; - } -} - -void MmsSlides::removeSlide(size_t /*pos*/) -{ -} - -} -} -} diff --git a/src/modules/API/Messaging/MmsSlides.h b/src/modules/API/Messaging/MmsSlides.h deleted file mode 100644 index 6bcf6a7..0000000 --- a/src/modules/API/Messaging/MmsSlides.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MmsSlides.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef MMS_SLIDES_H -#define MMS_SLIDES_H - -#include "IMmsSlides.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class MmsSlides : - virtual public IMmsSlides -{ - public: - - MmsSlides(); - - virtual ~MmsSlides(); - - virtual IMmsSlidePtr createEmptySlide() const; - - virtual bool checkSlidesValidity() const; - - virtual void setSlidesValidity(bool state); - - virtual void setSlides(const std::vector& slides); - - virtual void addSlide(const IMmsSlidePtr& slide); - - virtual size_t getSlideCount() const; - - virtual IMmsSlidePtr getSlide(size_t nb) const; - - virtual std::vector getSlides() const; - - virtual void replaceSlide(size_t pos, - const IMmsSlidePtr& slide); - - virtual void removeSlide(size_t pos); - - private: - - bool m_valid; - - std::vector m_slides; -}; -} -}} -#endif diff --git a/src/modules/API/Messaging/Recipient.cpp b/src/modules/API/Messaging/Recipient.cpp deleted file mode 100644 index 0160f7d..0000000 --- a/src/modules/API/Messaging/Recipient.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Recipient.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include -#include "Recipient.h" - -using namespace std; -using namespace WrtDeviceApis::Commons; - - -namespace { -const static string emptyString; -} - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -Recipients::Recipients() : - m_validRecipients(false) -{ -} - -Recipients::Recipients(const vector& value) : - m_validRecipients(false) -{ - m_recipients = value; -} - -Recipients::~Recipients() -{ -} - -bool Recipients::isValid() const -{ - return m_validRecipients; -} - -void Recipients::setValid(bool state) -{ - m_validRecipients = state; -} - -void Recipients::setRecipients(const vector& value) -{ - m_recipients = value; - m_validRecipients = false; -} - -void Recipients::setRecipients(const std::string& value) -{ - vector tmp = split(value, ';'); - setRecipients(tmp); -} - -void Recipients::setRecipient(const size_t index, - const string& value) -{ - if (index >= m_recipients.size()) { - Throw(OutOfRangeException); - return; - } - m_recipients[index] = value; - m_validRecipients = false; -} - -void Recipients::setRecipientWithExpand(const size_t index, - const std::string& value) -{ - if (index >= m_recipients.size()) { - m_recipients.resize(index + 1, emptyString); - } - m_recipients[index] = value; - m_validRecipients = false; -} - -vector Recipients::getRecipients() const -{ - return m_recipients; -} - -const vector& Recipients::getRecipientsRef() const -{ - return m_recipients; -} - -string Recipients::getRecipient(const size_t index) const -{ - if (index >= m_recipients.size()) { - Throw(OutOfRangeException); - return ""; - } - return m_recipients[index]; -} - -void Recipients::appendRecipient(const string & value) -{ - vector tmp = split(value, ';'); - m_recipients.insert(m_recipients.end(), tmp.begin(), tmp.end()); - m_validRecipients = false; -} - -void Recipients::removeRecipient(const size_t position) -{ - if (position >= m_recipients.size()) { - Throw(Commons::OutOfRangeException); - } else { - m_recipients.erase(m_recipients.begin() + position); - m_validRecipients = false; - } -} - -void Recipients::removeRecipient(const string & value) -{ - m_recipients.erase( - remove(m_recipients.begin(), m_recipients.end(), value), - m_recipients.end()); - m_validRecipients = false; -} - -string Recipients::join(char delimiter) const -{ - string retVal; - for (size_t i = 0; i < m_recipients.size(); i++) { - retVal += m_recipients[i] + delimiter; - } - return retVal; -} - -vector Recipients::split(const string& input, - char delimiter) -{ - vector ret; - stringstream stream(input); - string item; - while (getline(stream, item, delimiter)) { - ret.push_back(item); - } - return ret; -} - -size_t Recipients::getRecipientSize() const -{ - return m_recipients.size(); -} - -bool Recipients::operator !=(const Recipients& arg) const -{ - if (m_recipients == arg.m_recipients) { - return true; - } - return false; -} - -Recipients & Recipients::operator +=(const Recipients& val) -{ - const vector& tmp = val.getRecipientsRef(); - m_recipients.insert(m_recipients.end(), tmp.begin(), tmp.end()); - m_validRecipients = false; - return *this; -} - -Recipients & Recipients::operator -=(const Recipients& val) -{ - //check if recipients are inside list - vector l_recipients = m_recipients; - vector l_toDelete = val.getRecipients(); - sort(l_recipients.begin(), l_recipients.end()); - 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"); - Throw(Commons::InvalidArgumentException); - } - //delete recipients - vector::const_iterator it = l_toDelete.begin(); - const vector::const_iterator endIt = l_toDelete.end(); - while (it != endIt) { - m_recipients.erase( - remove(m_recipients.begin(), - m_recipients.end(), *it), m_recipients.end()); - ++it; - } - m_validRecipients = false; - return *this; -} -}} -} diff --git a/src/modules/API/Messaging/Recipient.h b/src/modules/API/Messaging/Recipient.h deleted file mode 100644 index 61b7983..0000000 --- a/src/modules/API/Messaging/Recipient.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Recipient.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef RECIPIENT_H -#define RECIPIENT_H - -#include "IMessagingTypes.h" -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class Recipients -{ - private: // fields - - /** - * recipient value - */ - std::vector m_recipients; - - bool m_validRecipients; - - public: // methods - - Recipients(); - - explicit Recipients(const std::vector& value); - - virtual ~Recipients(); - - /** - * information if abstract message to recipient has been changed and - * need update in low level - */ - bool isValid() const; - - void setValid(bool state); - - /** - * setter of recipient value - */ - void setRecipients(const std::vector& value); - - void setRecipients(const std::string& value); - - void setRecipient(const size_t index, - const std::string& value); - - void setRecipientWithExpand(const size_t index, - const std::string& value); - - /** - * getter of recipient value - */ - std::vector getRecipients() const; - - const std::vector& getRecipientsRef() const; - - std::string getRecipient(const size_t index) const; - - void appendRecipient(const std::string & value); - - void removeRecipient(const size_t position); - - void removeRecipient(const std::string & value); - - size_t getRecipientSize() const; - - bool operator !=(const Recipients& arg) const; - - Recipients & operator +=(const Recipients& val); - - Recipients & operator -=(const Recipients& val); - - std::string join(char delimiter = ';') const; - - private: - - std::vector split(const std::string& input, - char delimiter); -}; - -typedef DPL::SharedPtr RecipientsPtr; -} -} -} -#endif diff --git a/src/modules/API/Messaging/ReqReceiverMessage.cpp b/src/modules/API/Messaging/ReqReceiverMessage.cpp deleted file mode 100644 index ba3b61e..0000000 --- a/src/modules/API/Messaging/ReqReceiverMessage.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ReqReceiverMessage.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ - -#include "ReqReceiverMessage.h" -#include -#include -#include -#include "IMessaging.h" -#include "IMessage.h" - -using namespace std; -using namespace WrtDeviceApis; -using namespace WrtDeviceApis::Commons; - -IMPLEMENT_SINGLETON(WrtDeviceApis::Messaging::Api::ReqReceiverMessage) - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { - -ReqReceiverMessage::ReqReceiverMessage() : - EventSendMessageReqReceiver(Commons::ThreadEnum::MESSAGING_THREAD), - EventUpdateMessageReqReceiver(Commons::ThreadEnum::MESSAGING_THREAD), - EventDeleteMessageReqReceiver(Commons::ThreadEnum::MESSAGING_THREAD), - EventFindMessageReqReceiver(Commons::ThreadEnum::MESSAGING_THREAD) -{ - LogDebug("create receiver for messaging"); -} - -ReqReceiverMessage::~ReqReceiverMessage() -{ -} - -void ReqReceiverMessage::sendMessage(const EventSendMessagePtr& event) -{ - LogDebug("enter"); - EventSendMessageReqReceiver::PostRequest(event); -} - -void ReqReceiverMessage::updateMessage(const EventUpdateMessagePtr& event) -{ - LogDebug("enter"); - EventUpdateMessageReqReceiver::PostRequest(event); -} - -void ReqReceiverMessage::deleteMessage(const EventDeleteMessagePtr& event) -{ - LogDebug("enter"); - EventDeleteMessageReqReceiver::PostRequest(event); -} - -void ReqReceiverMessage::findMessage(const EventFindMessagePtr& event) -{ - LogDebug("enter"); - EventFindMessageReqReceiver::PostRequest(event); -} - -void ReqReceiverMessage::OnRequestReceived(const EventSendMessagePtr& event) -{ - LogDebug("enter"); - - Try { - IMessagePtr msg = event->getMessage(); - //this prevents calling BONDI, WAC2.0 callback immidiately after leaving this function - //callback will be called after receving Commons callback. - msg->setRequestReceiver(this); - msg->setSendMessageEvent(event); - if (!event->checkCancelled()) { - event->setCancelAllowed(false); - event->switchToManualAnswer(); - msg->send(); - } else { - event->setCancelAllowed(true); - } - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - Commons::EventRequestReceiver< EventSendMessage >::ManualAnswer(event); - } -} - -void ReqReceiverMessage::OnRequestReceived(const EventUpdateMessagePtr& event) -{ - LogDebug("enter"); - - Try { - IMessagePtr msg = event->msg; - if (!event->checkCancelled()) { - event->setCancelAllowed(false); - msg->update(true); - } else { - event->setCancelAllowed(true); - } - } - Catch(Commons::PlatformException) { - LogError("Commons exception"); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - } -} - -void ReqReceiverMessage::OnRequestReceived(const EventDeleteMessagePtr& event) -{ - LogDebug("enter"); - - Try { - IMessagePtr msg = event->msg; - msg->remove(); - } - Catch(Commons::PlatformException) { - LogError("Commons exception"); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - } -} - -void ReqReceiverMessage::OnRequestReceived(const EventFindMessagePtr& event) -{ - LogDebug("enter"); - - Try { - if (!event->checkCancelled()) { - vector msgs; - for (size_t i = 0; i < event->folderTypes.size(); i++) { - vector tmp = - IMessaging::getInstance().findMessages( - event->messageTypes, - event->folderTypes[i], - event->messageFilter); - msgs.insert(msgs.end(), tmp.begin(), tmp.end()); - } - event->msgs = msgs; - } - //this is only searching so can be cancelled at any time - event->setCancelAllowed(true); - } - Catch(Commons::PlatformException) { - LogError("Commons exception"); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - } -} -}} -} diff --git a/src/modules/API/Messaging/ReqReceiverMessage.h b/src/modules/API/Messaging/ReqReceiverMessage.h deleted file mode 100644 index d2205c1..0000000 --- a/src/modules/API/Messaging/ReqReceiverMessage.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ReqReceiverMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef REQRECEIVERMESSAGE_H -#define REQRECEIVERMESSAGE_H - -#include - -#include "EventSendMessage.h" -#include "EventUpdateMessage.h" -#include "EventDeleteMessage.h" -#include "EventFindMessage.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -typedef Commons::EventRequestReceiver -EventSendMessageReqReceiver; -typedef Commons::EventRequestReceiver -EventUpdateMessageReqReceiver; -typedef Commons::EventRequestReceiver -EventDeleteMessageReqReceiver; -typedef Commons::EventRequestReceiver -EventFindMessageReqReceiver; - -class ReqReceiverMessage : public EventSendMessageReqReceiver, - public EventUpdateMessageReqReceiver, - public EventDeleteMessageReqReceiver, - public EventFindMessageReqReceiver -{ - public: - ReqReceiverMessage(); - - ~ReqReceiverMessage(); - - void sendMessage(const EventSendMessagePtr& event); - - void updateMessage(const EventUpdateMessagePtr& event); - - void deleteMessage(const EventDeleteMessagePtr& event); - - void findMessage(const EventFindMessagePtr& event); - - protected: - void OnRequestReceived(const EventSendMessagePtr& event); - - void OnRequestReceived(const EventUpdateMessagePtr& event); - - void OnRequestReceived(const EventDeleteMessagePtr& event); - - void OnRequestReceived(const EventFindMessagePtr& event); -}; - -typedef DPL::Singleton ReqReceiverMessageSingleton; -} -} -} -#endif // REQRECEIVERMESSAGE_H diff --git a/src/modules/API/Messaging/SourceAddress.cpp b/src/modules/API/Messaging/SourceAddress.cpp deleted file mode 100644 index 6f80aab..0000000 --- a/src/modules/API/Messaging/SourceAddress.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file SourceAddress.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include "Commons/Exception.h" -#include "SourceAddress.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -SourceAddress::SourceAddress() : - m_validSourceAddress(false) -{ -} - -SourceAddress::~SourceAddress() -{ -} - -void SourceAddress::setSourceAddressValidity(bool state) -{ - m_validSourceAddress = state; -} - -bool SourceAddress::getSourceAddressValidity() const -{ - return m_validSourceAddress; -} - -std::string SourceAddress::getSourceAddress() const -{ - return m_sourceAddress; -} - -void SourceAddress::setSourceAddress(const Recipients& value) -{ - if (value.getRecipientSize() != 1) { - LogError("wrong source address value"); - Throw(Commons::InvalidArgumentException); - } - m_sourceAddress = value.getRecipient(0); - m_validSourceAddress = false; -} - -void SourceAddress::setSourceAddress(const std::string& value) -{ - m_sourceAddress = value; - m_validSourceAddress = false; -} -}} -} diff --git a/src/modules/API/Messaging/SourceAddress.h b/src/modules/API/Messaging/SourceAddress.h deleted file mode 100644 index 2067498..0000000 --- a/src/modules/API/Messaging/SourceAddress.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file SourceAddress.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef SOURCEADDRESS_H -#define SOURCEADDRESS_H - -#include "Recipient.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class SourceAddress -{ - private: // fields - - std::string m_sourceAddress; - - bool m_validSourceAddress; - - public: - - SourceAddress(); - - virtual ~SourceAddress(); - - void setSourceAddressValidity(bool state); - - bool getSourceAddressValidity() const; - - std::string getSourceAddress() const; - - void setSourceAddress(const Recipients& value); - - void setSourceAddress(const std::string& value); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/Subject.cpp b/src/modules/API/Messaging/Subject.cpp deleted file mode 100644 index 34e0bcd..0000000 --- a/src/modules/API/Messaging/Subject.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Subject.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "Subject.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -Subject::Subject() : - m_subject(""), - m_validSubject(false) -{ -} - -Subject::~Subject() -{ -} - -void Subject::setSubject(const string& value) -{ - m_validSubject = false; - m_subject = value; -} - -string Subject::getSubject() const -{ - return m_subject; -} - -const std::string& Subject::getSubjectRef() const -{ - return m_subject; -} - -bool Subject::isSubjectValid() const -{ - return m_validSubject; -} - -void Subject::setSubjectValidity(bool state) -{ - m_validSubject = state; -} -}} -} diff --git a/src/modules/API/Messaging/Subject.h b/src/modules/API/Messaging/Subject.h deleted file mode 100644 index f199676..0000000 --- a/src/modules/API/Messaging/Subject.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Subject.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef SUBJECT_H -#define SUBJECT_H - -#include -#include "IMessagingTypes.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class Subject -{ - private: // fields - /** - * abstract subject value of message - */ - std::string m_subject; - - /** - * information if abstract message body has been changed and need update - * in low level - */ - bool m_validSubject; - - public: // methods - - Subject(); - - virtual ~Subject(); - - /** - * setter of subject value - */ - void setSubject(const std::string& value); - - /** - * getter of subject value - */ - std::string getSubject() const; - - /** - * getter of subject value - */ - const std::string& getSubjectRef() const; - - /** - * check validity state - */ - bool isSubjectValid() const; - - /** - * setter for validity state - */ - void setSubjectValidity(bool state); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/ToRecipient.cpp b/src/modules/API/Messaging/ToRecipient.cpp deleted file mode 100644 index 36a8f98..0000000 --- a/src/modules/API/Messaging/ToRecipient.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ToRecipient.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include "ToRecipient.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -ToRecipient::ToRecipient() : - m_toRecipients(new Recipients()) -{ -} - -ToRecipient::~ToRecipient() -{ -} - -void ToRecipient::setToValidity(bool state) -{ - m_toRecipients->setValid(state); -} - -bool ToRecipient::getToValidity() const -{ - return m_toRecipients->isValid(); -} - -Recipients ToRecipient::getToRecipients() const -{ - return *m_toRecipients; -} - -RecipientsPtr ToRecipient::getToRecipientsPtr() const -{ - return m_toRecipients; -} - -void ToRecipient::appendToRecipients(const string & value) -{ - m_toRecipients->appendRecipient(value); -} - -void ToRecipient::appendToRecipients(const Recipients& value) -{ - LogDebug("enter, recipientCount=" << value.getRecipientSize()); - *m_toRecipients += value; -} - -void ToRecipient::removeToRecipients(const Recipients& value) -{ - *m_toRecipients -= value; -} - -void ToRecipient::setToRecipients(const Recipients& value) -{ - *m_toRecipients = value; -} -}} -} diff --git a/src/modules/API/Messaging/ToRecipient.h b/src/modules/API/Messaging/ToRecipient.h deleted file mode 100644 index ad49115..0000000 --- a/src/modules/API/Messaging/ToRecipient.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ToRecipient.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef TORECIPIENT_H -#define TORECIPIENT_H - -#include "Recipient.h" -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -class ToRecipient -{ - private: // fields - - RecipientsPtr m_toRecipients; - - public: - - ToRecipient(); - - virtual ~ToRecipient(); - - void setToValidity(bool state); - - bool getToValidity() const; - - Recipients getToRecipients() const; - - RecipientsPtr getToRecipientsPtr() const; - - void appendToRecipients(const std::string & value); - - void appendToRecipients(const Recipients& value); - - void removeToRecipients(const Recipients& value); - - void setToRecipients(const Recipients& value); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/ValidityPeriodHours.cpp b/src/modules/API/Messaging/ValidityPeriodHours.cpp deleted file mode 100644 index 6c04c73..0000000 --- a/src/modules/API/Messaging/ValidityPeriodHours.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ValidityPeriodHours.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "ValidityPeriodHours.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -ValidityPeriodHours::ValidityPeriodHours() : - m_validityPeriodHours(0), - m_validValidityPeriodHours(false) -{ -} - -ValidityPeriodHours::~ValidityPeriodHours() -{ -} - -void ValidityPeriodHours::setValidityPeriodHours(int value) -{ - m_validityPeriodHours = value; - m_validValidityPeriodHours = false; -} - -int ValidityPeriodHours::getValidityPeriodHours() const -{ - return m_validityPeriodHours; -} - -bool ValidityPeriodHours::isValidityPeriodHoursValid() const -{ - return m_validValidityPeriodHours; -} - -void ValidityPeriodHours::setValidityPeriodHoursValidity(bool state) -{ - m_validValidityPeriodHours = state; -} -}} -} diff --git a/src/modules/API/Messaging/ValidityPeriodHours.h b/src/modules/API/Messaging/ValidityPeriodHours.h deleted file mode 100644 index 4872d37..0000000 --- a/src/modules/API/Messaging/ValidityPeriodHours.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ValidityPeriodHours.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef VALIDITYPERIODHOURS_H -#define VALIDITYPERIODHOURS_H - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class ValidityPeriodHours -{ - private: // fields - - /** - * ValidityPeriodHours value - */ - int m_validityPeriodHours; - - /** - * information if abstract message ValidityPeriodHours has been changed and need update - * in low level - */ - bool m_validValidityPeriodHours; - - public: // methods - - ValidityPeriodHours(); - - virtual ~ValidityPeriodHours(); - - /** - * setter of ValidityPeriodHours value - */ - void setValidityPeriodHours(int value); - - /** - * getter of ValidityPeriodHours value - */ - int getValidityPeriodHours() const; - - /** - * check ValidityPeriodHours validity - * */ - bool isValidityPeriodHoursValid() const; - - /** - * set ValidityPeriodHours validity - * */ - void setValidityPeriodHoursValidity(bool state); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/VirtualMessage.cpp b/src/modules/API/Messaging/VirtualMessage.cpp deleted file mode 100644 index 718852c..0000000 --- a/src/modules/API/Messaging/VirtualMessage.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file VirtualMessage.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include "Commons/Exception.h" -#include "IMessage.h" -#include "VirtualMessage.h" - -using namespace std; - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -VirtualMessage::VirtualMessage() : - IMessage(VIRTUAL_MESSAGE, "") -{ -} - -VirtualMessage::~VirtualMessage() -{ -} - -void VirtualMessage::send() -{ -} - -void VirtualMessage::sendCancel() -{ -} - -void VirtualMessage::update(bool /*draftsOnly*/) -{ -} - -void VirtualMessage::readAllData() -{ -} - -void VirtualMessage::moveToFolder(const FolderType /*newFolder*/) -{ -} - -void VirtualMessage::moveToFolder(const std::string& /*newFolder*/) -{ -} - -void VirtualMessage::copyToFolder(const FolderType /*newFolder*/) -{ -} - -void VirtualMessage::copyToFolder(const std::string& /*newFolder*/) -{ -} - -void VirtualMessage::remove() -{ -} -}} -} diff --git a/src/modules/API/Messaging/VirtualMessage.h b/src/modules/API/Messaging/VirtualMessage.h deleted file mode 100644 index 02fcf9f..0000000 --- a/src/modules/API/Messaging/VirtualMessage.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file VirtualMessage.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef IVIRTUALMESSAGE_H -#define IVIRTUALMESSAGE_H - -#include -#include -#include -#include "IMessage.h" -#include "Subject.h" -#include "CcRecipient.h" -#include "BccRecipient.h" -#include "Attachments.h" -#include "CallbackNumber.h" -#include "ValidityPeriodHours.h" - -namespace WrtDeviceApis { -namespace Messaging { -namespace Api { -//-------------------------------------------------------------------------- - -class VirtualMessage; -typedef DPL::SharedPtr VirtualMessagePtr; - -class VirtualMessage : - public IMessage, - public CcRecipient, - public BccRecipient, - public Attachments -{ - public: - VirtualMessage(); - - virtual ~VirtualMessage(); - - void send(); - - void sendCancel(); - - void update(bool draftsOnly = false); - - void readAllData(); - - void moveToFolder(const FolderType newFolder); - - void moveToFolder(const std::string& newFolder); - - void copyToFolder(const FolderType newFolder); - - void copyToFolder(const std::string& newFolder); - - void remove(); -}; -} -} -} -#endif diff --git a/src/modules/API/Messaging/config.cmake b/src/modules/API/Messaging/config.cmake deleted file mode 100644 index 70366b1..0000000 --- a/src/modules/API/Messaging/config.cmake +++ /dev/null @@ -1,41 +0,0 @@ -get_current_path() - -set(API_MESSAGING_PATH - ${CURRENT_PATH} - PARENT_SCOPE - ) - -set(SRCS_API_MESSAGING - ${CURRENT_PATH}/Attachments.cpp - ${CURRENT_PATH}/IAttachment.cpp - ${CURRENT_PATH}/AttachmentFactory.cpp - ${CURRENT_PATH}/BccRecipient.cpp - ${CURRENT_PATH}/Body.cpp - ${CURRENT_PATH}/CcRecipient.cpp - ${CURRENT_PATH}/From.cpp - ${CURRENT_PATH}/IBinarySms.cpp - ${CURRENT_PATH}/IEmail.cpp - ${CURRENT_PATH}/IMessage.cpp - ${CURRENT_PATH}/IMessaging.cpp - ${CURRENT_PATH}/IMms.cpp - ${CURRENT_PATH}/MmsSlide.cpp - ${CURRENT_PATH}/MmsSlides.cpp - ${CURRENT_PATH}/MmsSlideProperty.cpp - ${CURRENT_PATH}/ISms.cpp - ${CURRENT_PATH}/MessageFactory.cpp - ${CURRENT_PATH}/Recipient.cpp - ${CURRENT_PATH}/Subject.cpp - ${CURRENT_PATH}/ToRecipient.cpp - ${CURRENT_PATH}/ReqReceiverMessage.cpp - ${CURRENT_PATH}/EmailAccountInfo.cpp - ${CURRENT_PATH}/IEmailAccount.cpp - ${CURRENT_PATH}/MessageFilter.cpp - ${CURRENT_PATH}/SourceAddress.cpp - ${CURRENT_PATH}/CallbackNumber.cpp - ${CURRENT_PATH}/ValidityPeriodHours.cpp - ${CURRENT_PATH}/MessagePriority.cpp - ${CURRENT_PATH}/VirtualMessage.cpp - ${CURRENT_PATH}/EventMessageReceived.cpp - ${CURRENT_PATH}/EmitterMessageReceived.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Orientation/EventGetCurrentOrientation.h b/src/modules/API/Orientation/EventGetCurrentOrientation.h deleted file mode 100644 index 37d984f..0000000 --- a/src/modules/API/Orientation/EventGetCurrentOrientation.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file EventGetCurrentOrientation.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_EVENT_GET_CURRENT_ORIENTATION_H_ -#define WRTDEVICEAPIS_ORIENTATION_EVENT_GET_CURRENT_ORIENTATION_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -class EventGetCurrentOrientation : - public Commons::IEvent -{ - private: - OrientationProperties m_props; - public: - void setAlpha(double alpha) - { - m_props.alpha = alpha; - } - void setBeta(double beta) - { - m_props.beta = beta; - } - void setGamma(double gamma) - { - m_props.gamma = gamma; - } - - double getAlpha() const - { - return m_props.alpha; - } - double getBeta() const - { - return m_props.beta; - } - double getGamma() const - { - return m_props.gamma; - } - - OrientationProperties getOrientationProperties() const - { - return m_props; - } - - EventGetCurrentOrientation() - { - } -}; - -typedef DPL::SharedPtr -EventGetCurrentOrientationPtr; -} // Orientation -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_ORIENTATION_EVENT_GET_CURRENT_ORIENTATION_H_ \ No newline at end of file diff --git a/src/modules/API/Orientation/EventOrientationChanged.h b/src/modules/API/Orientation/EventOrientationChanged.h deleted file mode 100644 index 70f4400..0000000 --- a/src/modules/API/Orientation/EventOrientationChanged.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file EventOrientationChanged.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_EVENT_ORIENTATION_CHANGED_H_ -#define WRTDEVICEAPIS_ORIENTATION_EVENT_ORIENTATION_CHANGED_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -class EventOrientationChanged : - public Commons::ListenerEvent -{ - private: - OrientationProperties m_props; - - public: - OrientationProperties getOrientationProperties() const - { - return m_props; - } - void setOrientationProperties(const OrientationProperties &props) - { - m_props = props; - } - - EventOrientationChanged() - { - } -}; - -typedef DPL::SharedPtr EventOrientationChangedPtr; -typedef Commons::ListenerEventEmitter - EventOrientationChangedEmitter; -typedef DPL::SharedPtr - EventOrientationChangedEmitterPtr; -} // Orientation -} // Api -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_ORIENTATION_EVENT_ORIENTATION_CHANGED_H_ \ No newline at end of file diff --git a/src/modules/API/Orientation/IOrientation.cpp b/src/modules/API/Orientation/IOrientation.cpp deleted file mode 100644 index 11ba966..0000000 --- a/src/modules/API/Orientation/IOrientation.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file IOrientation.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#include "IOrientation.h" -#include "EventGetCurrentOrientation.h" - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -IOrientation::IOrientation() : - EventRequestReceiver( - Commons::ThreadEnum::ORIENTATION_THREAD) -{ -} - -IOrientation::~IOrientation() -{ -} - -} -} -} diff --git a/src/modules/API/Orientation/IOrientation.h b/src/modules/API/Orientation/IOrientation.h deleted file mode 100644 index c9b7b9f..0000000 --- a/src/modules/API/Orientation/IOrientation.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file IOrientation.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_ -#define WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -class EventGetCurrentOrientation; -typedef DPL::SharedPtr - EventGetCurrentOrientationPtr; - -class IOrientation : - public Commons::EventRequestReceiver -{ - public: - virtual ~IOrientation(); - - /** - * Gets current orientation - * @param event @see WrtDeviceApis::Api::Orientation::EventGetCurrentOrientation. - * @exception Commons::PlatformException when platform error occurs - */ - virtual void getCurrentOrientation( - const EventGetCurrentOrientationPtr& event) = 0; - - /** - * Requests sensor module to receive continuously update of current - * orientation if the orientation is significantly changed - * @param emitter @see WrtDeviceApis::Api::Orientation::EventOrientationChanged. - * @param minNotificationInterval - * @return An ID of created subscription - * @exception Commons::PlatformException when platform error occurs - */ - virtual long watchOrientation( - const EventOrientationChangedEmitterPtr& emitter, - long minNotificationInterval) = 0; - - /** - * Stopping periodic orientation updates started with watchOrientation - * @param id An Id of listener subscription. - * @exception Commons::PlatformException when platform error occurs - */ - virtual void clearWatch(EventOrientationChangedEmitter::IdType id) = 0; - - protected: - IOrientation(); - - virtual void OnRequestReceived(const EventGetCurrentOrientationPtr& event) - = 0; -}; - -typedef DPL::SharedPtr IOrientationPtr; -} -} -} - -#endif // WRTDEVICEAPIS_ORIENTATION_IORIENTATION_H_ diff --git a/src/modules/API/Orientation/OrientationFactory.cpp b/src/modules/API/Orientation/OrientationFactory.cpp deleted file mode 100644 index 6d8a421..0000000 --- a/src/modules/API/Orientation/OrientationFactory.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file OrientationFactory.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief This class provide factory to create Orientation - */ - -#include -#include "OrientationFactory.h" - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -IOrientationPtr OrientationFactory::getOrientations() -{ - return IOrientationPtr(new Orientation()); -} - -OrientationFactory& OrientationFactory::getInstance() -{ - static OrientationFactory theInstance; - return theInstance; -} - -OrientationFactory::OrientationFactory() -{ -} -} -} -} diff --git a/src/modules/API/Orientation/OrientationFactory.h b/src/modules/API/Orientation/OrientationFactory.h deleted file mode 100644 index b820025..0000000 --- a/src/modules/API/Orientation/OrientationFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file OrientationFactory.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_ORIENTATIONFACTORY_H_ -#define WRTDEVICEAPIS_ORIENTATION_ORIENTATIONFACTORY_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -class OrientationFactory : DPL::Noncopyable -{ - public: - IOrientationPtr getOrientations(); - - static OrientationFactory& getInstance(); - - protected: - OrientationFactory(); -}; -} -} -} - -#endif // WRTDEVICEAPIS_ORIENTATION_ORIENTATIONFACTORY_H_ - diff --git a/src/modules/API/Orientation/OrientationProperties.h b/src/modules/API/Orientation/OrientationProperties.h deleted file mode 100644 index 1144b51..0000000 --- a/src/modules/API/Orientation/OrientationProperties.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file OrientationProperties.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_PROPERTIES_H_ -#define WRTDEVICEAPIS_ORIENTATION_PROPERTIES_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { -namespace Api { - -struct OrientationProperties -{ - double alpha; - double beta; - double gamma; - OrientationProperties() : - alpha(0.0), - beta(0.0), - gamma(0.0) - { - } -}; - -typedef DPL::SharedPtr OrientationPropertiesPtr; -} // Orientation -} // Api -} // WrtDeviceApis - -#endif //WRTDEVICEAPIS_ORIENTATION_PROPERTIES_H_ \ No newline at end of file diff --git a/src/modules/API/Orientation/config.cmake b/src/modules/API/Orientation/config.cmake deleted file mode 100644 index a579035..0000000 --- a/src/modules/API/Orientation/config.cmake +++ /dev/null @@ -1,12 +0,0 @@ -get_current_path() - -set(API_ORIENTATION_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_ORIENTATION - ${CURRENT_PATH}/OrientationFactory.cpp - ${CURRENT_PATH}/IOrientation.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/PluginManager/PluginManagerFactory.cpp b/src/modules/API/PluginManager/PluginManagerFactory.cpp index a46ee2a..9cd39b8 100644 --- a/src/modules/API/PluginManager/PluginManagerFactory.cpp +++ b/src/modules/API/PluginManager/PluginManagerFactory.cpp @@ -40,11 +40,13 @@ PluginManagerFactory& PluginManagerFactory::getInstance() IPluginManagerPtr PluginManagerFactory::getPluginManager( int widgetHandle, const std::string &objectUri, + JSObjectRef object, JSContextRef context) const { - return IPluginManagerPtr(new PluginManager(widgetHandle, objectUri, context)); + return IPluginManagerPtr( + new PluginManager(widgetHandle, objectUri, object, context)); } } } -} \ No newline at end of file +} diff --git a/src/modules/API/PluginManager/PluginManagerFactory.h b/src/modules/API/PluginManager/PluginManagerFactory.h index d7093b8..ed3c578 100644 --- a/src/modules/API/PluginManager/PluginManagerFactory.h +++ b/src/modules/API/PluginManager/PluginManagerFactory.h @@ -38,6 +38,7 @@ public: IPluginManagerPtr getPluginManager( int widgetHandle, const std::string &objectUri, + JSObjectRef object, JSContextRef context) const; private: PluginManagerFactory(); @@ -47,4 +48,4 @@ private: } } -#endif // WRTDEVICEAPIS_PLUGIN_MANAGER_FACTORY_H_ \ No newline at end of file +#endif // WRTDEVICEAPIS_PLUGIN_MANAGER_FACTORY_H_ diff --git a/src/modules/API/Power/Enums.h b/src/modules/API/Power/Enums.h deleted file mode 100644 index 49ea3b2..0000000 --- a/src/modules/API/Power/Enums.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_ENUMS_H_ -#define WRTDEVICEAPIS_POWER_ENUMS_H_ - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -enum BacklightStatus -{ - BACKLIGHT_DIM, - BACKLIGHT_NORMAL, - BACKLIGHT_OFF, - INVALID_STATUS = 10000, - UNDEFINED_STATUS -}; - -} // Api -} // Power -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_POWER_ENUMS_H_ diff --git a/src/modules/API/Power/EventCharging.cpp b/src/modules/API/Power/EventCharging.cpp deleted file mode 100644 index 76cdda1..0000000 --- a/src/modules/API/Power/EventCharging.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "EventCharging.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -EventCharging::EventCharging() -{ -} - -EventCharging::~EventCharging() -{ -} - -} // Api -} // Power -} // WrtDeviceApis diff --git a/src/modules/API/Power/EventCharging.h b/src/modules/API/Power/EventCharging.h deleted file mode 100644 index acf3b58..0000000 --- a/src/modules/API/Power/EventCharging.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_EVENTCHARGING_H_ -#define WRTDEVICEAPIS_POWER_EVENTCHARGING_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -/** - * Event emitted when batter charging state changes, i.e. phone gets plugged - * or unplugged from charger. - */ -class EventCharging : public Commons::ListenerEvent -{ - public: - EventCharging(); - virtual ~EventCharging(); -}; - -typedef DPL::SharedPtr EventChargingPtr; -typedef Commons::ListenerEventEmitter EventChargingEmitter; -typedef DPL::SharedPtr EventChargingEmitterPtr; - -} // Api -} // Power -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_POWER_EVENTCHARGING_H_ */ diff --git a/src/modules/API/Power/EventLight.h b/src/modules/API/Power/EventLight.h deleted file mode 100644 index 04344ee..0000000 --- a/src/modules/API/Power/EventLight.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventLight.h - * @author Hoseon LEE (Hoseon46.lee@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_POWER_EVENTLIGHT_H_ -#define WRTDEVICEAPIS_POWER_EVENTLIGHT_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -class EventLight; - -typedef DPL::SharedPtr EventLightPtr; - -/* - * - */ -class EventLight : public Commons::IEvent -{ - public: - explicit EventLight(const BacklightStatus status, - const long duration) : - m_status(status), - m_duration(duration) - { - } - - BacklightStatus getStatus() const - { - return m_status; - } - - long getDuration() const - { - return m_duration; - } - - private: - const BacklightStatus m_status; - const long m_duration; -}; - -} -} -} - -#endif // WRTDEVICEAPIS_POWER_EVENTLIGHT_H_ diff --git a/src/modules/API/Power/EventLow.cpp b/src/modules/API/Power/EventLow.cpp deleted file mode 100644 index 4e1cf96..0000000 --- a/src/modules/API/Power/EventLow.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "EventLow.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -EventLow::EventLow() : m_result(0) -{ -} - -EventLow::~EventLow() -{ -} - -unsigned int EventLow::getResult() const -{ - return m_result; -} - -void EventLow::setResult(unsigned int result) -{ - m_result = result; -} - -} // Api -} // Power -} // WrtDeviceApis diff --git a/src/modules/API/Power/EventLow.h b/src/modules/API/Power/EventLow.h deleted file mode 100644 index f777c70..0000000 --- a/src/modules/API/Power/EventLow.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_EVENTLOW_H_ -#define WRTDEVICEAPIS_POWER_EVENTLOW_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -/** - * Events emitted when battery reaches low power level. - */ -class EventLow : public Commons::ListenerEvent -{ - public: - EventLow(); - virtual ~EventLow(); - - /** - * Gets remaining battery power (in percents). - * @return Remaining battery power. - * @remarks Read on the side that receives this event. - */ - unsigned int getResult() const; - - /** - * Sets remaining battery power. - * @param result Remining battery power. - * @remarks Set on the side that emits this event. - */ - void setResult(unsigned int result); - - private: - unsigned int m_result; ///< Remaining battery power (in percents). -}; - -typedef DPL::SharedPtr EventLowPtr; -typedef Commons::ListenerEventEmitter EventLowEmitter; -typedef DPL::SharedPtr EventLowEmitterPtr; - -} // Api -} // Power -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_POWER_EVENTLOW_H_ */ diff --git a/src/modules/API/Power/EventRemaining.cpp b/src/modules/API/Power/EventRemaining.cpp deleted file mode 100644 index ef4af33..0000000 --- a/src/modules/API/Power/EventRemaining.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "EventRemaining.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -EventRemaining::EventRemaining() : m_result(0) -{ -} - -EventRemaining::~EventRemaining() -{ -} - -unsigned int EventRemaining::getResult() const -{ - return m_result; -} - -void EventRemaining::setResult(unsigned int result) -{ - m_result = result; -} - -} // Api -} // Power -} // WrtDeviceApis diff --git a/src/modules/API/Power/EventRemaining.h b/src/modules/API/Power/EventRemaining.h deleted file mode 100644 index 282ac2a..0000000 --- a/src/modules/API/Power/EventRemaining.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_EVENTREMAINING_H_ -#define WRTDEVICEAPIS_POWER_EVENTREMAINING_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -/** - * Event emitted when remaining battery power changes. - */ -class EventRemaining : public Commons::ListenerEvent -{ - public: - EventRemaining(); - virtual ~EventRemaining(); - - /** - * Gets remaining battery power (in percents). - * @return Remaining battery power. - * @remarks Read on the side that receives this event. - */ - unsigned int getResult() const; - - /** - * Sets remaining battery power. - * @param result Remining battery power. - * @remarks Set on the side that emits this event. - */ - void setResult(unsigned int result); - - private: - unsigned int m_result; ///< Remaining battery power (in percents). -}; - -typedef DPL::SharedPtr EventRemainingPtr; -typedef Commons::ListenerEventEmitter EventRemainingEmitter; -typedef DPL::SharedPtr EventRemainingEmitterPtr; - -} // Api -} // Power -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_POWER_EVENTREMAINING_H_ diff --git a/src/modules/API/Power/IBacklight.cpp b/src/modules/API/Power/IBacklight.cpp deleted file mode 100644 index 92fb2bb..0000000 --- a/src/modules/API/Power/IBacklight.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IBacklight.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -IBacklight::~IBacklight() -{ -} - -} // Api -} // Power -} // WrtDeviceApis - diff --git a/src/modules/API/Power/IBacklight.h b/src/modules/API/Power/IBacklight.h deleted file mode 100644 index df57fa6..0000000 --- a/src/modules/API/Power/IBacklight.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IBacklight.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_POWER_IBACKALIGHT_H_ -#define WRTDEVICEAPIS_POWER_IBACKALIGHT_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -/** - * Represents battery unit on the device. - */ -class IBacklight : private DPL::Noncopyable -{ - public: - virtual ~IBacklight() = 0; - - /** - * @see Api::Power::IBacklight::changeState() - */ - virtual int changeState(BacklightStatus state, - unsigned int timeout) = 0; - - /** - * @see Api::Power::IBacklight::changeState() - */ - virtual void changeState(const EventLightPtr& event) = 0; -}; - -typedef DPL::SharedPtr IBacklightPtr; - -} // Api -} // Power -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_POWER_IBACKALIGHT_H_ - diff --git a/src/modules/API/Power/IBattery.cpp b/src/modules/API/Power/IBattery.cpp deleted file mode 100644 index 0fbb9f7..0000000 --- a/src/modules/API/Power/IBattery.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IBattery.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -IBattery::~IBattery() -{ -} - -} // Api -} // Power -} // WrtDeviceApis diff --git a/src/modules/API/Power/IBattery.h b/src/modules/API/Power/IBattery.h deleted file mode 100644 index 61495a4..0000000 --- a/src/modules/API/Power/IBattery.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_IBATTERY_H_ -#define WRTDEVICEAPIS_POWER_IBATTERY_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -/** - * Represents battery unit on the device. - */ -class IBattery : private DPL::Noncopyable -{ - public: - virtual ~IBattery() = 0; - - /** - * Gets information whether battery is charging. - * @return True if battery is charging, false otherwsie. - * @throw PlatformException If platform error occurs. - */ - virtual bool isCharging() const = 0; - - /** - * Gets remaining charge level (in percents). - * @return Percent of remaining charge level. - * @throw PlatformException If platform error occurs. - */ - virtual unsigned int getRemaining() const = 0; - - /** - * Adds on battery being charged event emitter. - * @param emitter On battery being charged event emitter. - * @throw PlatformException If platform error occurs. - */ - virtual void addOnCharging(const EventChargingEmitterPtr& emitter) = 0; - - /** - * Removes charging event emitter. - * @param id Id of an event emitter. - */ - virtual void removeOnCharging(EventChargingEmitter::IdType id) = 0; - - /** - * Adds battery level remaining event emitter. - * @param emitter Battery level remaining event emitter. - * @throw PlatformException If platform error occurs. - */ - virtual void addOnRemaining(const EventRemainingEmitterPtr& emitter) = 0; - - /** - * Removes remaining event emitter. - * @param id Id of an event emitter. - */ - virtual void removeOnRemaining(EventRemainingEmitter::IdType id) = 0; - - /** - * Adds battery on low level event emitter. - * @param emitter Battery on low level event emitter. - * @throw PlatformException If platform error occurs. - */ - virtual void addOnLow(const EventLowEmitterPtr& emitter) = 0; - - /** - * Removes on low level event emitter. - * @param id Id of an event emitter. - */ - virtual void removeOnLow(EventLowEmitter::IdType id) = 0; -}; - -typedef DPL::SharedPtr IBatteryPtr; - -} // Api -} // Power -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_POWER_IBATTERY_H_ diff --git a/src/modules/API/Power/IManager.cpp b/src/modules/API/Power/IManager.cpp deleted file mode 100644 index ac563f1..0000000 --- a/src/modules/API/Power/IManager.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include "IManager.h" - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -IManager& IManager::getInstance() -{ - return Manager::getInstance(); -} - -IManager::IManager() -{ -} - -IManager::~IManager() -{ -} -} // Power -} // Api -} // WrtDeviceApis diff --git a/src/modules/API/Power/IManager.h b/src/modules/API/Power/IManager.h deleted file mode 100644 index 138554e..0000000 --- a/src/modules/API/Power/IManager.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_IMANAGER_H_ -#define WRTDEVICEAPIS_POWER_IMANAGER_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { -namespace Api { - -class IManager : private DPL::Noncopyable -{ - public: - static IManager& getInstance(); - - public: - virtual ~IManager() = 0; - - /** - * Gets interface to battery. - * @param index Index of battery to get (1-based). - * @return Interface to battery. - * @throw PlatformException If platform error occurs. - * @throw OutOfRangeException If index is greater than available batteries. - * @remarks Ownership over result (IBattery*) is NOT passed to caller. - */ - virtual IBattery* getBattery(std::size_t index) const = 0; - - /** - * Gets number of available batteries. - * @return Number of batteries. - */ - virtual std::size_t getBatteriesCount() const = 0; - - virtual IBacklightPtr getBacklight(void) = 0; - - virtual std::size_t getBacklightCount() const = 0; - - /** - * Release resources. - */ - virtual void Release() = 0; - - protected: - IManager(); -}; - -} // Api -} // Power -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_POWER_IMANAGER_H_ diff --git a/src/modules/API/Power/config.cmake b/src/modules/API/Power/config.cmake deleted file mode 100644 index e2c445b..0000000 --- a/src/modules/API/Power/config.cmake +++ /dev/null @@ -1,16 +0,0 @@ -get_current_path() - -set(API_POWER_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_POWER - ${CURRENT_PATH}/IManager.cpp - ${CURRENT_PATH}/IBattery.cpp - ${CURRENT_PATH}/IBacklight.cpp - ${CURRENT_PATH}/EventCharging.cpp - ${CURRENT_PATH}/EventRemaining.cpp - ${CURRENT_PATH}/EventLow.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Profile/Enums.h b/src/modules/API/Profile/Enums.h deleted file mode 100644 index 63590f2..0000000 --- a/src/modules/API/Profile/Enums.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_ENUMS_H_ -#define WRTDEVICEAPIS_PROFILE_ENUMS_H_ - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -enum RingtoneScope -{ - RS_CALL, - RS_SMS, - RS_MMS, - RS_EMAIL -}; -} // Api -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_ENUMS_H_ diff --git a/src/modules/API/Profile/EventSetWallpaper.h b/src/modules/API/Profile/EventSetWallpaper.h deleted file mode 100644 index b9b2602..0000000 --- a/src/modules/API/Profile/EventSetWallpaper.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file EventSetWallpaper.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_PROFILE_EVENTSETWALLPAPER_H_ -#define WRTDEVICEAPIS_PROFILE_EVENTSETWALLPAPER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -class EventSetWallpaper; - -typedef DPL::SharedPtr EventSetWallpaperPtr; - -/* - * - */ -class EventSetWallpaper : public Commons::IEvent -{ - public: - explicit EventSetWallpaper(const std::string& path) : m_path(path) - { - } - - const std::string& getPathRef() const - { - return m_path; - } - - private: - const std::string m_path; -}; -} // Api -} // Profile -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_PROFILE_EVENTSETWALLPAPER_H_ */ diff --git a/src/modules/API/Profile/IDesktop.cpp b/src/modules/API/Profile/IDesktop.cpp deleted file mode 100644 index c8260d1..0000000 --- a/src/modules/API/Profile/IDesktop.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IDesktop.h" - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -IDesktop::~IDesktop() -{ -} -} // Api -} // Profile -} // WrtDeviceApis diff --git a/src/modules/API/Profile/IDesktop.h b/src/modules/API/Profile/IDesktop.h deleted file mode 100644 index 47514f5..0000000 --- a/src/modules/API/Profile/IDesktop.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_IDESKTOP_H_ -#define WRTDEVICEAPIS_PROFILE_IDESKTOP_H_ - -#include -#include -#include "EventSetWallpaper.h" - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -class IDesktop -{ - public: - /** - * Index of default desktop. - */ - static const std::size_t DEFAULT = 0; - - public: - virtual ~IDesktop() = 0; - - /** - * Gets path to wallpaper for current desktop. - * @return Path to wallpaper. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportException If platform doesn't support such feature. - */ - virtual Filesystem::Api::IPathPtr getWallpaper() const = 0; - - /** - * Sets wallpaper for current desktop. - * @param path Path to wallpaper. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportException If platform doesn't support such feature. - */ - virtual void setWallpaper(const Filesystem::Api::IPathPtr& path) = 0; - - /** - * Sets wallpaper for current desktop (async version) - * @param path Path to wallpaper. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportException If platform doesn't support such feature. - */ - virtual void setWallpaper(const EventSetWallpaperPtr& event) = 0; -}; - -typedef DPL::SharedPtr< IDesktop > IDesktopPtr; -} // Api -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_IDESKTOP_H_ diff --git a/src/modules/API/Profile/IManager.cpp b/src/modules/API/Profile/IManager.cpp deleted file mode 100644 index 168dfde..0000000 --- a/src/modules/API/Profile/IManager.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IManager.h" -#include - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -IManager& IManager::getInstance() -{ - return Manager::getInstance(); -} - -IManager::~IManager() -{ -} -} // Api -} // Profile -} // WrtDeviceApis diff --git a/src/modules/API/Profile/IManager.h b/src/modules/API/Profile/IManager.h deleted file mode 100644 index 0a6cf72..0000000 --- a/src/modules/API/Profile/IManager.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_IMANAGER_H_ -#define WRTDEVICEAPIS_PROFILE_IMANAGER_H_ - -#include -#include "IDesktop.h" -#include "IRingtone.h" -#include "Enums.h" - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -class IManager -{ - public: - static IManager& getInstance(); - - typedef enum - { - NORMAL, SILENT, DRIVING, MEETING, OUTDOOR, FLIGHT - } ProfileType; - - public: - virtual ~IManager() = 0; - - /** - * Gets desktop settings interface for current profile. - * @param index 1-based index - * @return Desktop interface (or NULL if 0 is passed and general desktop is not supported). - * @throw PlatformException If error in platform occurs. - * @throw OutOfRangeException If desktop doesn't exist. - * @throw UnsupportedException If platform doesn't support it. - * @remarks Passing IDesktop::DEFAULT as index results in returning default - * desktop interface (or first one if platform doesn't distinct them). - * @remarks Ownership is NOT passed to the caller. - */ - virtual IDesktopPtr getDesktop(std::size_t index) const = 0; - - /** - * Gets number of available desktops on current platform. - * @return Number of desktops. - * @throw PlatformException If error in platform occurs. - */ - virtual std::size_t getDesktopCount() const = 0; - - /** - * Gets ringtone interface for specific type of received message. - * @param scope Received message/call type. - * @return Ringtone interface. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support it. - * @remarks Some platforms may not distinct between different types of messages - * as far as ringtone settings are concerned, e.g. they may assign - * SMS, MMS and EMAIL the same ringtone settings. - * @remarks Ownership is NOT passed to the caller. - */ - virtual IRingtone* getRingtone(RingtoneScope scope) const = 0; - - /** - * Returns profile setting. - * @return ProfileType enum. - * @throw ConversionException - * @throw OutOfRangeException - */ - virtual ProfileType getProfileType() const = 0; - - /** - * Returns system volume value. - * @return system volume as int. - * @throw ConversionException - */ - virtual int getSystemVolume() const = 0; - - /** - * Release resources. - */ - virtual void Release() const = 0; - virtual int getVibrateType() const = 0; -}; -} // Api -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_IMANAGER_H_ diff --git a/src/modules/API/Profile/IRingtone.cpp b/src/modules/API/Profile/IRingtone.cpp deleted file mode 100644 index e48fa7d..0000000 --- a/src/modules/API/Profile/IRingtone.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "IRingtone.h" - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -IRingtone::~IRingtone() -{ -} -} // Api -} // Profile -} // WrtDeviceApis diff --git a/src/modules/API/Profile/IRingtone.h b/src/modules/API/Profile/IRingtone.h deleted file mode 100644 index b78410e..0000000 --- a/src/modules/API/Profile/IRingtone.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_IRINGTONE_H_ -#define WRTDEVICEAPIS_PROFILE_IRINGTONE_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -class IRingtone -{ - public: - virtual ~IRingtone() = 0; - - /** - * Gets volume level. - * @return Volume value. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - * @remarks Different platforms may have different ranges of values. - */ - virtual Volume getVolume() const = 0; - - /** - * Sets volume level. - * @param level Volume value. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - * @remarks Different platforms may respect different ranges of values. - */ - virtual void setVolume(Volume level) = 0; - - /** - * Gets path to ringtone audio file. - * @return File path. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - */ - virtual Filesystem::Api::IPathPtr getAudio() const = 0; - - /** - * Sets path to ringtone audio file. - * @param path File path. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - */ - virtual void setAudio(const Filesystem::Api::IPathPtr& path) = 0; - - /** - * Gets haptics level. - * @return Haptics intensity. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - * @remarks Different platforms may have different ranges of values. - */ - virtual Haptics::Api::Feedback getHaptics() const = 0; - - /** - * Sets haptics level. - * @param level Haptics intensity. - * @throw PlatformException If error in platform occurs. - * @throw UnsupportedException If platform doesn't support this feature. - * @remarks Different platforms may respect different ranges of values. - */ - virtual void setHaptics(Haptics::Api::Feedback level) = 0; -}; -} // Api -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_IRINGTONE_H_ diff --git a/src/modules/API/Profile/Types.h b/src/modules/API/Profile/Types.h deleted file mode 100644 index 4bd441e..0000000 --- a/src/modules/API/Profile/Types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_TYPES_H_ -#define WRTDEVICEAPIS_PROFILE_TYPES_H_ - -namespace WrtDeviceApis { -namespace Profile { -namespace Api { -/** - * Type representing volume level. - */ -typedef unsigned short Volume; - -/** - * Value representing volume turned off (mute). - */ -const Volume NO_VOLUME = 0; - -/** - * Value representing the lowest volume level. - */ -const Volume VOLUME_MIN = 1; - -/** - * Value representing the highest volume level. - */ -const Volume VOLUME_MAX = 100; - -} // Api -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_TYPES_H_ diff --git a/src/modules/API/Profile/config.cmake b/src/modules/API/Profile/config.cmake deleted file mode 100644 index 8d47d1f..0000000 --- a/src/modules/API/Profile/config.cmake +++ /dev/null @@ -1,13 +0,0 @@ -get_current_path() - -set(API_PROFILE_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_PROFILE - ${CURRENT_PATH}/IManager.cpp - ${CURRENT_PATH}/IDesktop.cpp - ${CURRENT_PATH}/IRingtone.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Radio/Enums.h b/src/modules/API/Radio/Enums.h deleted file mode 100644 index 44932c5..0000000 --- a/src/modules/API/Radio/Enums.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_ENUMS_H_ -#define WRTDEVICEAPIS_RADIO_ENUMS_H_ - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -/** - * Type of signal source. - */ -enum SourceType -{ - ST_UNKNOWN, //!< ST_UNKNOWN - ST_CDMA, //!< ST_CDMA - ST_GSM, //!< ST_GSM - ST_LTE, //!< ST_LTE - ST_TDSCDMA, //!< ST_TDSCDMA - ST_WCDMA //!< ST_WCDMA -}; -} // Api -} // Radio -} // WrtDeviceapis - -#endif // WRTDEVICEAPIS_RADIO_ENUMS_H_ diff --git a/src/modules/API/Radio/EventSourceTypeChange.cpp b/src/modules/API/Radio/EventSourceTypeChange.cpp deleted file mode 100644 index b02ae8e..0000000 --- a/src/modules/API/Radio/EventSourceTypeChange.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "EventSourceTypeChange.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -EventSourceTypeChange::EventSourceTypeChange() : m_type(ST_UNKNOWN) -{ -} - -SourceType EventSourceTypeChange::getType() const -{ - return m_type; -} - -void EventSourceTypeChange::setType(SourceType type) -{ - m_type = type; -} -} // Api -} // Radio -} // WrtDeviceApis diff --git a/src/modules/API/Radio/EventSourceTypeChange.h b/src/modules/API/Radio/EventSourceTypeChange.h deleted file mode 100644 index 40d2133..0000000 --- a/src/modules/API/Radio/EventSourceTypeChange.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_DEVICE_EVENTSOURCETYPECHANGE_H_ -#define WRTDEVICEAPIS_DEVICE_EVENTSOURCETYPECHANGE_H_ - -#include -#include -#include -#include "Enums.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -/** - * Event emitted when screen orientation changes. - */ -class EventSourceTypeChange : public Commons::ListenerEvent< - EventSourceTypeChange> -{ - public: - EventSourceTypeChange(); - - /** - * Gets signal source's type. - * @return Type of the signal source. - */ - SourceType getType() const; - - /** - * Sets signal source's type. - * @param type Type of the signal source.. - */ - void setType(SourceType type); - - protected: - SourceType m_type; -}; - -typedef DPL::SharedPtr EventSourceTypeChangePtr; -typedef Commons::ListenerEventEmitter -EventSourceTypeChangeEmitter; -typedef DPL::SharedPtr -EventSourceTypeChangeEmitterPtr; -} // Api -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_DEVICE_EVENTSOURCETYPECHANGE_H_ diff --git a/src/modules/API/Radio/IManager.cpp b/src/modules/API/Radio/IManager.cpp deleted file mode 100644 index 8b43237..0000000 --- a/src/modules/API/Radio/IManager.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#include -#include "IManager.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -IManager& IManager::getInstance() -{ - return Manager::getInstance(); -} - -IManager::~IManager() -{ -} -} // Api -} // Radio -} // WrtDeviceApis diff --git a/src/modules/API/Radio/IManager.h b/src/modules/API/Radio/IManager.h deleted file mode 100644 index c46397c..0000000 --- a/src/modules/API/Radio/IManager.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_IMANAGER_H_ -#define WRTDEVICEAPIS_RADIO_IMANAGER_H_ - -#include -#include -#include "Types.h" -#include "ISource.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -class IManager : public DPL::Noncopyable -{ - public: - static IManager& getInstance(); - - public: - virtual ~IManager() = 0; - - /** - * Checks whether radio is enabled. - * @return True if radio is enabled, false otherwise. - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual bool isEnabled() const = 0; - - /** - * Checks whether roaming is turned on. - * @return True when roaming is on, false otherwise. - */ - virtual bool isRoaming() const = 0; - - /** - * Gets interface of currently connected source. - * @return Interface of radio source. - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual ISource* getSource() const = 0; - - /** - * Gets signal strength. - * @return Signal strength (in percents). - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual Strength getSignalStrength() const = 0; - - /** - * Gets Mobile Country Code - * @return Mobile Country Code string. - */ - virtual std::string getMcc() const = 0; - - /** - * Gets Mobile Network Code - * @return Mobile Country Code string. - */ - virtual std::string getMnc() const = 0; - - /** - * Checks whether telephony H/W is turend on. - * @return true when on, false otherwise. - */ - virtual bool isHardwareOn() const = 0; -}; -} // Api -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_RADIO_IMANAGER_H_ diff --git a/src/modules/API/Radio/ISource.cpp b/src/modules/API/Radio/ISource.cpp deleted file mode 100644 index 9a07f3c..0000000 --- a/src/modules/API/Radio/ISource.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#include "ISource.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -ISource::~ISource() -{ -} -} // Api -} // Radio -} // WrtDeviceApis diff --git a/src/modules/API/Radio/ISource.h b/src/modules/API/Radio/ISource.h deleted file mode 100644 index 5e7c6e3..0000000 --- a/src/modules/API/Radio/ISource.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_ISOURCE_H_ -#define WRTDEVICEAPIS_RADIO_ISOURCE_H_ - -#include "Enums.h" -#include "EventSourceTypeChange.h" - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -class ISource -{ - public: - virtual ~ISource() = 0; - - /** - * Gets whether device is connected to some signal source. - * @return True if connected, false otherwise. - * @throw PlatformException If error in platform occurs. - */ - virtual bool isConnected() const = 0; - - /** - * Gets type of the signal source. - * @return Type of the source. - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual SourceType getType() const = 0; - - /** - * Adds on type change emitter. - * @param emitter On type change event emitter. - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual void addOnTypeChange(const EventSourceTypeChangeEmitterPtr& emitter) - = 0; - - /** - * Removes on type change emitter. - * @param id Id of an event emitter. - * @throw UnsupportedException If platform doesn't support it. - * @throw PlatformException If error in platform occurs. - */ - virtual void removeOnTypeChange(EventSourceTypeChangeEmitter::IdType id) = - 0; -}; -} // Api -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_RADIO_ISOURCE_H_ diff --git a/src/modules/API/Radio/Types.h b/src/modules/API/Radio/Types.h deleted file mode 100644 index d102abe..0000000 --- a/src/modules/API/Radio/Types.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_TYPES_H_ -#define WRTDEVICEAPIS_RADIO_TYPES_H_ - -namespace WrtDeviceApis { -namespace Radio { -namespace Api { -typedef unsigned int Strength; -} // Api -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_RADIO_TYPES_H_ diff --git a/src/modules/API/Radio/config.cmake b/src/modules/API/Radio/config.cmake deleted file mode 100644 index 389fcb4..0000000 --- a/src/modules/API/Radio/config.cmake +++ /dev/null @@ -1,13 +0,0 @@ -get_current_path() - -set(API_RADIO_PATH - ${CURRENT_PATH} - PARENT_SCOPE - ) - -set(SRCS_API_RADIO - ${CURRENT_PATH}/IManager.cpp - ${CURRENT_PATH}/ISource.cpp - ${CURRENT_PATH}/EventSourceTypeChange.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/SystemInfo/ISystemInfo.cpp b/src/modules/API/SystemInfo/ISystemInfo.cpp deleted file mode 100644 index 00424d7..0000000 --- a/src/modules/API/SystemInfo/ISystemInfo.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Taejeong Lee - */ - -#include -#include "ISystemInfo.h" - -namespace WrtDeviceApis { -namespace SystemInfo { -namespace Api { -ISystemInfo& ISystemInfo::getInstance() -{ - return SystemInfo::getInstance(); -} - -ISystemInfo::~ISystemInfo() -{ -} -} // Api -} // SystemInfo -} // WrtDeviceApis diff --git a/src/modules/API/SystemInfo/ISystemInfo.h b/src/modules/API/SystemInfo/ISystemInfo.h deleted file mode 100644 index cc002ba..0000000 --- a/src/modules/API/SystemInfo/ISystemInfo.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Taejeong Lee - */ - -#ifndef WRTDEVICEAPIS_SYSTEMINFO_INTERFACE_H_ -#define WRTDEVICEAPIS_SYSTEMINFO_INTERFACE_H_ - -#include -#include - -using namespace std; - -namespace WrtDeviceApis { -namespace SystemInfo { -namespace Api { -class ISystemInfo : public DPL::Noncopyable -{ - public: - static ISystemInfo& getInstance(); - - public: - virtual ~ISystemInfo() = 0; - virtual string getDeviceModelName() = 0; - virtual string getDeviceVersion() = 0; -}; -} // Api -} // SystemInfo -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_SYSTEMINFO_INTERFACE_H_ \ No newline at end of file diff --git a/src/modules/API/SystemInfo/config.cmake b/src/modules/API/SystemInfo/config.cmake deleted file mode 100644 index 559e8f1..0000000 --- a/src/modules/API/SystemInfo/config.cmake +++ /dev/null @@ -1,11 +0,0 @@ -get_current_path() - -set(API_SYSTEMINFO_PATH - ${CURRENT_PATH} - PARENT_SCOPE - ) - -set(SRCS_API_SYSTEMINFO - ${CURRENT_PATH}/ISystemInfo.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Task/CalendarTask.cpp b/src/modules/API/Task/CalendarTask.cpp deleted file mode 100644 index d4216a1..0000000 --- a/src/modules/API/Task/CalendarTask.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file CalendarTask.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "CalendarTask.h" -#include - -namespace { -const int UNDEFINED_TASK_ID = -1; -} - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -CalendarTask::CalendarTask() : - m_id(UNDEFINED_TASK_ID), - m_taskId(UNDEFINED_TASK_ID), - m_dueDate(UNDEFINED_TASK_TIME_T_VALUE), - m_status(UNDEFINED_STATUS), - m_priority(UNDEFINED_PRIORITY), - m_descriptionIsSet(false), - m_subjectIsSet(false) -{ -} - -CalendarTask::~CalendarTask() -{ -} - -bool CalendarTask::getIdIsSet() const -{ - return m_id != UNDEFINED_TASK_ID; -} - -bool CalendarTask::getTaskIdIsSet() const -{ - return m_taskId != UNDEFINED_TASK_ID; -} - -bool CalendarTask::getDescriptionIsSet() const -{ - return m_descriptionIsSet; -} - -bool CalendarTask::getSubjectIsSet() const -{ - return m_subjectIsSet; -} - -bool CalendarTask::getDueDateIsSet() const -{ - return m_dueDate >= 0; -} - -bool CalendarTask::getStatusIsSet() const -{ - return m_status != UNDEFINED_STATUS; -} - -bool CalendarTask::getPriorityIsSet() const -{ - return m_priority != UNDEFINED_PRIORITY; -} - -int CalendarTask::getTaskId() const -{ - return m_taskId; -} - -void CalendarTask::setTaskId(int value) -{ - m_taskId = value; -} - -int CalendarTask::getId() const -{ - return m_id; -} - -void CalendarTask::setId(int value) -{ - m_id = value; -} - -std::string CalendarTask::getDescription() const -{ - return m_description; -} - -void CalendarTask::setDescription(const std::string &value) -{ - m_descriptionIsSet = true; - m_description = value; -} - -std::string CalendarTask::getSubject() const -{ - return m_subject; -} - -void CalendarTask::setSubject(const std::string &value) -{ - m_subjectIsSet = true; - m_subject = value; -} - -time_t CalendarTask::getDueDate() const -{ - return m_dueDate > 0 ? m_dueDate : 0; -} - -void CalendarTask::setDueDate(time_t value) -{ - m_dueDate = value; -} - -CalendarTask::TaskStatus CalendarTask::getStatus() const -{ - return m_status == UNDEFINED_STATUS ? STATUS_NEEDS_ACTION : m_status; -} - -void CalendarTask::setStatus(TaskStatus value) -{ - m_status = value; -} - -CalendarTask::TaskPriority CalendarTask::getPriority() const -{ - return m_priority == UNDEFINED_PRIORITY ? LOW_PRIORITY : m_priority; -} - -void CalendarTask::setPriority(TaskPriority value) -{ - m_priority = value; -} - -void CalendarTask::display() const -{ - LogDebug("m_id " << m_id); - LogDebug("m_calendarId " << m_taskId); - LogDebug("m_description " << m_description); - LogDebug("m_subject " << m_subject); - LogDebug("m_dueDate " << m_dueDate); - LogDebug("m_status " << m_status); - LogDebug("m_priority " << m_priority); -} - -bool CalendarTask::validate() const -{ - if (m_dueDate == -1) { - LogError("Incorrect due time value detected"); - return false; - } - if (m_status == CalendarTask::INVALID_STATUS) { - LogError("Incorrect status value detected"); - return false; - } - if (m_priority == CalendarTask::INVALID_PRIORITY) { - LogError("Incorrect priority value detected"); - return false; - } - return true; -} - -} -} -} diff --git a/src/modules/API/Task/CalendarTask.h b/src/modules/API/Task/CalendarTask.h deleted file mode 100644 index 079dbcd..0000000 --- a/src/modules/API/Task/CalendarTask.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file CalendarTask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_CALENDAR_TASK_H_ -#define WRTDEVICEAPIS_TASK_CALENDAR_TASK_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -//typedef std::vector CategoryList; -//typedef DPL::SharedPtr CategoryListPtr; - -//typedef std::vector StatusList; -//typedef DPL::SharedPtr StatusListPtr; -//typedef std::vector PriorityList; -//typedef DPL::SharedPtr PriorityListPtr; - -/* This object represents a single calendar event */ -class CalendarTask -{ - public: - typedef enum - { - STATUS_COMPLETED, - STATUS_NEEDS_ACTION, - STATUS_CANCELLED, - STATUS_IN_PROCESS, - INVALID_STATUS = 10000, - UNDEFINED_STATUS /* should be used only to mark a fact filter is not set */ - } TaskStatus; - - typedef enum - { - HIGH_PRIORITY, - MEDIUM_PRIORITY, - LOW_PRIORITY, - INVALID_PRIORITY = 10000, - UNDEFINED_PRIORITY /* should be used only to mark a fact filter is not set */ - } TaskPriority; - - typedef enum - { - UNDEFINED_TASK_TIME_T_VALUE = -2, - INVALID_TASK_TIME_T_VALUE = -1 - } TaskTimeTValues; - - typedef enum - { - UNDEFINED_TASK_ID = -1 - } TaskIdValues; - - CalendarTask(); - virtual ~CalendarTask(); - - int getId() const; - void setId(int value); - - int getTaskId() const; - void setTaskId(int value); - - std::string getDescription() const; - void setDescription(const std::string &value); - - std::string getSubject() const; - void setSubject(const std::string &value); - - time_t getDueDate() const; - void setDueDate(time_t value); - - TaskStatus getStatus() const; - void setStatus(TaskStatus value); - - TaskPriority getPriority() const; - void setPriority(TaskPriority value); - - void display() const; - bool validate() const; - - bool getIdIsSet() const; - bool getTaskIdIsSet() const; - bool getDescriptionIsSet() const; - bool getSubjectIsSet() const; - bool getDueDateIsSet() const; - bool getStatusIsSet() const; - bool getPriorityIsSet() const; - - protected: - int m_id; - int m_taskId; - std::string m_description; - std::string m_subject; - time_t m_dueDate; - TaskStatus m_status; - TaskPriority m_priority; - - bool m_descriptionIsSet; - bool m_subjectIsSet; -}; - -typedef DPL::SharedPtr CalendarTaskPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_TASK_CALENDAR_TASK_H_ diff --git a/src/modules/API/Task/IEventAddTask.h b/src/modules/API/Task/IEventAddTask.h deleted file mode 100644 index 95ca0fb..0000000 --- a/src/modules/API/Task/IEventAddTask.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventAddTask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_ADD_TASK_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_ADD_TASK_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventAddTask : public Commons::IEvent -{ - CalendarTaskPtr m_taskAdd; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setTask(CalendarTaskPtr value) - { - m_taskAdd = value; - } - CalendarTaskPtr getTask() const - { - return m_taskAdd; - } - IEventAddTask() : - m_taskAdd(NULL), - m_result(false) - { - LogDebug("entered"); - } - ~IEventAddTask() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventAddTaskPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_ADD_TASK_H_ diff --git a/src/modules/API/Task/IEventCreateTask.h b/src/modules/API/Task/IEventCreateTask.h deleted file mode 100644 index 89ff1a0..0000000 --- a/src/modules/API/Task/IEventCreateTask.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventCreateTask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_CREATE_TASK_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_CREATE_TASK_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventCreateTask : public Commons::IEvent -{ - CalendarTaskPtr m_task; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setTask(CalendarTaskPtr value) - { - m_task = value; - } - CalendarTaskPtr getTask() const - { - return m_task; - } - - IEventCreateTask() : - m_task(NULL), - m_result(false) - { - } - ~IEventCreateTask() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventCreateTaskPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_CREATE_TASK_H_ diff --git a/src/modules/API/Task/IEventDeleteTask.h b/src/modules/API/Task/IEventDeleteTask.h deleted file mode 100644 index 082141f..0000000 --- a/src/modules/API/Task/IEventDeleteTask.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventDeleteTask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_DELETE_TASK_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_DELETE_TASK_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventDeleteTask : public Commons::IEvent -{ - CalendarTaskPtr m_task; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setTask(CalendarTaskPtr value) - { - m_task = value; - } - CalendarTaskPtr getTask() const - { - return m_task; - } - IEventDeleteTask() : - m_task(NULL), - m_result(false) - { - } - ~IEventDeleteTask() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventDeleteTaskPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_DELETE_TASK_H_ diff --git a/src/modules/API/Task/IEventFindTasks.h b/src/modules/API/Task/IEventFindTasks.h deleted file mode 100644 index f287ad4..0000000 --- a/src/modules/API/Task/IEventFindTasks.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventFindTasks.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_FIND_TASKS_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_FIND_TASKS_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventFindTasks : public Commons::IEvent -{ - /* user is responsible to free objects inside list */ - std::vector m_tasks; //OUTPUT: result list - bool m_result; //OUTPUT: operation result - TaskFilterPtr m_filter; //INPUT: filters - int m_firstTask; //INPUT: index of first found event to include on list - int m_lastTask; //INPUT: index of last found event to include on list - public: - void setFirstTask(int value) - { - m_firstTask = value; - } - int getFirstTask() const - { - return m_firstTask; - } - void setLastTask(int value) - { - m_lastTask = value; - } - int getLastTask() const - { - return m_lastTask; - } - void setFilter(TaskFilterPtr value) - { - m_filter = value; - } - TaskFilterPtr getFilter() const - { - return m_filter; - } - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void addTask(CalendarTaskPtr value) - { - m_tasks.push_back(value); - } - std::vector getTasks() - { - return m_tasks; - } - IEventFindTasks() : m_result(false), - m_firstTask(0), - m_lastTask(-1) - { - } - ~IEventFindTasks() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventFindTasksPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_FIND_TASKS_H_ diff --git a/src/modules/API/Task/IEventGetTasks.h b/src/modules/API/Task/IEventGetTasks.h deleted file mode 100644 index fdfcc03..0000000 --- a/src/modules/API/Task/IEventGetTasks.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventGetTasks.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_GET_TASKS_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_GET_TASKS_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventGetTasks : public Commons::IEvent -{ - std::vector m_tasks; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void addTask(ITaskPtr value) - { - m_tasks.push_back(value); - } - std::vector getTasks() const - { - return m_tasks; - } - IEventGetTasks() : - m_result(false) - { - } - ~IEventGetTasks() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventGetTasksPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_UPDATE_EVENT_H_ diff --git a/src/modules/API/Task/IEventUpdateTask.h b/src/modules/API/Task/IEventUpdateTask.h deleted file mode 100644 index f29dff7..0000000 --- a/src/modules/API/Task/IEventUpdateTask.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file IEventUpdateTask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_IEVENT_UPDATE_TASK_H_ -#define WRTDEVICEAPIS_TASK_IEVENT_UPDATE_TASK_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class IEventUpdateTask : public Commons::IEvent -{ - CalendarTaskPtr m_task; - bool m_result; - public: - void setResult(bool value) - { - m_result = value; - } - bool getResult() const - { - return m_result; - } - void setTask(CalendarTaskPtr value) - { - m_task = value; - } - CalendarTaskPtr getTask() const - { - return m_task; - } - - IEventUpdateTask() : - m_task(NULL), - m_result(false) - { - } - ~IEventUpdateTask() - { - } - virtual void clearOnCancel() - { - } -}; - -typedef DPL::SharedPtr IEventUpdateTaskPtr; - -} -} -} -#endif // WRTDEVICEAPIS_TASK_IEVENT_UPDATE_EVENT_H_ diff --git a/src/modules/API/Task/ITask.cpp b/src/modules/API/Task/ITask.cpp deleted file mode 100644 index c1a19e2..0000000 --- a/src/modules/API/Task/ITask.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ITask.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "ITask.h" -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -//thread pool -ITask::ITask() : - Commons::EventRequestReceiver( - Commons::ThreadEnum::TASK_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::TASK_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::TASK_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::TASK_THREAD), - Commons::EventRequestReceiver( - Commons::ThreadEnum::TASK_THREAD), - m_id(0), - m_accountId(0), - m_type(DEVICE_TASK) -{ -} - -ITask::~ITask() -{ -} - -void ITask::createTask(IEventCreateTaskPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ITask::addTask(IEventAddTaskPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ITask::updateTask(IEventUpdateTaskPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ITask::deleteTask(IEventDeleteTaskPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -void ITask::findTasks(IEventFindTasksPtr &event) -{ - Commons::EventRequestReceiver::PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Task/ITask.h b/src/modules/API/Task/ITask.h deleted file mode 100644 index 27d3f09..0000000 --- a/src/modules/API/Task/ITask.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ITask.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_ITASK_H_ -#define WRTDEVICEAPIS_TASK_ITASK_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class ITask : public Commons::EventRequestReceiver< IEventAddTask >, - public Commons::EventRequestReceiver< IEventDeleteTask>, - public Commons::EventRequestReceiver< IEventUpdateTask>, - public Commons::EventRequestReceiver< IEventFindTasks>, - public Commons::EventRequestReceiver< IEventCreateTask> -{ - public: - - typedef enum - { - SIM_TASK, - DEVICE_TASK - } TaskType; - - ITask(); - virtual ~ITask(); - virtual void createTask(IEventCreateTaskPtr &event); - virtual void addTask(IEventAddTaskPtr &event); - virtual void updateTask(IEventUpdateTaskPtr &event); - virtual void deleteTask(IEventDeleteTaskPtr &event); - virtual void findTasks(IEventFindTasksPtr &event); - - virtual std::string getName() const - { - return m_name; - } - virtual void setName(const std::string &value) - { - m_name = value; - } - virtual TaskType getType() const - { - return m_type; - } - virtual void setType(const TaskType value) - { - m_type = value; - } - virtual int getId() const - { - return m_id; - } - virtual void setId(const int value) - { - m_id = value; - } - virtual int getAccountId() const - { - return m_accountId; - } - virtual void setAccountId(const int value) - { - m_accountId = value; - } - protected: - int m_id; - int m_accountId; - std::string m_name; - TaskType m_type; - - virtual void OnRequestReceived(const IEventAddTaskPtr &event) = 0; - virtual void OnRequestReceived(const IEventDeleteTaskPtr &event) = 0; - virtual void OnRequestReceived(const IEventUpdateTaskPtr &event) = 0; - virtual void OnRequestReceived(const IEventFindTasksPtr &event) = 0; - virtual void OnRequestReceived(const IEventCreateTaskPtr &event) = 0; -}; - -typedef DPL::SharedPtr ITaskPtr; - -} -} -} - -#endif //WRTDEVICEAPIS_TASK_ITASK_H_ diff --git a/src/modules/API/Task/ITaskManager.cpp b/src/modules/API/Task/ITaskManager.cpp deleted file mode 100644 index 7232dd1..0000000 --- a/src/modules/API/Task/ITaskManager.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ITaskManager.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "ITaskManager.h" -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -ITaskManager::ITaskManager() : - Commons::EventRequestReceiver< IEventGetTasks>( - Commons::ThreadEnum::TASK_THREAD) -{ -} - -ITaskManager::~ITaskManager() -{ -} - -void ITaskManager::getTasks(const IEventGetTasksPtr &event) -{ - LogDebug("entered"); - PostRequest(event); -} - -} -} -} diff --git a/src/modules/API/Task/ITaskManager.h b/src/modules/API/Task/ITaskManager.h deleted file mode 100644 index bae6afd..0000000 --- a/src/modules/API/Task/ITaskManager.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ITaskManager.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_ITASK_MANAGER_H_ -#define WRTDEVICEAPIS_TASK_ITASK_MANAGER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class ITaskManager : public Commons::EventRequestReceiver< IEventGetTasks > -{ - public: - ITaskManager(); - virtual ~ITaskManager(); - virtual void getTasks(const IEventGetTasksPtr &event); - protected: - virtual void OnRequestReceived(const IEventGetTasksPtr &event) = 0; -}; - -typedef DPL::SharedPtr ITaskManagerPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_TASK_ITASK_MANAGER_H_ diff --git a/src/modules/API/Task/TaskFactory.cpp b/src/modules/API/Task/TaskFactory.cpp deleted file mode 100644 index 03a3992..0000000 --- a/src/modules/API/Task/TaskFactory.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskFactory.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "TaskFactory.h" -#include "ITaskManager.h" -#include "ITask.h" -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -ITaskManagerPtr TaskFactory::createTaskManagerObject() -{ - ITaskManagerPtr result(new TaskManager()); - return result; -} - -ITaskPtr TaskFactory::createTaskObject() -{ - ITaskPtr result(new Task()); - return result; -} - -TaskFactory& TaskFactory::getInstance() -{ - static TaskFactory theInstance; - return theInstance; -} - -} -} -} \ No newline at end of file diff --git a/src/modules/API/Task/TaskFactory.h b/src/modules/API/Task/TaskFactory.h deleted file mode 100644 index dc347b5..0000000 --- a/src/modules/API/Task/TaskFactory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskFactory.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_TASK_FACTORY_H_ -#define WRTDEVICEAPIS_TASK_TASK_FACTORY_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -class TaskFactory : private DPL::Noncopyable -{ - private: - TaskFactory() - { - } - public: - static TaskFactory& getInstance(); - ITaskManagerPtr createTaskManagerObject(); - ITaskPtr createTaskObject(); -}; - -} -} -} - -#endif // WRTDEVICEAPIS_TASK_TASK_FACTORY_H_ \ No newline at end of file diff --git a/src/modules/API/Task/TaskFilter.cpp b/src/modules/API/Task/TaskFilter.cpp deleted file mode 100644 index 10e7407..0000000 --- a/src/modules/API/Task/TaskFilter.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskFilter.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "TaskFilter.h" -#include - -/** - * @file TaskFilter.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -TaskFilter::TaskFilter() : - m_id(TASK_FILTER_UNDEFINED_ID), - m_taskId(TASK_FILTER_UNDEFINED_TASK_ID), - m_dueDateMin(TASK_FILTER_UNDEFINED_TIME_T_MEMBERS), - m_dueDateMax(TASK_FILTER_UNDEFINED_TIME_T_MEMBERS), - // m_priority(CalendarTask::UNDEFINED_PRIORITY), - // m_status(CalendarTask::UNDEFINED_STATUS), - m_status(new StatusList()), - m_priority(new PriorityList()), - m_descriptionIsSet(false), - m_subjectIsSet(false), - m_locationIsSet(false) -{ -} - -TaskFilter::~TaskFilter() -{ -} - -int TaskFilter::getIdFilter() const -{ - return m_id; -} - -void TaskFilter::setIdFilter(int value) -{ - m_id = value; -} - -int TaskFilter::getTaskIdFilter() const -{ - return m_taskId; -} - -void TaskFilter::setTaskIdFilter(int value) -{ - m_taskId = value; -} - -std::string TaskFilter::getDescriptionFilter() const -{ - return m_description; -} - -void TaskFilter::setDescriptionFilter(const std::string &value) -{ - m_description = value; - m_descriptionIsSet = true; -} - -std::string TaskFilter::getSubjectFilter() const -{ - return m_subject; -} - -void TaskFilter::setSubjectFilter(const std::string &value) -{ - m_subject = value; - m_subjectIsSet = true; -} - -time_t TaskFilter::getDueDateMinFilter() const -{ - return m_dueDateMin; -} - -time_t TaskFilter::getDueDateMaxFilter() const -{ - return m_dueDateMax; -} - -void TaskFilter::setDueDateMinFilter(time_t value) -{ - m_dueDateMin = value; -} - -void TaskFilter::setDueDateMaxFilter(time_t value) -{ - m_dueDateMax = value; -} - -void TaskFilter::setDueDateFilter(time_t value) -{ - setDueDateMinFilter(value); - setDueDateMaxFilter(value); -} - -PriorityListPtr TaskFilter::getPriorityFilter() const -{ - return m_priority; -} -void TaskFilter::setPriorityFilter(const PriorityListPtr &value) -{ - m_priority = value; -} - -StatusListPtr TaskFilter::getStatusFilter() const -{ - return m_status; -} -void TaskFilter::setStatusFilter(const StatusListPtr &value) -{ - m_status = value; -} - -//CalendarTask::TaskPriority TaskFilter::getPriorityFilter() const -//{ -// return m_priority; -//} - -//void TaskFilter::setPriorityFilter(CalendarTask::TaskPriority value ) -//{ -// m_priority = value; -//} - -//CalendarTask::TaskStatus TaskFilter::getStatusFilter() const -//{ -// return m_status; -//} - -//void TaskFilter::setStatusFilter(CalendarTask::TaskStatus value ) -//{ -// m_status = value; -//} - -bool TaskFilter::getIdIsSet() const -{ - return m_id != TASK_FILTER_UNDEFINED_ID; -} - -bool TaskFilter::getTaskIdIsSet() const -{ - return m_taskId != TASK_FILTER_UNDEFINED_TASK_ID; -} - -bool TaskFilter::getDescriptionIsSet() const -{ - return m_descriptionIsSet; -} - -bool TaskFilter::getSubjectIsSet() const -{ - return m_subjectIsSet; -} - -bool TaskFilter::getDueDateIsSet() const -{ - return (m_dueDateMin != TASK_FILTER_UNDEFINED_TIME_T_MEMBERS || - m_dueDateMax != TASK_FILTER_UNDEFINED_TIME_T_MEMBERS); -} - -//bool TaskFilter::getPriorityIsSet() const -//{ -// return m_priority != CalendarTask::UNDEFINED_PRIORITY; -//} - -//bool TaskFilter::getStatusIsSet() const -//{ -// return m_status != CalendarTask::UNDEFINED_STATUS; -//} - -bool TaskFilter::getPriorityIsSet() const -{ - if (m_priority) { - return m_priority->size() > 0; - } - return false; -} - -bool TaskFilter::getStatusIsSet() const -{ - if (m_status) { - return m_status->size() > 0; - } - return false; -} - -} -} -} diff --git a/src/modules/API/Task/TaskFilter.h b/src/modules/API/Task/TaskFilter.h deleted file mode 100644 index 06cc4b0..0000000 --- a/src/modules/API/Task/TaskFilter.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskFilter.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_TASK_FILTER_H_ -#define WRTDEVICEAPIS_TASK_TASK_FILTER_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Task { -namespace Api { - -const int TASK_FILTER_UNDEFINED_ID = -1; -const int TASK_FILTER_UNDEFINED_TASK_ID = -1; -const int TASK_FILTER_UNDEFINED_TIME_T_MEMBERS = -1; - -typedef std::vector StatusList; -typedef DPL::SharedPtr StatusListPtr; - -typedef std::vector PriorityList; -typedef DPL::SharedPtr PriorityListPtr; - -class TaskFilter -{ - public: - - TaskFilter(); - virtual ~TaskFilter(); - - int getIdFilter() const; - void setIdFilter(int value); - - int getTaskIdFilter() const; - void setTaskIdFilter(int value); - - std::string getDescriptionFilter() const; - void setDescriptionFilter(const std::string &value); - - std::string getSubjectFilter() const; - void setSubjectFilter(const std::string &value); - - time_t getDueDateMinFilter() const; - time_t getDueDateMaxFilter() const; - void setDueDateMinFilter(time_t value); - void setDueDateMaxFilter(time_t value); - void setDueDateFilter(time_t value); - - //CalendarTask::TaskPriority getPriorityFilter() const; - // void setPriorityFilter(CalendarTask::TaskPriority value ); - - // CalendarTask::TaskStatus getStatusFilter() const; - // void setStatusFilter(CalendarTask::TaskStatus value ); - - PriorityListPtr getPriorityFilter() const; - void setPriorityFilter(const PriorityListPtr &value); - - StatusListPtr getStatusFilter() const; - void setStatusFilter(const StatusListPtr &value); - - bool getIdIsSet() const; - bool getTaskIdIsSet() const; - bool getDescriptionIsSet() const; - bool getSubjectIsSet() const; - bool getDueDateIsSet() const; - bool getPriorityIsSet() const; - bool getStatusIsSet() const; - - protected: - int m_id; - int m_taskId; - std::string m_description; - std::string m_subject; - time_t m_dueDateMin; - time_t m_dueDateMax; - StatusListPtr m_status; - PriorityListPtr m_priority; - //CalendarTask::TaskStatus m_status; - //CalendarTask::TaskPriority m_priority; - - bool m_descriptionIsSet; - bool m_subjectIsSet; - bool m_locationIsSet; -}; - -typedef DPL::SharedPtr TaskFilterPtr; - -} -} -} - -#endif // WRTDEVICEAPIS_TASK_EVENT_FILTER_H_ diff --git a/src/modules/API/Task/config.cmake b/src/modules/API/Task/config.cmake deleted file mode 100644 index 284a7d3..0000000 --- a/src/modules/API/Task/config.cmake +++ /dev/null @@ -1,15 +0,0 @@ -get_current_path() - -set(API_TASK_PATH - ${CURRENT_PATH} - PARENT_SCOPE -) - -set(SRCS_API_TASK - ${CURRENT_PATH}/CalendarTask.cpp - ${CURRENT_PATH}/TaskFactory.cpp - ${CURRENT_PATH}/TaskFilter.cpp - ${CURRENT_PATH}/ITask.cpp - ${CURRENT_PATH}/ITaskManager.cpp - PARENT_SCOPE -) diff --git a/src/modules/API/Widget/WidgetFactory.cpp b/src/modules/API/Widget/WidgetFactory.cpp index be6dce3..b402256 100644 --- a/src/modules/API/Widget/WidgetFactory.cpp +++ b/src/modules/API/Widget/WidgetFactory.cpp @@ -29,9 +29,9 @@ namespace WrtDeviceApis { namespace Widget { namespace Api { -IWidgetPtr WidgetFactory::createWidget(const Commons::IWrtWrapperPtr& wrapper) +IWidgetPtr WidgetFactory::createWidget() { - return IWidgetPtr(new WrtDeviceApis::Widget::Widget(wrapper)); + return IWidgetPtr(new WrtDeviceApis::Widget::Widget()); } } diff --git a/src/modules/API/Widget/WidgetFactory.h b/src/modules/API/Widget/WidgetFactory.h index a4abffd..9773e78 100644 --- a/src/modules/API/Widget/WidgetFactory.h +++ b/src/modules/API/Widget/WidgetFactory.h @@ -26,7 +26,6 @@ #include #include -#include #include namespace WrtDeviceApis { @@ -41,7 +40,7 @@ class WidgetFactory : private DPL::Noncopyable * Create widget * @param[in] id of the widget */ - static IWidgetPtr createWidget(const Commons::IWrtWrapperPtr& wrapper); + static IWidgetPtr createWidget(); private: WidgetFactory() diff --git a/src/modules/API/config.cmake b/src/modules/API/config.cmake new file mode 100644 index 0000000..82b25da --- /dev/null +++ b/src/modules/API/config.cmake @@ -0,0 +1,3 @@ +include_config_file(Widget) +include_config_file(StorageEvent) +include_config_file(LocalStorage) \ No newline at end of file diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 85db759..0d64dbb 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -17,6 +17,9 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM} ) +include_config_file(API) +include_config_file(${PLATFORM}) + add_subdirectory(API) add_subdirectory(${PLATFORM}) add_subdirectory(packages) diff --git a/src/modules/packages/Accelerometer/CMakeLists.txt b/src/modules/packages/Accelerometer/CMakeLists.txt deleted file mode 100644 index 8270571..0000000 --- a/src/modules/packages/Accelerometer/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_ACCELEROMETER_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Accelerometer) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_ACCELEROMETER}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_ACCELEROMETER} -) - -set(SRCS - ${SRCS_API_ACCELEROMETER} - ${SRCS_PLATFORM_IMPLEMENTATION_ACCELEROMETER} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_ACCELEROMETER} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(AccelerationProperties.h) -install_header_file(AccelerometerFactory.h) -install_header_file(EventAccelerationChanged.h) -install_header_file(EventGetCurrentAcceleration.h) -install_header_file(IAccelerometer.h) -install_header_file(ISensor.h) diff --git a/src/modules/packages/CMakeLists.txt b/src/modules/packages/CMakeLists.txt index 295a0e6..d0e7100 100644 --- a/src/modules/packages/CMakeLists.txt +++ b/src/modules/packages/CMakeLists.txt @@ -36,21 +36,9 @@ set(TARGET_MODULE_WIDGETDB "wrt-plugins-widgetdb") set(TARGET_MODULE_PLUGIN_MANAGER "wrt-plugins-plugin-manager") add_subdirectory(Filesystem) -add_subdirectory(Camera) -add_subdirectory(Calendar) -add_subdirectory(Messaging) -add_subdirectory(Haptics) -add_subdirectory(Contact) add_subdirectory(MMPlayer) add_subdirectory(Cpu) -add_subdirectory(Accelerometer) add_subdirectory(Widget) -add_subdirectory(Task) -add_subdirectory(Orientation) -add_subdirectory(Radio) -add_subdirectory(Power) -add_subdirectory(Profile) -add_subdirectory(SystemInfo) add_subdirectory(LocalStorage) add_subdirectory(WidgetInterfaceDAO) add_subdirectory(StorageEvent) diff --git a/src/modules/packages/Calendar/CMakeLists.txt b/src/modules/packages/Calendar/CMakeLists.txt deleted file mode 100644 index 307ee8e..0000000 --- a/src/modules/packages/Calendar/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_CALENDAR_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Calendar) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_CALENDAR}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_CALENDAR} -) - -set(SRCS - ${SRCS_API_CALENDAR} - ${SRCS_PLATFORM_IMPLEMENTATION_CALENDAR} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_CALENDAR} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(ICalendar.h) -install_header_file(ICalendarManager.h) -install_header_file(CalendarEvent.h) -install_header_file(CalendarFactory.h) -install_header_file(EventAddEvent.h) -install_header_file(EventCreateEvent.h) -install_header_file(EventDeleteEvent.h) -install_header_file(EventFilter.h) -install_header_file(EventFindEvents.h) -install_header_file(EventGetCalendars.h) -install_header_file(EventUpdateEvent.h) diff --git a/src/modules/packages/Camera/CMakeLists.txt b/src/modules/packages/Camera/CMakeLists.txt deleted file mode 100644 index 6562e34..0000000 --- a/src/modules/packages/Camera/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_CAMERA_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Camera) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_CAMERA}) - -pkg_search_module(wrt-plugin-api REQUIRED wrt-plugin-api>=0.7.0) - -include_directories( ${wrt-plugin-api_INCLUDE_DIRS}) - -set(SRCS - ${SRCS_API_CAMERA} - ${SRCS_PLATFORM_IMPLEMENTATION_CAMERA} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(CameraFactory.h) -install_header_file(EventBeginRecording.h) -install_header_file(EventEndRecording.h) -install_header_file(EventGetCameras.h) -install_header_file(EventGetPreviewNode.h) -install_header_file(EventTakePicture.h) -install_header_file(ICamera.h) -install_header_file(ICameraFeature.h) -install_header_file(ICameraManager.h) -install_header_file(ICaptureOptions.h) -install_header_file(IFeatureValue.h) -install_header_file(SupportCameraPendingOperation.h) diff --git a/src/modules/packages/Contact/CMakeLists.txt b/src/modules/packages/Contact/CMakeLists.txt deleted file mode 100644 index ad6e040..0000000 --- a/src/modules/packages/Contact/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_CONTACT_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Contact) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_CONTACT}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_CONTACT} -) - -set(SRCS - ${SRCS_API_CONTACT} - ${SRCS_PLATFORM_IMPLEMENTATION_CONTACT} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_CONTACT} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(ContactAddress.h) -install_header_file(ContactEmail.h) -install_header_file(ContactFactory.h) -install_header_file(ContactFilter.h) -install_header_file(Contact.h) -install_header_file(ContactPhoneNumber.h) -install_header_file(EventAddContact.h) -install_header_file(EventAddGroup.h) -install_header_file(EventDeleteContact.h) -install_header_file(EventDeleteGroup.h) -install_header_file(EventExportVCard.h) -install_header_file(EventFindContacts.h) -install_header_file(EventFindGroup.h) -install_header_file(EventGetAddressBookItemCount.h) -install_header_file(EventGetAddressBooks.h) -install_header_file(EventGetOwnerInfo.h) -install_header_file(EventUpdateContact.h) -install_header_file(IAddressBook.h) -install_header_file(IContactEventPrivateData.h) -install_header_file(IContactManager.h) diff --git a/src/modules/packages/Cpu/CMakeLists.txt b/src/modules/packages/Cpu/CMakeLists.txt index cd238df..5ace91c 100644 --- a/src/modules/packages/Cpu/CMakeLists.txt +++ b/src/modules/packages/Cpu/CMakeLists.txt @@ -34,7 +34,10 @@ target_link_libraries(${TARGET_NAME} ${TARGET_COMMONS} ${LIBS_PLATFORM_IMPLEMENTATION_CPU} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/Filesystem/CMakeLists.txt b/src/modules/packages/Filesystem/CMakeLists.txt index 1944f08..e5079dc 100644 --- a/src/modules/packages/Filesystem/CMakeLists.txt +++ b/src/modules/packages/Filesystem/CMakeLists.txt @@ -29,7 +29,10 @@ target_link_libraries(${TARGET_NAME} ${LIBS_COMMONS} ${TARGET_COMMONS} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/Haptics/CMakeLists.txt b/src/modules/packages/Haptics/CMakeLists.txt deleted file mode 100644 index e45a888..0000000 --- a/src/modules/packages/Haptics/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_HAPTICS_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Haptics) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_HAPTICS}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_HAPTICS} -) - -set(SRCS - ${SRCS_API_HAPTICS} - ${SRCS_PLATFORM_IMPLEMENTATION_HAPTICS} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) - -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_HAPTICS} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(EventPlayBeep.h) -install_header_file(EventStartMotor.h) -install_header_file(HapticPattern.h) -install_header_file(IManager.h) -install_header_file(IMotor.h) -install_header_file(Types.h) - diff --git a/src/modules/packages/LocalStorage/CMakeLists.txt b/src/modules/packages/LocalStorage/CMakeLists.txt index abb3854..2b0a894 100644 --- a/src/modules/packages/LocalStorage/CMakeLists.txt +++ b/src/modules/packages/LocalStorage/CMakeLists.txt @@ -12,29 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_LOCALSTORAGE_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/LocalStorage) -endmacro() - set(TARGET_NAME ${TARGET_MODULE_LOCALSTORAGE}) set(SRCS ${SRCS_API_LOCALSTORAGE} ) -add_library(${TARGET_NAME} SHARED ${SRCS}) +add_library(${TARGET_NAME} STATIC ${SRCS}) target_link_libraries(${TARGET_NAME} ${LIBS_COMMONS} ${TARGET_COMMONS} ${TARGET_MODULE_WIDGET_INTERFACE_DAO} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(ILocalStorage.h) -install_header_file(LocalStorageMgr.h) diff --git a/src/modules/packages/MMPlayer/CMakeLists.txt b/src/modules/packages/MMPlayer/CMakeLists.txt index 9af9844..11af869 100644 --- a/src/modules/packages/MMPlayer/CMakeLists.txt +++ b/src/modules/packages/MMPlayer/CMakeLists.txt @@ -34,7 +34,10 @@ target_link_libraries(${TARGET_NAME} ${TARGET_COMMONS} ${LIBS_PLATFORM_IMPLEMENTATION_MMPLAYER} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/Messaging/CMakeLists.txt b/src/modules/packages/Messaging/CMakeLists.txt deleted file mode 100644 index a959037..0000000 --- a/src/modules/packages/Messaging/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_MESSAGING_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Messaging) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_MESSAGING}) - -include_directories(${INCLUDES_MESSAGING_DIRECTORIES}) - -set(SRCS - ${SRCS_API_MESSAGING} - ${SRCS_IMPLEMENTATION_MESSAGING} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) - -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${LIBS_IMPLEMENTATION_MESSAGING} - ${TARGET_COMMONS} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(AttachmentFactory.h) -install_header_file(Attachments.h) -install_header_file(BccRecipient.h) -install_header_file(Body.h) -install_header_file(CallbackNumber.h) -install_header_file(CcRecipient.h) -install_header_file(EmailAccountInfo.h) -install_header_file(EmitterMessageReceived.h) -install_header_file(EventDeleteMessage.h) -install_header_file(EventFindMessage.h) -install_header_file(EventMessageReceived.h) -install_header_file(EventOnSendingFailed.h) -install_header_file(EventSendMessage.h) -install_header_file(EventUpdateMessage.h) -install_header_file(From.h) -install_header_file(IAttachment.h) -install_header_file(IBinarySms.h) -install_header_file(IEmailAccount.h) -install_header_file(IEmail.h) -install_header_file(IMessage.h) -install_header_file(IMessaging.h) -install_header_file(IMessagingTypes.h) -install_header_file(IMms.h) -install_header_file(IMmsSlide.h) -install_header_file(IMmsSlideProperties.h) -install_header_file(IMmsSlides.h) -install_header_file(ISms.h) -install_header_file(MessageEventPrivateData.h) -install_header_file(MessageFactory.h) -install_header_file(MessageFilter.h) -install_header_file(MessagePriority.h) -install_header_file(MmsSlide.h) -install_header_file(MmsSlideProperty.h) -install_header_file(MmsSlides.h) -install_header_file(Recipient.h) -install_header_file(ReqReceiverMessage.h) -install_header_file(SourceAddress.h) -install_header_file(Subject.h) -install_header_file(ToRecipient.h) -install_header_file(ValidityPeriodHours.h) -install_header_file(VirtualMessage.h) diff --git a/src/modules/packages/Networking/CMakeLists.txt b/src/modules/packages/Networking/CMakeLists.txt index 5dcb9a5..9de7e04 100644 --- a/src/modules/packages/Networking/CMakeLists.txt +++ b/src/modules/packages/Networking/CMakeLists.txt @@ -35,7 +35,10 @@ target_link_libraries(${TARGET_NAME} ${TARGET_COMMONS} ${LIBS_PLATFORM_IMPLEMENTATION_NETWORKING} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/Orientation/CMakeLists.txt b/src/modules/packages/Orientation/CMakeLists.txt deleted file mode 100644 index 6cf0503..0000000 --- a/src/modules/packages/Orientation/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_ORIENTATION_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Orientation) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_ORIENTATION}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_ORIENTATION} -) - -set(SRCS - ${SRCS_API_ORIENTATION} - ${SRCS_PLATFORM_IMPLEMENTATION_ORIENTATION} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_ORIENTATION} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(EventGetCurrentOrientation.h) -install_header_file(EventOrientationChanged.h) -install_header_file(IOrientation.h) -install_header_file(OrientationFactory.h) -install_header_file(OrientationProperties.h) diff --git a/src/modules/packages/PluginManager/CMakeLists.txt b/src/modules/packages/PluginManager/CMakeLists.txt index 5f319b0..696216b 100644 --- a/src/modules/packages/PluginManager/CMakeLists.txt +++ b/src/modules/packages/PluginManager/CMakeLists.txt @@ -42,7 +42,10 @@ target_link_libraries(${TARGET_NAME} ${LIBS_PLATFORM_IMPLEMENTATION_PLUGIN_MANAGER} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/Power/CMakeLists.txt b/src/modules/packages/Power/CMakeLists.txt deleted file mode 100644 index 3534dea..0000000 --- a/src/modules/packages/Power/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_POWER_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Power) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_POWER}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_POWER} -) - -set(SRCS - ${SRCS_API_POWER} - ${SRCS_PLATFORM_IMPLEMENTATION_POWER} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_POWER} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(Enums.h) -install_header_file(EventCharging.h) -install_header_file(EventLight.h) -install_header_file(EventLow.h) -install_header_file(EventRemaining.h) -install_header_file(IBacklight.h) -install_header_file(IBattery.h) -install_header_file(IManager.h) diff --git a/src/modules/packages/Profile/CMakeLists.txt b/src/modules/packages/Profile/CMakeLists.txt deleted file mode 100644 index 56477c6..0000000 --- a/src/modules/packages/Profile/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_PROFILE_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Profile) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_PROFILE}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_PROFILE} -) - -set(SRCS - ${SRCS_API_PROFILE} - ${SRCS_PLATFORM_IMPLEMENTATION_PROFILE} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) - -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_PROFILE} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(EventSetWallpaper.h) -install_header_file(IDesktop.h) -install_header_file(IRingtone.h) -install_header_file(Types.h) -install_header_file(IManager.h) -install_header_file(Enums.h) diff --git a/src/modules/packages/Radio/CMakeLists.txt b/src/modules/packages/Radio/CMakeLists.txt deleted file mode 100644 index a0e86af..0000000 --- a/src/modules/packages/Radio/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_RADIO_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Radio) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_RADIO}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_RADIO} -) - -set(SRCS - ${SRCS_API_RADIO} - ${SRCS_PLATFORM_IMPLEMENTATION_RADIO} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) - -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_RADIO} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(Enums.h) -install_header_file(EventSourceTypeChange.h) -install_header_file(IManager.h) -install_header_file(ISource.h) -install_header_file(Types.h) diff --git a/src/modules/packages/StorageEvent/CMakeLists.txt b/src/modules/packages/StorageEvent/CMakeLists.txt index 1cc3ac9..dc9ff0d 100644 --- a/src/modules/packages/StorageEvent/CMakeLists.txt +++ b/src/modules/packages/StorageEvent/CMakeLists.txt @@ -12,27 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_STORAGE_EVENT_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/StorageEvent) -endmacro() - set(TARGET_NAME ${TARGET_MODULE_STORAGEEVENT}) set(SRCS ${SRCS_API_STORAGE_EVENT} ) -add_library(${TARGET_NAME} SHARED ${SRCS}) +add_library(${TARGET_NAME} STATIC ${SRCS}) target_link_libraries(${TARGET_NAME} ${TARGET_MODULE_LOCALSTORAGE} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(IStorageEvent.h) -install_header_file(StorageEventMgr.h) diff --git a/src/modules/packages/SystemInfo/CMakeLists.txt b/src/modules/packages/SystemInfo/CMakeLists.txt deleted file mode 100644 index 2683731..0000000 --- a/src/modules/packages/SystemInfo/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_SYSTEMINFO_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/SystemInfo) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_SYSTEMINFO}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_SYSTEMINFO} -) - -set(SRCS - ${SRCS_API_SYSTEMINFO} - ${SRCS_PLATFORM_IMPLEMENTATION_SYSTEMINFO} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -#add_library(${TARGET_NAME} STATIC ${SRCS}) - -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_SYSTEMINFO} -) -set_target_properties(${TARGET_NAME} PROPERTIES VERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(ISystemInfo.h) diff --git a/src/modules/packages/Task/CMakeLists.txt b/src/modules/packages/Task/CMakeLists.txt deleted file mode 100644 index 402e813..0000000 --- a/src/modules/packages/Task/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_TASK_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Task) -endmacro() - -set(TARGET_NAME ${TARGET_MODULE_TASK}) - -include_directories( - ${INCLUDES_PLATFORM_IMPLEMENTATION_TASK} -) - -set(SRCS - ${SRCS_API_TASK} - ${SRCS_PLATFORM_IMPLEMENTATION_TASK} -) - -add_library(${TARGET_NAME} SHARED ${SRCS}) -target_link_libraries(${TARGET_NAME} - ${LIBS_COMMONS} - ${TARGET_COMMONS} - ${LIBS_PLATFORM_IMPLEMENTATION_TASK} -) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) - -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - - -install_header_file(CalendarTask.h) -install_header_file(IEventAddTask.h) -install_header_file(IEventCreateTask.h) -install_header_file(IEventDeleteTask.h) -install_header_file(IEventFindTasks.h) -install_header_file(IEventGetTasks.h) -install_header_file(IEventUpdateTask.h) -install_header_file(ITask.h) -install_header_file(ITaskManager.h) -install_header_file(TaskFactory.h) -install_header_file(TaskFilter.h) diff --git a/src/modules/packages/Widget/CMakeLists.txt b/src/modules/packages/Widget/CMakeLists.txt index f0aa421..74bf1a6 100644 --- a/src/modules/packages/Widget/CMakeLists.txt +++ b/src/modules/packages/Widget/CMakeLists.txt @@ -12,10 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -macro(install_header_file HEADER_FILE) - INSTALL(FILES ${API_WIDGET_PATH}/${HEADER_FILE} - DESTINATION ${DESTINATION_HEADER_PREFIX}/Widget) -endmacro() set(TARGET_NAME ${TARGET_MODULE_WIDGET}) @@ -24,17 +20,11 @@ set(SRCS ${SRCS_IMPLEMENTATION_WIDGET} ) -add_library(${TARGET_NAME} SHARED ${SRCS}) +add_library(${TARGET_NAME} STATIC ${SRCS}) target_link_libraries(${TARGET_NAME} ${LIBS_COMMONS} ${TARGET_COMMONS} ${TARGET_MODULE_WIDGETDB} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) -INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION - ${DESTINATION_LIB_PREFIX}) - -install_header_file(IWidget.h) -install_header_file(WidgetFactory.h) diff --git a/src/modules/packages/WidgetDB/CMakeLists.txt b/src/modules/packages/WidgetDB/CMakeLists.txt index 63d9cea..ec91fdb 100644 --- a/src/modules/packages/WidgetDB/CMakeLists.txt +++ b/src/modules/packages/WidgetDB/CMakeLists.txt @@ -36,7 +36,10 @@ target_link_libraries(${TARGET_NAME} ${TARGET_COMMONS} ${LIBS_PLATFORM_IMPLEMENTATION_WIDGETDB} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/packages/WidgetInterfaceDAO/CMakeLists.txt b/src/modules/packages/WidgetInterfaceDAO/CMakeLists.txt index cb77604..2a6d20e 100644 --- a/src/modules/packages/WidgetInterfaceDAO/CMakeLists.txt +++ b/src/modules/packages/WidgetInterfaceDAO/CMakeLists.txt @@ -39,7 +39,10 @@ target_link_libraries(${TARGET_NAME} ${dpl-db_LIBRARIES} ${dpl-wrt-dao-ro_LIBRARIES} ) -set_target_properties(${TARGET_NAME} PROPERTIES SOVERSION ${CMAKE_PACKAGE_VERSION}) +set_target_properties(${TARGET_NAME} PROPERTIES + SOVERSION ${CMAKE_PROJECT_API_VERSION} + VERSION ${CMAKE_PROJECT_VERSION} +) INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DESTINATION_LIB_PREFIX}) diff --git a/src/modules/tizen/Accelerometer/Accelerometer.cpp b/src/modules/tizen/Accelerometer/Accelerometer.cpp deleted file mode 100644 index 9fedeb4..0000000 --- a/src/modules/tizen/Accelerometer/Accelerometer.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file Accelerometer.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include -#include -#include "Accelerometer.h" - -using namespace DPL; - -namespace WrtDeviceApis { -namespace Accelerometer { - -using namespace Api; - -namespace { -/** - * Callback method called by platform as interval time. - * @param event_type Platform accelerometer evet type - * @param event Platform sensor event data - * @param this_ User data pointer. - */ -static void accelerationChangedCallback(unsigned int event_type, - sensor_event_data_t *event, - void *watcher_ptr) -{ - LogDebug("Callback accelerationChangedCallback."); - if (watcher_ptr) { - if (event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME && - event != NULL) { - ((Accelerometer::Watcher*)watcher_ptr)->accelerationHasChanged( - event); - } - } else { - LogError("Callback private data is NULL."); - } -} -} //private namespace - -Accelerometer::Accelerometer() : - m_handle(-1), - m_initialized(false), - m_isWatch(false) -{ - LogDebug("Platform::Accelerometer Enter"); -} - -Accelerometer::~Accelerometer() -{ - LogDebug("Platform::~Accelerometer Enter"); - - if (m_initialized == true) { - stop(m_handle); - } - - LogDebug("All watchers : (" << m_watchers.size() << ")"); - std::vector::iterator it; - for (it = m_watchers.begin(); it != m_watchers.end(); ++it) { - stop((*it)->getHandle(), true); - } - m_watchers.clear(); - LogDebug("All watchers were cleared. (" << m_watchers.size() << ")"); -} - -void Accelerometer::getCurrentAcceleration( - const EventGetCurrentAccelerationPtr& event) -{ - if (m_initialized == false) { - m_handle = initialize(); - start(m_handle); - m_initialized = true; - } - EventRequestReceiver::PostRequest(event); -} - -void Accelerometer::OnRequestReceived( - const EventGetCurrentAccelerationPtr& event) -{ - LogDebug("Enter"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - /** - *Invoke platform API sf_get_data gets raw data from a sensor with connecting the sensor-server. - * The type of sensor is supplied and return data is stored in the output parameter values []. - */ - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - LogError("Can't get current Acceleration. "); - Throw(Commons::PlatformException); - return; - } - event->setXAxis(static_cast(data.values[0])); - event->setYAxis(static_cast(data.values[1])); - event->setZAxis(static_cast(data.values[2])); -} - -long Accelerometer::watchAcceleration( - const EventAccelerationChangedEmitterPtr& emitter, - long minNotificationInterval) -{ - LogDebug("Enter"); - int new_handle = initialize(); - - event_condition_t* condition = NULL; - event_condition_t conditionData; - - if (minNotificationInterval > 0) { - conditionData.cond_op = CONDITION_EQUAL; - conditionData.cond_value1 = minNotificationInterval; - condition = &conditionData; - } - - /** - * Invoke platform API sf_register_event registers a user defined callback function with a connected sensor for a particular event. - **This callback function will be called when there is a change in the state of respective sensor. - **cb_data will be the parameter used during the callback call. - **Callback interval can be adjusted using even_contion_t argument. - */ - - WatcherPtr watcher(new Watcher(new_handle, emitter)); - - int sensor_state = sf_register_event( - watcher->getHandle(), - ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, condition, - accelerationChangedCallback, watcher.Get()); - if (sensor_state < 0) { - stop(watcher->getHandle()); - Throw(Commons::PlatformException); - } - - start(watcher->getHandle()); - - m_isWatch = true; - m_watchers.push_back(watcher); - LogDebug("Watcher is added. (" << m_watchers.size() << ")"); - watcher->getCurrentAccelerationForWatch(); - - return static_cast(emitter->getId()); -} - -void Accelerometer::clearWatch(EventAccelerationChangedEmitter::IdType id) -{ - LogDebug("Enter"); - - std::vector::iterator it; - for (it = m_watchers.begin(); it != m_watchers.end(); ++it) { - if (id == (*it)->getEmitter()->getId()) { - stop((*it)->getHandle(), true); - - m_watchers.erase(it); - LogDebug("Watcher is removed. (" << m_watchers.size() << ")"); - - if (m_watchers.size() == 0) { - m_isWatch = false; - } - break; - } - } -} - -void Accelerometer::getCurrentAccelerationForWatch(void) -{ - LogDebug("Enter"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - Throw(Commons::PlatformException); - } - - EventAccelerationChangedPtr event(new EventAccelerationChanged()); - AccelerationProperties props; - props.xAxis = static_cast(data.values[0]); - props.yAxis = static_cast(data.values[1]); - props.zAxis = static_cast(data.values[2]); - - event->setAccelerationProperties(props); - - m_AccelerationEmitters.emit(event); -} - -void Accelerometer::accelerationHasChanged(sensor_event_data_t *sensorEvent) -{ - LogDebug("Enter"); - sensor_data_t *sensor_data = NULL; - sensor_data = (sensor_data_t *)sensorEvent->event_data; - if (sensor_data == NULL || - (sensor_data->values_num < 3)) { - LogError("Can't get current Acceleration. "); - Throw(Commons::PlatformException); - return; - } - - EventAccelerationChangedPtr event(new EventAccelerationChanged()); - AccelerationProperties props; - props.xAxis = static_cast(sensor_data->values[0]); - props.yAxis = static_cast(sensor_data->values[1]); - props.zAxis = static_cast(sensor_data->values[2]); - LogDebug( - "xAxis:" << sensor_data->values[0] << ",yAxis:" << - sensor_data->values[1] << ",zAxis:" << sensor_data->values[2]); - - event->setAccelerationProperties(props); - - m_AccelerationEmitters.emit(event); -} - -int Accelerometer::initialize() -{ - LogDebug("Enter"); - DPL::Mutex::ScopedLock lock(&m_initializationMutex); - int handle = sf_connect(ACCELEROMETER_SENSOR); - - if (handle < 0) { - LogError("Could not connect with accelerometer sensor."); - Throw(Commons::UnsupportedException); - } - - return handle; -} - -void Accelerometer::restart(int& handle) -{ - stop(handle); - start(handle); -} - -void Accelerometer::start(int handle) -{ - LogDebug("Enter"); - if (sf_start(handle, 0) < 0) { - LogError("Could not start communication with sensor."); - if (handle >= 0) { - sf_disconnect(handle); - Throw(Commons::UnsupportedException); - } - } -} - -void Accelerometer::stop(int& handle, - bool isWatcherHandle) -{ - LogDebug("Enter"); - - if (handle >= 0) { - if (isWatcherHandle == true) { - LogError("unregister event sensor."); - sf_unregister_event(handle, - ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); - } - sf_stop(handle); - sf_disconnect(handle); - handle = -1; - } -} - -//Watcher's -void Accelerometer::Watcher::getCurrentAccelerationForWatch() -{ - LogDebug("Enter"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - Throw(Commons::PlatformException); - } - - EventAccelerationChangedPtr event(new EventAccelerationChanged()); - AccelerationProperties props; - props.xAxis = static_cast(data.values[0]); - props.yAxis = static_cast(data.values[1]); - props.zAxis = static_cast(data.values[2]); - - event->setAccelerationProperties(props); - - emit(event); -} - -//Watcher's -void Accelerometer::Watcher::accelerationHasChanged( - sensor_event_data_t *sensorEvent) -{ - LogDebug("Enter"); - sensor_data_t *sensor_data = NULL; - sensor_data = (sensor_data_t *)sensorEvent->event_data; - if (sensor_data == NULL || - (sensor_data->values_num < 3)) { - LogError("Can't get current Acceleration. "); - Throw(Commons::PlatformException); - return; - } - - EventAccelerationChangedPtr event(new EventAccelerationChanged()); - AccelerationProperties props; - props.xAxis = static_cast(sensor_data->values[0]); - props.yAxis = static_cast(sensor_data->values[1]); - props.zAxis = static_cast(sensor_data->values[2]); - LogDebug( - "xAxis:" << sensor_data->values[0] << ",yAxis:" << - sensor_data->values[1] << ",zAxis:" << sensor_data->values[2]); - - event->setAccelerationProperties(props); - - emit(event); -} - -} -} diff --git a/src/modules/tizen/Accelerometer/Accelerometer.h b/src/modules/tizen/Accelerometer/Accelerometer.h deleted file mode 100644 index 5ab6c23..0000000 --- a/src/modules/tizen/Accelerometer/Accelerometer.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file Accelerometer.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_ACCELEROMETER_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_ACCELEROMETER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { - -class Accelerometer : public Api::IAccelerometer -{ - int m_handle; - gulong m_signalId; - - /** - * @See: IgetCurrentAcceleration - */ - friend class Api::AccelerometerFactory; - - public: - class Watcher - { - private: - int m_handle; - Api::EventAccelerationChangedEmitterPtr m_emitter; - - public: - Watcher( - int handle, - const Api::EventAccelerationChangedEmitterPtr& - emitter) : - m_handle(handle), - m_emitter(emitter) - { - } - - int& getHandle() - { - return m_handle; - } - - Api::EventAccelerationChangedEmitterPtr getEmitter() - { - return m_emitter; - } - - void emit(const Api::EventAccelerationChangedPtr& event) - { - m_emitter->emit(event); - } - void getCurrentAccelerationForWatch(); - void accelerationHasChanged(sensor_event_data_t *sensorEvent); - }; - typedef DPL::SharedPtr WatcherPtr; - - public: - virtual ~Accelerometer(); - - /** - * @See: IgetCurrentAcceleration - */ - virtual void getCurrentAcceleration( - const Api::EventGetCurrentAccelerationPtr& event); - - /** - * @See: IwatchAcceleration - */ - virtual long watchAcceleration( - const Api::EventAccelerationChangedEmitterPtr& - emitter, - long minNotificationInterval); - - /** - * @See: IclearWatch - */ - virtual void clearWatch( - Api::EventAccelerationChangedEmitter::IdType id); - - /** - * Method to run from platform's callback function - */ - void accelerationHasChanged(sensor_event_data_t *sensorEvent); - - /** - * Method to run currentAcceleration for watch function - */ - - void getCurrentAccelerationForWatch(); - - protected: - Accelerometer(); - virtual void OnRequestReceived( - const Api::EventGetCurrentAccelerationPtr& event); - - private: - typedef Commons::Emitters - AccelerationChangedEmitters; - - /** - * Initialize accelerometer sensor. This method returns when platform error occurs. - */ - int initialize(); - - /** - * Start accelerometer sensor. This method sends a start command to sensor server. - */ - void start(int handle); - - /** - * Stop accelerometer sensor. This method sends a stop command to sensor server. - */ - void stop(int& handle, bool isWatcherHandle = false); - - /** - * Method to restart accelerometer sensor server. - */ - void restart(int& handle); - - AccelerationChangedEmitters m_AccelerationEmitters; - DPL::Mutex m_initializationMutex; - bool m_initialized; - bool m_isWatch; - - std::vector m_watchers; -}; - -} -} - -#endif // WRTDEVICEAPIS_ACCELEROMETER_ACCELEROMETER_H_ diff --git a/src/modules/tizen/Accelerometer/Sensor.cpp b/src/modules/tizen/Accelerometer/Sensor.cpp deleted file mode 100644 index 995b060..0000000 --- a/src/modules/tizen/Accelerometer/Sensor.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Sensor.h" -#include -#include -#include - -namespace WrtDeviceApis { -namespace Accelerometer { - -Sensor& Sensor::getInstance() -{ - static Sensor instance; - return instance; -} - -double Sensor::getX() const -{ - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 1)) - { - Throw(Commons::PlatformException); - } - return data.values[0]; -} - -double Sensor::getY() const -{ - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 2)) - { - Throw(Commons::PlatformException); - } - return data.values[1]; -} - -double Sensor::getZ() const -{ - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, ACCELEROMETER_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) - { - Throw(Commons::PlatformException); - } - return data.values[2]; -} - -Sensor::Sensor() -{ - m_handle = sf_connect(ACCELEROMETER_SENSOR); - if (m_handle < 0) { - LogError("Could not connect with accelerometer sensor."); - } else if (sf_start(m_handle, 0) < 0) { - LogError("Could not start communication with sensor."); - } -} - -Sensor::~Sensor() -{ - if (m_handle >= 0) { - sf_stop(m_handle); - sf_disconnect(m_handle); - } -} - -} // Accelerometer -} // WrtDeviceApis diff --git a/src/modules/tizen/Accelerometer/Sensor.h b/src/modules/tizen/Accelerometer/Sensor.h deleted file mode 100644 index f3f7c19..0000000 --- a/src/modules/tizen/Accelerometer/Sensor.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_ACCELEROMETER_SENSOR_H_ -#define WRTDEVICEAPIS_ACCELEROMETER_SENSOR_H_ - -#include - -namespace WrtDeviceApis { -namespace Accelerometer { - -class Sensor : public Api::ISensor -{ - public: - /** - * @see WrtDeviceApis::Api::ISensor::getInstance() - */ - static Sensor& getInstance(); - - public: - ~Sensor(); - - /** - * @see WrtDeviceApis::Api::ISensor::getX() - */ - double getX() const; - - /** - * @see WrtDeviceApis::Api::ISensor::getY() - */ - double getY() const; - - /** - * @see WrtDeviceApis::Api::ISensor::getZ() - */ - double getZ() const; - - private: - Sensor(); - - private: - int m_handle; ///< Sensor handle. -}; - -} // Accelerometer -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_ACCELEROMETER_SENSOR_H_ diff --git a/src/modules/tizen/Accelerometer/config.cmake b/src/modules/tizen/Accelerometer/config.cmake deleted file mode 100644 index d377070..0000000 --- a/src/modules/tizen/Accelerometer/config.cmake +++ /dev/null @@ -1,19 +0,0 @@ -get_current_path() - -pkg_search_module(sensor REQUIRED sensor) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_ACCELEROMETER - ${sensor_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_ACCELEROMETER - ${sensor_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_ACCELEROMETER - ${CURRENT_PATH}/Sensor.cpp - ${CURRENT_PATH}/Accelerometer.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/CMakeLists.txt b/src/modules/tizen/CMakeLists.txt index fbecc49..f805b14 100644 --- a/src/modules/tizen/CMakeLists.txt +++ b/src/modules/tizen/CMakeLists.txt @@ -20,29 +20,12 @@ # in which this modules and AL modules are included is significant, i.e. VConf # needs to be included before Power as there are some CMake variables set that # are used in Power config.cmake file. - -include_config_file(VConf) -include_config_file(DBus) - - ################################################################################ -include_config_file(Calendar) -include_config_file(Camera-Webkit) -include_config_file(Contact) include_config_file(Filesystem) -include_config_file(Messaging) -include_config_file(Haptics) include_config_file(Cpu) -include_config_file(Power) include_config_file(MMPlayer) -include_config_file(Accelerometer) -include_config_file(Profile) include_config_file(Widget) -include_config_file(Radio) -include_config_file(Orientation) -include_config_file(Task) -include_config_file(SystemInfo) include_config_file(LocalStorage) include_config_file(WidgetInterfaceDAO) add_subdirectory(WidgetInterfaceDAO) @@ -52,7 +35,7 @@ include_config_file(PluginManager) #include_config_file(Networking) #include_config_file(Geolocation) #include_config_file(FeatureLoader) -##include_config_file(Camera) +#include_config_file(Camera-Webkit) ##include_config_file(Telephony) #include_config_file(Display) #include_config_file(Gallery) diff --git a/src/modules/tizen/Calendar/Calendar.cpp b/src/modules/tizen/Calendar/Calendar.cpp deleted file mode 100644 index 93df2f7..0000000 --- a/src/modules/tizen/Calendar/Calendar.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Calendar.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include "Calendar.h" -#include "CalendarManager.h" - -namespace WrtDeviceApis { -namespace Calendar { - -using namespace Api; - -Calendar::Calendar() -{ - LogDebug("entered"); -} - -Calendar::~Calendar() -{ - LogDebug("entered"); -} - -void Calendar::OnRequestReceived(const EventAddEventPtr &event) -{ - LogDebug("entered"); - Try - { - if (!event->getEvent()) { - ThrowMsg(Commons::NullPointerException, "event parameter is NULL"); - } - if (event->getEvent()->getIdIsSet()) { - LogWarning("adding event that is already added"); - event->getEvent()->resetId(); - } - DPL::ScopedPtr eventWrapper( - new EventWrapper(event->getEvent())); - eventWrapper->convertAbstractEventToPlatformEvent(); - if (event->checkCancelled()) { - event->setCancelAllowed(true); - event->setResult(true); - return; - } - eventWrapper->saveEvent(); - event->setResult(true); - } - catch (const Commons::Exception &ex) - { - LogError("Error during adding event" << ex.DumpToString()); - event->setResult(false); - } - event->setCancelAllowed(false); -} - -void Calendar::OnRequestReceived(const EventDeleteEventPtr &event) -{ - LogDebug("entered"); - Try - { - if (!event->getEvent()) { - ThrowMsg(Commons::NullPointerException, "event parameter is NULL"); - } - if (!event->getEvent()->getIdIsSet()) { - ThrowMsg(Commons::InvalidArgumentException, - "Cannot delete non-existing event."); - } - DPL::ScopedPtr eventWrapper(new EventWrapper( - event->getEvent())); - eventWrapper->convertAbstractEventToPlatformEvent(); - if (event->checkCancelled()) { - event->setCancelAllowed(true); - event->setResult(true); - return; - } - eventWrapper->deleteEvent(); - event->setResult(true); - } - catch (const Commons::NotFoundException &ex) - { - LogError("event doesn't exist"); - event->setResult(false); - event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); - } - catch (const Commons::Exception &ex) - { - LogError("Error during deleting event " << ex.DumpToString()); - event->setResult(false); - } - event->setCancelAllowed(false); -} - -void Calendar::OnRequestReceived(const EventUpdateEventPtr &event) -{ - LogDebug("entered"); - Try - { - if (!event->getEvent()) { - ThrowMsg(Commons::NullPointerException, "event parameter is NULL"); - } - if (!event->getEvent()->getIdIsSet()) { - ThrowMsg( - Commons::InvalidArgumentException, - "Cannot update non-existing event. Event needs adding or ID is wrong"); - } - DPL::ScopedPtr eventWrapper(new EventWrapper( - event->getEvent())); - eventWrapper->convertAbstractEventToPlatformEvent(); - if (event->checkCancelled()) { - event->setCancelAllowed(true); - event->setResult(true); - return; - } - eventWrapper->saveEvent(); - event->setResult(true); - } - catch (const Commons::Exception &ex) - { - LogError("Error during updating event " << ex.DumpToString()); - event->setResult(false); - } - event->setCancelAllowed(false); -} - -void Calendar::OnRequestReceived(const EventFindEventsPtr &event) -{ - LogDebug("entered"); - const EventFilterPtr &filter = event->getFilter(); - cal_struct *platformEvent = NULL; - cal_iter *iter = NULL; - int foundCnt = 0; - event->setResult(true); - - try { - if (CAL_SUCCESS != - calendar_svc_get_all(0, 0, CAL_STRUCT_SCHEDULE, &iter)) { - ThrowMsg(Commons::PlatformException, "Can't get all records"); - } - //TODO: currently platform starts iteration with below function - // It's possible that current approach will change to be familiar with std iterators - - while (CAL_SUCCESS == calendar_svc_iter_next(iter)) { - event->tryCancelled(); - if (CAL_SUCCESS != - calendar_svc_iter_get_info(iter, &platformEvent)) { - ThrowMsg(Commons::PlatformException, "Can't get event info."); - } - //getting ID - int eventId = calendar_svc_struct_get_int(platformEvent, - CAL_VALUE_INT_INDEX); - if (CAL_SUCCESS != calendar_svc_struct_free(&platformEvent)) { - LogError("Can't free calendar event struct."); - } - - DPL::ScopedPtr eventWrapper(new EventWrapper()); - eventWrapper->loadEvent(eventId); - if (!filter || eventWrapper->matchFilters(filter)) { - if (foundCnt >= event->getFirstEvent() && - (event->getLastEvent() == -1 || foundCnt <= - event->getLastEvent())) { - event->addEvent(eventWrapper->getAbstractEvent()); - } - foundCnt++; - } - } - } - catch (const Commons::Exception &ex) - { - LogError("Exception: " << ex.DumpToString()); - event->setResult(false); - } - //According to example in calendar-svc-provider.h it's not needed to pass here - //iter set on first element - calendar_svc_iter_remove(&iter); - event->setCancelAllowed(true); -} - -void Calendar::OnRequestReceived(const EventCreateEventPtr &event) -{ - LogDebug("entered"); - Try - { - event->setEvent(CalendarEventPtr(new CalendarEvent())); - event->setResult(event->getEvent().Get() != NULL); - } - catch (const Commons::Exception &ex) - { - LogError("Error during creating an event " << ex.DumpToString()); - event->setResult(false); - } -} - -} -} diff --git a/src/modules/tizen/Calendar/Calendar.h b/src/modules/tizen/Calendar/Calendar.h deleted file mode 100644 index dd95f5a..0000000 --- a/src/modules/tizen/Calendar/Calendar.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Calendar.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_CALENDAR_H_ -#define WRTDEVICEAPIS_CALENDAR_CALENDAR_H_ - -#include -#include "Calendar/ICalendar.h" -#include "EventWrapper.h" - -namespace WrtDeviceApis { -namespace Calendar { - -class Calendar : public Api::ICalendar -{ - public: - Calendar(); - virtual ~Calendar(); - protected: - virtual void OnRequestReceived(const Api::EventAddEventPtr &event); - virtual void OnRequestReceived(const Api::EventDeleteEventPtr &event); - virtual void OnRequestReceived(const Api::EventUpdateEventPtr &event); - virtual void OnRequestReceived(const Api::EventFindEventsPtr &event); - virtual void OnRequestReceived(const Api::EventCreateEventPtr &event); -}; - -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_CALENDAR_H_ diff --git a/src/modules/tizen/Calendar/CalendarManager.cpp b/src/modules/tizen/Calendar/CalendarManager.cpp deleted file mode 100644 index 58aa4cc..0000000 --- a/src/modules/tizen/Calendar/CalendarManager.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file CalendarManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - */ - -#include "CalendarManager.h" -#include -#include -#include -#include -#include -#include - -namespace { -const int ID_ALL_ACCOUNTS = 0; -const char* SERVICE_PROVIDER_NAME = "phone"; -} - -namespace WrtDeviceApis { -namespace Calendar { - -using namespace Api; - -int CalendarManager::m_instanceCount = 0; - -CalendarManager::CalendarManager() -{ - LogDebug("entered"); - /* wac platform doesn't support calendar manager. - * This implementation have to implement it on its own. - * One calendar have to be created and stored for further use. - */ - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - if (m_instanceCount == 0) { - LogDebug("opening calendar DB"); - if (CAL_SUCCESS != calendar_svc_connect()) { - ThrowMsg(Commons::PlatformException, - "Calendar DB initialization failed"); - } - } - m_instanceCount++; -} - -CalendarManager::~CalendarManager() -{ - LogDebug("entered"); - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - m_instanceCount--; - if (m_instanceCount == 0) { - LogDebug("closing calendar DB"); - if (CAL_SUCCESS != calendar_svc_close()) { - LogError("Calendar database not clearly closed."); - } - } -} - -int CalendarManager::getAccountId() -{ - return ID_ALL_ACCOUNTS; -} - -const char *CalendarManager::getServiceProviderName() -{ - return SERVICE_PROVIDER_NAME; -} - -void CalendarManager::OnRequestReceived(const EventGetCalendarsPtr &event) -{ - static std::vector calendars; - Try - { - if (calendars.empty()) { - cal_iter *iter = NULL; - if (CAL_SUCCESS != - calendar_svc_get_all(getAccountId(), 0, CAL_STRUCT_CALENDAR, - &iter)) { - event->setResult(false); - return; - } - cal_struct *calendar = NULL; - while (CAL_SUCCESS == calendar_svc_iter_next(iter)) { - if (event->checkCancelled()) { - break; - } - if (CAL_SUCCESS == - calendar_svc_iter_get_info(iter, &calendar)) { - const char* name = calendar_svc_struct_get_str( - calendar, - CAL_TABLE_TXT_NAME); - const char* id = calendar_svc_struct_get_str( - calendar, - CAL_TABLE_TXT_CALENDAR_ID); - if (name != NULL && id != NULL) { - LogDebug( - "got calendar, id=" << id << ", name: " << name); - ICalendarPtr newCalendar(new Calendar()); - newCalendar->setName(name); - newCalendar->setId(Commons::String::toInt(id)); - newCalendar->setAccountId(getAccountId()); - newCalendar->setType(Calendar::DEVICE_CALENDAR); - calendars.push_back(newCalendar); - } else { - LogError("calendar contains invalid parameters"); - } - } else { - LogError("cannot get calendar"); - } - } - calendar_svc_iter_remove(&iter); - } - if (!event->checkCancelled()) { - std::vector::const_iterator it = calendars.begin(); - for (; it != calendars.end(); ++it) { - event->addCalendar(*it); - } - event->setResult(true); - } - } - Catch(Commons::Exception) - { - LogError("error occuered during obtaining data"); - event->setResult(false); - } - event->setCancelAllowed(true); -} -} -} diff --git a/src/modules/tizen/Calendar/CalendarManager.h b/src/modules/tizen/Calendar/CalendarManager.h deleted file mode 100644 index 1b955e9..0000000 --- a/src/modules/tizen/Calendar/CalendarManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file CalendarManager.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_CALENDAR_MANAGER_H_ -#define WRTDEVICEAPIS_CALENDAR_CALENDAR_MANAGER_H_ - -#include -#include -#include -#include -#include "Calendar.h" - -namespace WrtDeviceApis { -namespace Calendar { - -class CalendarManager : public Api::ICalendarManager -{ - public: - CalendarManager(); - virtual ~CalendarManager(); - static int getAccountId(); - static const char* getServiceProviderName(); - protected: - virtual void OnRequestReceived(const Api::EventGetCalendarsPtr &event); - - private: - static int m_instanceCount; - DPL::Mutex m_constructorMutex; -}; -} -} - -#endif // WRTDEVICEAPIS_CALENDAR_CALENDAR_MANAGER_H_ diff --git a/src/modules/tizen/Calendar/EventWrapper.cpp b/src/modules/tizen/Calendar/EventWrapper.cpp deleted file mode 100644 index 4beec34..0000000 --- a/src/modules/tizen/Calendar/EventWrapper.cpp +++ /dev/null @@ -1,1047 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file EventWrapper.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include -#include "EventWrapper.h" -#include "Calendar.h" - -namespace { -const char weekDays[] = "0111110"; -const int NEW_EVENT_ID = -1; -} - -namespace WrtDeviceApis { -namespace Calendar { - -using namespace Api; - -EventWrapper::EventWrapper() : - m_platformEvent(NULL), - m_abstractEvent(NULL) -{ - LogDebug("entered"); - m_abstractEvent = CalendarEventPtr(new CalendarEvent()); - if (!m_abstractEvent) { - ThrowMsg(Commons::UnknownException, "abstract object is not created"); - } -} - -EventWrapper::EventWrapper(const CalendarEventPtr &event) : - m_platformEvent(NULL), - m_abstractEvent(event) -{ - LogDebug("entered"); -} - -EventWrapper::~EventWrapper() -{ - LogDebug("entered"); - freePlatformEvent(); -} - -int EventWrapper::getIDFromPlatformEvent() const -{ - LogDebug("Entered"); - if (m_platformEvent == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformEvent is not set"); - } - - return calendar_svc_struct_get_int(m_platformEvent, CAL_VALUE_INT_INDEX); -} - -void EventWrapper::saveEvent() -{ - LogDebug("entered"); - //Check if platform struct is set. - //It could be set here, but forcing user to do it manually can help to avoid problems. - if (m_platformEvent == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformEvent is not set"); - } - - int eventID = getIDFromPlatformEvent(); - LogDebug("eventID: " << eventID); - - displayPlatformEvent(); - - //insert new record or update existing one - if (eventID < 0) { //insert new event - int returnValue = calendar_svc_insert(m_platformEvent); - if (CAL_SUCCESS > returnValue) { - LogError("Can't insert new event, error code: " << returnValue); - ThrowMsg(Commons::PlatformException, "Can't insert new event."); - } - m_abstractEvent->setId(returnValue); - LogInfo("New calendar event inserted"); - } else { //update - if (CAL_SUCCESS != calendar_svc_update(m_platformEvent)) { - ThrowMsg(Commons::PlatformException, "Can't update new event."); - } - LogDebug("Calendar event updated"); - } -} - -void EventWrapper::loadEvent(int id) -{ - LogDebug("Entered. ID of event to load: " << id); - freePlatformEvent(); - int errorCode = calendar_svc_get(CAL_STRUCT_SCHEDULE, - id, - NULL, - &m_platformEvent); - if (CAL_SUCCESS > errorCode) { - LogError( - "Can't get event with ID = " << id << ", error code: " << - errorCode); - ThrowMsg( - Commons::PlatformException, - "Can't get event with ID = " << id << ", error code: " << - errorCode); - } - convertPlatformEventToAbstractEvent(); - displayAbstractEvent(); -} - -bool EventWrapper::matchFilters(EventFilterPtr filter) -{ - LogDebug("Entered"); - if (!filter) { - return true; - } - if (!m_abstractEvent) { - ThrowMsg(Commons::NullPointerException, - "abstractEvent object is not set"); - } - - LogDebug("---new event to match---"); - m_abstractEvent->display(); - - if (filter->getIdIsSet() && m_abstractEvent->getIdIsSet()) { - std::stringstream ss; - if (!(ss << m_abstractEvent->getId())) { - LogDebug("rejected by id"); - return false; - } - if (!pcrecpp::RE(filter->getIdFilter()).FullMatch(ss.str())) { - LogDebug("rejected by id " << filter->getIdFilter()); - return false; - } - } - if (filter->getCalendarIdIsSet()) { - if (m_abstractEvent->getCalendarId() != - filter->getCalendarIdFilter()) { - LogDebug("rejected by calendar id " << filter->getCalendarIdFilter()); - return false; - } - } - if (filter->getDescriptionIsSet()) { - if (!pcrecpp::RE(filter->getDescriptionFilter()).FullMatch( - m_abstractEvent->getDescription())) { - LogDebug("rejected by description " << filter->getDescriptionFilter()); - return false; - } - } - if (filter->getSubjectIsSet()) { - if (!pcrecpp::RE(filter->getSubjectFilter()).FullMatch(m_abstractEvent - ->getSubject())) - { - LogDebug("rejected by subject " << filter->getSubjectFilter()); - return false; - } - } - if (filter->getStartTimeMinIsSet() && m_abstractEvent->getStartTime() < - filter->getStartTimeMinFilter()) { - LogDebug("rejected by start time min " << filter->getStartTimeMinFilter()); - return false; - } - if (filter->getStartTimeMaxIsSet() && m_abstractEvent->getStartTime() > - filter->getStartTimeMaxFilter()) { - LogDebug("rejected by start time max " << filter->getStartTimeMaxFilter()); - return false; - } - if (filter->getEndTimeMinIsSet() && m_abstractEvent->getEndTime() < - filter->getEndTimeMinFilter()) { - LogDebug("rejected by end time min " << filter->getEndTimeMinFilter()); - return false; - } - if (filter->getEndTimeMaxIsSet() && m_abstractEvent->getEndTime() > - filter->getEndTimeMaxFilter()) { - LogDebug("rejected by end time max " << filter->getEndTimeMaxFilter()); - return false; - } - if (filter->getLocationIsSet()) { - if (!pcrecpp::RE(filter->getLocationFilter()).FullMatch(m_abstractEvent - -> - getLocation())) - { - LogDebug("rejected by location " << filter->getLocationFilter()); - return false; - } - } - if (filter->getRecurrenceIsSet()) { - const std::vector &filterVal = - filter->getRecurrenceFilter(); - if (std::find(filterVal.begin(), filterVal.end(), - m_abstractEvent->getRecurrence()) == filterVal.end()) { - LogDebug("rejected by recurrence"); - return false; - } - } - if (filter->getStatusIsSet()) { - const std::vector &filterVal = - filter->getStatusFilter(); - if (std::find(filterVal.begin(), filterVal.end(), - m_abstractEvent->getStatus()) == filterVal.end()) { - LogDebug("rejected by status"); - return false; - } - } - if (filter->getAlarmTimeMinIsSet() && m_abstractEvent->getAlarmTime() < - filter->getAlarmTimeMinFilter()) { - LogDebug("rejected by alarm time min " << filter->getAlarmTimeMinFilter()); - return false; - } - if (filter->getAlarmTimeMinIsSet() && m_abstractEvent->getAlarmTime() > - filter->getAlarmTimeMaxFilter()) { - LogDebug("rejected by alarm time max " << filter->getAlarmTimeMaxFilter()); - return false; - } - if (filter->getAlarmTypeIsSet()) { - const std::vector &filterVal = - filter->getAlarmTypeFilter(); - if (std::find(filterVal.begin(), filterVal.end(), - m_abstractEvent->getAlarmType()) == filterVal.end()) { - LogDebug("rejected by alarm type"); - return false; - } - } - if (filter->getCategoryIsSet()) { - CategoryListPtr categories = m_abstractEvent->getCategories(); - bool found = false; - for (std::size_t i = 0; i < categories->size(); ++i) { - if (pcrecpp::RE(filter->getCategoryFilter()).FullMatch(categories-> - at(i))) - { - found = true; - break; - } - } - if (!found) { - LogDebug("rejectedy by category"); - return false; - } - } - return true; -} - -void EventWrapper::deleteEvent() -{ - LogDebug("entered"); - if (m_platformEvent == NULL) { - ThrowMsg(Commons::NullPointerException, - "Failed to delete event in calendar (m_platformEvent==NULL)"); - } - int eventID = getIDFromPlatformEvent(); - LogDebug("eventID: " << eventID); - if (eventID < 0) { - ThrowMsg( - Commons::InvalidArgumentException, - "Failed to delete event in calendar (event is not saved in calendar)"); - } - cal_struct *event = NULL; - int error = calendar_svc_get(CAL_STRUCT_SCHEDULE, eventID, NULL, &event); - if (event) { - calendar_svc_struct_free(&event); - } - if (CAL_SUCCESS != error) { - ThrowMsg( - Commons::NotFoundException, - "Can't delete calendar event, event doesn't exist. Error code " - << error); - } - error = calendar_svc_delete(CAL_STRUCT_SCHEDULE, eventID); - if (CAL_SUCCESS != error) { - ThrowMsg(Commons::PlatformException, - "Can't delete calendar event. Error code " << error); - } - LogDebug("event deleted"); - m_abstractEvent->resetId(); - setIDToPlatformEvent(); -} - -cal_struct *EventWrapper::getPlatformEvent() const -{ - return m_platformEvent; -} - -CalendarEventPtr EventWrapper::getAbstractEvent() const -{ - return m_abstractEvent; -} - -void EventWrapper::freePlatformEvent() -{ - LogDebug("entered"); - if (m_platformEvent != NULL) { - if (CAL_SUCCESS != calendar_svc_struct_free(&m_platformEvent)) { - LogError("Can't free calendar event struct."); - } - m_platformEvent = NULL; - } -} - -cal_struct *EventWrapper::convertAbstractEventToPlatformEvent() -{ - LogDebug("entered"); - freePlatformEvent(); - m_platformEvent = calendar_svc_struct_new(CAL_STRUCT_SCHEDULE); - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "cannot create platform event"); - } - setDescriptionToPlatformEvent(); - setSubjectToPlatformEvent(); - setStartTimeToPlatformEvent(); - setEndTimeToPlatformEvent(); - setLocationToPlatformEvent(); - setAlarmToPlatformEvent(); - setRecurrenceToPlatformEvent(); - setStatusToPlatformEvent(); - setCategoriesToPlatformEvent(); - setIDToPlatformEvent(); - setExpiresToPlatformEvent(); - setIntervalToPlatformEvent(); - return getPlatformEvent(); -} - -void EventWrapper::setDescriptionToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent, - CAL_VALUE_TXT_DESCRIPTION, - m_abstractEvent-> - getDescription().c_str())) - { - ThrowMsg(Commons::PlatformException, "Can't set event description."); - } -} - -void EventWrapper::setSubjectToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent, - CAL_VALUE_TXT_SUMMARY, - m_abstractEvent->getSubject() - .c_str())) { - ThrowMsg(Commons::PlatformException, "Can't set event subject."); - } -} - -void EventWrapper::setStartTimeToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - time_t time = m_abstractEvent->getStartTime(); - if (time == 0) { - time = m_abstractEvent->getEndTime(); - } - if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent, - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT, time)) { - ThrowMsg(Commons::PlatformException, "Can't set event start time."); - } -} - -void EventWrapper::setEndTimeToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - time_t time = m_abstractEvent->getEndTime(); - if (time == 0) { - time = m_abstractEvent->getStartTime(); - } - if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformEvent, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT, time)) { - ThrowMsg(Commons::PlatformException, "Can't set event end time."); - } -} - -void EventWrapper::setLocationToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformEvent, - CAL_VALUE_TXT_LOCATION, - m_abstractEvent->getLocation() - .c_str())) { - ThrowMsg(Commons::PlatformException, "Can't set event location."); - } -} - -void EventWrapper::setRecurrenceToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - bool ret = false; - switch (m_abstractEvent->getRecurrence()) { - case CalendarEvent::NO_RECURRENCE: - ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_NONE)); - break; - case CalendarEvent::DAILY_RECURRENCE: - ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_EVERY_DAY)) - && - (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)); - break; - case CalendarEvent::WEEKLY_RECURRENCE: - { - char weekDay[] = "0000000"; - time_t date = m_abstractEvent->getStartTime(); - tm* time = localtime(&date); - if (!time) { - LogError("localtime failed"); - ret = -1; - break; - } - - int days = time->tm_wday; - if (days < 0 || days > 6) { - LogError("invalid week day"); - ret = -1; - } else { - weekDay[days] = '1'; - ret = (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_EVERY_WEEK)) - && - (CAL_SUCCESS == calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)) && - (CAL_SUCCESS == calendar_svc_struct_set_str(m_platformEvent, - CAL_VALUE_TXT_WEEK_FLAG, - weekDay)); - } - } - break; - case CalendarEvent::MONTHLY_ON_DAY_RECURRENCE: - { - char weekDay[] = "0000000"; - time_t date = m_abstractEvent->getStartTime(); - int days = localtime(&date)->tm_wday; - if (days < 0 || days > 6) { - LogError("invalid week day"); - ret = -1; - } else { - weekDay[days] = '1'; - ret = (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)) && - (CAL_SUCCESS == calendar_svc_struct_set_str( - m_platformEvent, - CAL_VALUE_TXT_WEEK_FLAG, - weekDay)); - } - } - break; - case CalendarEvent::MONTHLY_RECURRENCE: - ret = (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_EVERY_MONTH)) && - (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)); - break; - case CalendarEvent::WEEKDAY_RECURRENCE: - ret = (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_EVERY_WEEK)) && - (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)) && - (CAL_SUCCESS == calendar_svc_struct_set_str( - m_platformEvent, - CAL_VALUE_TXT_WEEK_FLAG, - weekDays)); - break; - case CalendarEvent::YEARLY_RECURRENCE: - ret = (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM, - CAL_REPEAT_EVERY_YEAR)) && - (CAL_SUCCESS == calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_REPEAT_OCCURRENCES, - 0)); - break; - case CalendarEvent::INVALID_RECURRENCE: - case CalendarEvent::UNDEFINED_RECURRENCE: - default: - LogError("invalid reccurence " << m_abstractEvent->getRecurrence()); - ret = 0; - break; - } - if (!ret) { - ThrowMsg(Commons::PlatformException, "Can't set event recurrence."); - } -} - -void EventWrapper::setAlarmToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - GList* list = NULL; - - if (m_abstractEvent->getAlarmTimeIsSet()) { - - //set alarm's type - cal_alert_type_t alarmType = CAL_ALERT_MELODY; - switch (m_abstractEvent->getAlarmType()) { - case CalendarEvent::NO_ALARM: - alarmType = CAL_ALERT_MUTE; - break; - case CalendarEvent::SOUND_ALARM: - alarmType = CAL_ALERT_MELODY; - break; - case CalendarEvent::SILENT_ALARM: - alarmType = CAL_ALERT_VIBRATION; - break; - default: - ThrowMsg(Commons::UnknownException, "wrong alarm type"); - break; - } - - //create new alarm - cal_value* alarm = calendar_svc_value_new(CAL_VALUE_LST_ALARM); - if (NULL == alarm) { - ThrowMsg(Commons::PlatformException, "Can't set alarm."); - } - - if (CAL_SUCCESS != calendar_svc_value_set_time( - alarm, - CAL_VALUE_GMT_ALARMS_TIME, - CAL_TZ_FLAG_GMT, - m_abstractEvent->getAlarmTime()) || - CAL_SUCCESS != calendar_svc_value_set_int( - alarm, - CAL_VALUE_INT_ALARMS_TICK, - 0) || - CAL_SUCCESS != calendar_svc_value_set_int( - alarm, - CAL_VALUE_INT_ALARMS_TICK_UNIT, - CAL_SCH_TIME_UNIT_SPECIFIC) || - CAL_SUCCESS != calendar_svc_value_set_int( - alarm, - CAL_VALUE_INT_ALARMS_TYPE, - alarmType)) - { - calendar_svc_value_free(&alarm); - ThrowMsg(Commons::PlatformException, "Can't set alarm."); - } - - //add alarm to list - list = g_list_prepend(list, alarm); - } - - //store alarms list - if (CAL_SUCCESS != calendar_svc_struct_store_list( - m_platformEvent, - CAL_VALUE_LST_ALARM, - list)) - { - ThrowMsg(Commons::PlatformException, "cannot save the alarms"); - } - -} - -void EventWrapper::setStatusToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - int status = 0; - switch (m_abstractEvent->getStatus()) { - case CalendarEvent::TENTATIVE_STATUS: - status = 1; - break; - case CalendarEvent::CANCELLED_STATUS: - status = 2; - break; - case CalendarEvent::CONFIRMED_STATUS: - default: - status = 0; - break; - } - if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_MEETING_STATUS, - status)) { - ThrowMsg(Commons::PlatformException, "Can't set event ID."); - } -} - -void EventWrapper::setCategoriesToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - GList *categoryList = NULL; - cal_value* category = NULL; - Try - { - for (size_t i = 0; i < m_abstractEvent->getCategories()->size(); ++i) { - LogDebug("adding category " << - m_abstractEvent->getCategories()->at(i)); - category = calendar_svc_value_new(CAL_VALUE_LST_MEETING_CATEGORY); - if (NULL == category) { - LogError("error during creating category"); - ThrowMsg(Commons::PlatformException, - "Cannot create category object"); - } - if (CAL_SUCCESS != - calendar_svc_value_set_str(category, "category_name", - m_abstractEvent->getCategories()->at( - i).c_str())) { - LogError("error during setting category name"); - calendar_svc_value_free(&category); - ThrowMsg(Commons::PlatformException, "Cannot set category name"); - } - //Order of categories is lost during saving, so we don't need to reverse this list. - categoryList = g_list_prepend(categoryList, category); - } - - calendar_svc_struct_store_list(m_platformEvent, - CAL_VALUE_LST_MEETING_CATEGORY, - categoryList); - } - Catch(Commons::PlatformException) - { - LogError("error during setting categories"); - calendar_svc_struct_store_list(m_platformEvent, - CAL_VALUE_LST_MEETING_CATEGORY, - NULL); - for (; categoryList; categoryList = g_list_next(categoryList)) { - category = static_cast(categoryList->data); - calendar_svc_value_free(&category); - } - g_list_free(categoryList); - ReThrow(Commons::PlatformException); - } -} - -void EventWrapper::setIDToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (m_abstractEvent->getIdIsSet()) { - if (CAL_SUCCESS != calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_INDEX, - m_abstractEvent->getId())) - { - ThrowMsg(Commons::PlatformException, "Can't set event ID."); - } - } else { - if (CAL_SUCCESS != calendar_svc_struct_set_int( - m_platformEvent, - CAL_VALUE_INT_INDEX, - NEW_EVENT_ID)) - { - ThrowMsg(Commons::PlatformException, "Can't set event ID."); - } - } -} - -void EventWrapper::setExpiresToPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (m_abstractEvent->getExpiresIsSet()) { - int errorCode = calendar_svc_struct_set_time( - m_platformEvent, - CAL_VALUE_GMT_REPEAT_END_DATE, - CAL_TZ_FLAG_GMT, - m_abstractEvent->getExpires()); - if (CAL_SUCCESS != errorCode) { - LogError( - "Can't set CAL_VALUE_GMT_REPEAT_END_DATE, error: " << - errorCode); - ThrowMsg(Commons::PlatformException, "Can't set expires."); - } - } -} - -void EventWrapper::setIntervalToPlatformEvent() -{ - if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_INTERVAL, - m_abstractEvent->getInterval())) - { - ThrowMsg(Commons::PlatformException, "Can't set interval."); - } -} - -CalendarEventPtr EventWrapper::convertPlatformEventToAbstractEvent() -{ - LogDebug("entered"); - setDescriptionFromPlatformEvent(); - setSubjectFromPlatformEvent(); - setStartTimeFromPlatformEvent(); - setEndTimeFromPlatformEvent(); - setLocationFromPlatformEvent(); - setRecurrenceFromPlatformEvent(); - setAlarmFromPlatformEvent(); - setStatusFromPlatformEvent(); - setCategoriesFromPlatformEvent(); - setIDFromPlatformEvent(); - setExpiresFromPlatformEvent(); - setIntervalFromPlatformEvent(); - return getAbstractEvent(); -} - -void EventWrapper::setDescriptionFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - const char *description = calendar_svc_struct_get_str( - m_platformEvent, - CAL_VALUE_TXT_DESCRIPTION); - if (description) { - m_abstractEvent->setDescription(description); - } -} - -void EventWrapper::setSubjectFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - const char *summary = calendar_svc_struct_get_str(m_platformEvent, - CAL_VALUE_TXT_SUMMARY); - if (summary) { - m_abstractEvent->setSubject(summary); - } -} - -void EventWrapper::setStartTimeFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - time_t startTime = calendar_svc_struct_get_time( - m_platformEvent, - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT); - m_abstractEvent->setStartTime(startTime); -} - -void EventWrapper::setEndTimeFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - time_t endTime = calendar_svc_struct_get_time(m_platformEvent, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT); - m_abstractEvent->setEndTime(endTime); -} - -void EventWrapper::setLocationFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - const char* location = calendar_svc_struct_get_str(m_platformEvent, - CAL_VALUE_TXT_LOCATION); - if (location) { - m_abstractEvent->setLocation(location); - } -} - -void EventWrapper::setRecurrenceFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - int recurrence = calendar_svc_struct_get_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_TERM); - switch (recurrence) { - case CAL_REPEAT_NONE: - m_abstractEvent->setRecurrence(CalendarEvent::NO_RECURRENCE); - break; - case CAL_REPEAT_EVERY_DAY: - m_abstractEvent->setRecurrence(CalendarEvent::DAILY_RECURRENCE); - break; - case CAL_REPEAT_EVERY_WEEK: - { - const char *daysFlag = calendar_svc_struct_get_str( - m_platformEvent, - CAL_VALUE_TXT_WEEK_FLAG); - if (daysFlag && strncmp(daysFlag, weekDays, 7) == 0) { - m_abstractEvent->setRecurrence(CalendarEvent::WEEKDAY_RECURRENCE); - } else { - m_abstractEvent->setRecurrence(CalendarEvent::WEEKLY_RECURRENCE); - } - } - break; - case CAL_REPEAT_EVERY_MONTH: - { - const char *daysFlag = calendar_svc_struct_get_str( - m_platformEvent, - CAL_VALUE_TXT_WEEK_FLAG); - if (!daysFlag || strnlen(daysFlag, 7) == 0) { - m_abstractEvent->setRecurrence(CalendarEvent::MONTHLY_RECURRENCE); - } else { - m_abstractEvent->setRecurrence( - CalendarEvent::MONTHLY_ON_DAY_RECURRENCE); - } - } - break; - case CAL_REPEAT_EVERY_YEAR: - m_abstractEvent->setRecurrence(CalendarEvent::YEARLY_RECURRENCE); - break; - default: - LogWarning("unknown recurrence"); - m_abstractEvent->setRecurrence(CalendarEvent::NO_RECURRENCE); - break; - } -} - -void EventWrapper::setAlarmFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - GList* list = NULL; - calendar_svc_struct_get_list(m_platformEvent, CAL_VALUE_LST_ALARM, &list); - if (NULL == list) { - //no alarms - m_abstractEvent->resetAlarmTime(); - return; - } - - cal_value* alarm = static_cast(list->data); - if (NULL == alarm) { - //no alarms - m_abstractEvent->resetAlarmTime(); - return; - } - - cal_sch_remind_tick_unit_t tickUnit = - static_cast(calendar_svc_value_get_int( - alarm, - CAL_VALUE_INT_ALARMS_TICK_UNIT)); - - if (CAL_SCH_TIME_UNIT_OFF == tickUnit) { - //no alarm - m_abstractEvent->resetAlarmTime(); - return; - } - else if (CAL_SCH_TIME_UNIT_SPECIFIC == tickUnit) { - m_abstractEvent->setAlarmTime(calendar_svc_value_get_time( - alarm, CAL_VALUE_GMT_ALARMS_TIME, CAL_TZ_FLAG_GMT)); - } - else { - int tick = calendar_svc_value_get_int(alarm, - CAL_VALUE_INT_ALARMS_TICK); - time_t startTime = m_abstractEvent->getStartTime(); - switch(tickUnit) { - case CAL_SCH_TIME_UNIT_MIN: - /* tick contains number of minutes to substract */ - startTime -= tick * 60; - break; - case CAL_SCH_TIME_UNIT_HOUR: - /* tick contains number of hours to substract */ - startTime -= tick * 60 * 60; - break; - case CAL_SCH_TIME_UNIT_DAY: - /* tick contains number of days to substract */ - startTime -= tick * 60 * 60 * 24; - break; - case CAL_SCH_TIME_UNIT_WEEK: - /* tick contains number of weeks to substract */ - startTime -= tick * 60 * 60 * 24 * 7; - break; - case CAL_SCH_TIME_UNIT_MONTH: { - /* tick contains number of months to substract */ - struct tm *t = localtime(&startTime); - t->tm_mon -= tick; - int tmpDay = t->tm_mday; - startTime = mktime(t); - if (tmpDay != t->tm_mday) { - //previous month is shorter than current - //corrent day and month - t->tm_mday = tmpDay - t->tm_mday; - --t->tm_mon; - startTime = mktime(t); - } - } - break; - default: - break; - } - m_abstractEvent->setAlarmTime(startTime); - } - - cal_alert_type_t alarmType = static_cast( - calendar_svc_value_get_int(alarm, CAL_VALUE_INT_ALARMS_TYPE)); - switch (alarmType) { - case CAL_ALERT_VIBRATION: - m_abstractEvent->setAlarmType(CalendarEvent::SILENT_ALARM); - break; - case CAL_ALERT_MELODY: - case CAL_ALERT_INCREASING_MELODY: - case CAL_ALERT_VIBRATION_THEN_MELODY: - case CAL_ALERT_VIBMELODY: - case CAL_ALERT_VIB_INCREASING_MELODY: - m_abstractEvent->setAlarmType(CalendarEvent::SOUND_ALARM); - break; - case CAL_ALERT_MUTE: - default: - m_abstractEvent->setAlarmType(CalendarEvent::NO_ALARM); - break; - } -} - -void EventWrapper::setStatusFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - int status = calendar_svc_struct_get_int(m_platformEvent, - CAL_VALUE_INT_MEETING_STATUS); - switch (status) { - case 1: - m_abstractEvent->setStatus(CalendarEvent::TENTATIVE_STATUS); - break; - case 2: - m_abstractEvent->setStatus(CalendarEvent::CANCELLED_STATUS); - break; - case 0: - default: - m_abstractEvent->setStatus(CalendarEvent::CONFIRMED_STATUS); - break; - } -} -void EventWrapper::setCategoriesFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - m_abstractEvent->getCategories()->clear(); - GList *categoryList = NULL; - if (CAL_SUCCESS != - calendar_svc_struct_get_list(m_platformEvent, - CAL_VALUE_LST_MEETING_CATEGORY, - &categoryList)) { - LogError("cannot read category list"); - return; - } - cal_value* category = NULL; - for (; categoryList; categoryList = g_list_next(categoryList)) { - category = static_cast(categoryList->data); - char* categoryName = calendar_svc_value_get_str(category, - "category_name"); - if (NULL == categoryName) { - LogError("cannot read category name"); - return; - } - m_abstractEvent->getCategories()->push_back(categoryName); - } -} - -void EventWrapper::setIDFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - m_abstractEvent->setId(getIDFromPlatformEvent()); -} - -void EventWrapper::setExpiresFromPlatformEvent() -{ - if (!m_platformEvent) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - time_t expires = calendar_svc_struct_get_time(m_platformEvent, - CAL_VALUE_GMT_REPEAT_END_DATE, - CAL_TZ_FLAG_GMT); - m_abstractEvent->setExpires(expires); -} - -void EventWrapper::setIntervalFromPlatformEvent() -{ - int interval = calendar_svc_struct_get_int(m_platformEvent, - CAL_VALUE_INT_REPEAT_INTERVAL); - m_abstractEvent->setInterval(interval); -} - -void EventWrapper::displayAbstractEvent() -{ - m_abstractEvent->display(); -} - -void EventWrapper::displayPlatformEvent() -{ - LogDebug("event id: " << calendar_svc_struct_get_int(m_platformEvent, - CAL_VALUE_INT_INDEX)); - LogDebug("event start time: " << calendar_svc_struct_get_time( - m_platformEvent, CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT)); - LogDebug("event end time: " << calendar_svc_struct_get_time(m_platformEvent, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT)); - LogDebug("event location: " << calendar_svc_struct_get_str(m_platformEvent, - CAL_VALUE_TXT_LOCATION)); - LogDebug("event summary: " << calendar_svc_struct_get_str(m_platformEvent, - CAL_VALUE_TXT_SUMMARY)); - LogDebug("event description: " << calendar_svc_struct_get_str( - m_platformEvent, CAL_VALUE_TXT_DESCRIPTION)); -} -} -} diff --git a/src/modules/tizen/Calendar/EventWrapper.h b/src/modules/tizen/Calendar/EventWrapper.h deleted file mode 100644 index 98f7eb4..0000000 --- a/src/modules/tizen/Calendar/EventWrapper.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file EventWrapper.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_ -#define WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Calendar { - -class EventWrapper -{ - public: - EventWrapper(); - explicit EventWrapper(const Api::CalendarEventPtr &event); - virtual ~EventWrapper(); - cal_struct *convertAbstractEventToPlatformEvent(); - Api::CalendarEventPtr convertPlatformEventToAbstractEvent(); - cal_struct *getPlatformEvent() const; - Api::CalendarEventPtr getAbstractEvent() const; - void freePlatformEvent(); - void saveEvent(); - void loadEvent(int id); - void deleteEvent(); - bool matchFilters(Api::EventFilterPtr filter); - - protected: - int getIDFromPlatformEvent() const; - void setDescriptionToPlatformEvent(); - void setSubjectToPlatformEvent(); - void setStartTimeToPlatformEvent(); - void setEndTimeToPlatformEvent(); - void setLocationToPlatformEvent(); - void setRecurrenceToPlatformEvent(); - void setAlarmToPlatformEvent(); - void setStatusToPlatformEvent(); - void setCategoriesToPlatformEvent(); - void setIDToPlatformEvent(); - void setExpiresToPlatformEvent(); - void setIntervalToPlatformEvent(); - - void setDescriptionFromPlatformEvent(); - void setSubjectFromPlatformEvent(); - void setStartTimeFromPlatformEvent(); - void setEndTimeFromPlatformEvent(); - void setLocationFromPlatformEvent(); - void setRecurrenceFromPlatformEvent(); - void setAlarmFromPlatformEvent(); - void setStatusFromPlatformEvent(); - void setCategoriesFromPlatformEvent(); - void setIDFromPlatformEvent(); - void setExpiresFromPlatformEvent(); - void setIntervalFromPlatformEvent(); - private: - void displayAbstractEvent(); //only for debugging - void displayPlatformEvent(); //only for debugging - - cal_struct *m_platformEvent; - Api::CalendarEventPtr m_abstractEvent; -}; - -typedef DPL::SharedPtr EventWrapperPtr; -} -} -#endif // WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_ diff --git a/src/modules/tizen/Calendar/config.cmake b/src/modules/tizen/Calendar/config.cmake deleted file mode 100644 index bcdcf36..0000000 --- a/src/modules/tizen/Calendar/config.cmake +++ /dev/null @@ -1,26 +0,0 @@ -get_current_path() - -pkg_search_module(calendar REQUIRED calendar) -pkg_search_module(glib REQUIRED glib-2.0) -pkg_search_module(libpcrecpp REQUIRED libpcrecpp) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_CALENDAR - ${calendar_INCLUDE_DIRS} - ${glib_INCLUDE_DIRS} - ${libpcrecpp_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_CALENDAR - ${calendar_LIBRARIES} - ${glib_LIBRARIES} - ${libpcrecpp_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_CALENDAR - ${CURRENT_PATH}/Calendar.cpp - ${CURRENT_PATH}/CalendarManager.cpp - ${CURRENT_PATH}/EventWrapper.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/Camera-Webkit/Camera.cpp b/src/modules/tizen/Camera-Webkit/Camera.cpp deleted file mode 100644 index 33e4ded..0000000 --- a/src/modules/tizen/Camera-Webkit/Camera.cpp +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#include "Camera.h" -#include -#include -#include -#include -#include -#include - - -namespace WrtDeviceApis { -namespace Camera { - -template -class CameraPrivateData -{ -public: - Camera* camera; - EventPtr event; -}; - -enum EventTypeId -{ - BeginRecordingType, - TakePictureType, - CreatePreviewType -}; - -class OpaquePrivateData -{ -public: - EventTypeId eventTypeId; - void* cameraPrivateData; -}; - - -//GetEventTypeId -template -EventTypeId getEventTypeId(const T& event){ Assert(0); } - -template<> -EventTypeId getEventTypeId( - const Api::EventBeginRecordingSharedPtr& /*event*/) -{ - return BeginRecordingType; -} - -template<> -EventTypeId getEventTypeId( - const Api::EventTakePictureSharedPtr& /*event*/) -{ - return TakePictureType; -} - -template<> -EventTypeId getEventTypeId( - const Api::EventGetPreviewNodeSharedPtr& /*event*/) -{ - return CreatePreviewType; -} - -template -OpaquePrivateData* createPrivateOpaqueData(Camera* camera, - const EventPtr& event) -{ - //create private opaque data - OpaquePrivateData* opaqueData = new OpaquePrivateData; - - CameraPrivateData* privateData = new CameraPrivateData; - privateData->camera = camera; - privateData->event = event; - - opaqueData->eventTypeId = getEventTypeId(event); - opaqueData->cameraPrivateData = privateData; - - return opaqueData; -} - -template -CameraPrivateData* getPrivateData(void* data) -{ - OpaquePrivateData* opaqueData = static_cast (data); - - CameraPrivateData* privateData = - static_cast *> - (opaqueData->cameraPrivateData); - - return privateData; -} - -template -void deletePrivateData(void* data) -{ - OpaquePrivateData* opaqueData = static_cast (data); - - CameraPrivateData* privateData = - static_cast *> - (opaqueData->cameraPrivateData); - - delete privateData; - delete opaqueData; -} - - -template -EventType createEvent(const EventArg& arg1) -{ - return EventType(arg1); -} - - -template -class BaseCallbackHandler : private DPL::Noncopyable -{ -public: - explicit BaseCallbackHandler(void* data) : - m_camera(NULL) - { - Assert(data); - CameraPrivateData* privateData = - getPrivateData(data); - m_camera = privateData->camera; - m_event = privateData->event; - - deletePrivateData(data); - } - - virtual void handleErrorCallback(int error) - { - LogError("Error: " << error); - m_event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - this->post(); - } - - virtual void handleSuccessCallback(void* data) - { - setPrivate(data); - this->post(); - } - - virtual void post() = 0; - - virtual ~BaseCallbackHandler(){ } - - protected: - virtual void setPrivate(void* /*data*/) {}; - -protected: - Camera* m_camera; - EventType m_event; -}; - -template -class CallbackHandler : public BaseCallbackHandler -{ - static_assert(WrtDeviceApis::Commons::AlwaysFalse::value, - "Error, no specialization found for given type"); - - public: - explicit CallbackHandler(void* data) : - BaseCallbackHandler(data) - { - } - - //virtual void post(){ } -}; - -template<> -class CallbackHandler - : public BaseCallbackHandler -{ - public: - explicit CallbackHandler(void* data) : - BaseCallbackHandler(data) - {} - - virtual void post(){ - this->m_camera->setRecordingState(Camera::COMPLETED); - this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); - } - - virtual void handleSuccessCallback(void* data) - { - this->m_camera->setRecordingState(Camera::COMPLETED); - BaseCallbackHandler:: - handleSuccessCallback(data); - } -}; - -template<> -class CallbackHandler - : public BaseCallbackHandler -{ - public: - explicit CallbackHandler(void* data) : - BaseCallbackHandler(data) - {} - - virtual void post(){ - this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); - } - - virtual void setPrivate(void* data) - { - m_event->getCaptureOptionsRef()->setFileName(static_cast(data)); - } -}; - -template<> -class CallbackHandler - : public BaseCallbackHandler -{ - public: - explicit CallbackHandler(void* data) : - BaseCallbackHandler(data) - {} - - virtual void post(){ - this->m_camera-> - DPL::Event::ControllerEventHandler::PostEvent( - createEvent(this->m_event)); - } - - virtual void setPrivate(void* data) - { - LogDebug("Enter"); - m_event->setPreviewNode(data); - } -}; - -Camera::Camera(const Commons::IWrtCameraPtr& wrtCamera) : - m_wrtCamera(wrtCamera), - m_stateRecordingVideo (Camera::IDLE) -{ - CameraJobDoneController::Touch(); -} - -Camera::~Camera() -{ - LogDebug("enter"); - - CameraJobDoneController::SwitchToThread(NULL); -} - - -void Camera::OnRequestReceived( - const Api::EventTakePictureSharedPtr & event) -{ - LogDebug("enter"); - - event->switchToManualAnswer(); - - m_wrtCamera->captureImage(event->getCaptureOptionsRef()->getFileName(), - checkHighResolutionRequired(event), - camCaptureImageSuccessCallback, - camCaptureImageErrorCallback, - setPendingOperation, - createPrivateOpaqueData(this,event)); - - LogDebug("leaving"); -} - -void Camera::OnRequestReceived( - const Api::EventBeginRecordingSharedPtr & event) -{ - LogDebug("enter"); - - if (m_stateRecordingVideo != Camera::IDLE) { - event->setExceptionCode(Commons::ExceptionCodes::AlreadyInUseException); - return; - } - m_stateRecordingVideo = Camera::PROCESSING; - - //from now on we will have to call answer manually - event->switchToManualAnswer(); - - m_wrtCamera->startVideoCapture(event->getCaptureOptionsRef()->getFileName(), - checkHighResolutionRequired(event), - camCaptureVideoSuccessCallback, - camCaptureVideoErrorCallback, - setPendingOperation, - createPrivateOpaqueData(this,event)); - - LogDebug("leaving"); -} - -void Camera::OnRequestReceived( - const Api::EventEndRecordingSharedPtr & event) -{ - LogDebug("end request"); - if (m_stateRecordingVideo == Camera::PROCESSING) { - m_wrtCamera->stopVideoCapture(); - } else { - LogDebug("stopVideo has been called but no recording is in progress"); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - } -} - -void Camera::OnRequestReceived( - const Api::EventGetPreviewNodeSharedPtr & event) -{ - LogDebug("enter"); - - event->switchToManualAnswer(); - - LogDebug("start createPreview"); - - m_wrtCamera->createPreviewNode(camPreviewSuccessCallback, - camPreviewErrorCallback, - setPendingOperation, - createPrivateOpaqueData(this,event)); - LogDebug("leaving"); -} - -void Camera::camCaptureImageSuccessCallback( - const char* filename, void* data) -{ - LogDebug("*Picture* Captured. !!!"); - - CallbackHandler handler(data); - handler.handleSuccessCallback(const_cast(filename)); -} - -void Camera::camCaptureVideoSuccessCallback(const char* filename, void* data) -{ - LogDebug("*Video* Captured. !!!"); - - CallbackHandler handler(data); - handler.handleSuccessCallback(const_cast(filename)); -} - -void Camera::camPreviewSuccessCallback( - Commons::IWrtCamera::CameraPreviewNode node, void* data) -{ - LogDebug("enter"); - - CallbackHandler handler(data); - handler.handleSuccessCallback(node); -} - -void Camera::camPreviewErrorCallback(int errorCode, void* data) -{ - LogDebug("enter"); - - CallbackHandler handler(data); - handler.handleErrorCallback(errorCode); -} - -void Camera::camCaptureImageErrorCallback(int errorCode, void* data) -{ - LogDebug("enter"); - - CallbackHandler handler(data); - handler.handleErrorCallback(errorCode); -} - -void Camera::camCaptureVideoErrorCallback(int errorCode, void* data) -{ - LogDebug("enter"); - - CallbackHandler handler(data); - handler.handleErrorCallback(errorCode); -} - -void Camera::OnEventReceived(const JobDoneVideoRecordingEvent &event) -{ - LogDebug("enter"); - if (m_stateRecordingVideo == COMPLETED && event.GetArg0()) { - EventRequestReceiver:: - ManualAnswer(event.GetArg0()); - //event.Reset(); - } - m_stateRecordingVideo = Camera::IDLE; -} - -void Camera::OnEventReceived(const JobDoneCreatePreviewEvent &event) -{ - OnJobDoneReceived(event.GetArg0()); -} - -void Camera::OnEventReceived(const JobDoneTakePictureEvent &event) -{ - OnJobDoneReceived(event.GetArg0()); -} - -void Camera::OnCancelEvent( - const Api::EventBeginRecordingSharedPtr& event) -{ - LogDebug(__FUNCTION__); - - if (Camera::PROCESSING == m_stateRecordingVideo) { - if (event->checkPendingOperation()) { - m_wrtCamera->cancelAsyncOperation(event->getPendingOperation()); - } - setRecordingState(Camera::IDLE); - } else { - LogError("Cancel invoked, but the state is wrong"); - } -} - -void Camera::OnCancelEvent(const Api::EventTakePictureSharedPtr& event) -{ - cancelEvent(event); -} - -void Camera::OnCancelEvent( - const Api::EventGetPreviewNodeSharedPtr& event) -{ - cancelEvent(event); -} - -void Camera::setRecordingState(CameraState state) -{ - m_stateRecordingVideo = state; -} - -void Camera::setPendingOperation( - Commons::IWrtCamera::CameraPendingOperation pendingOperation, void* data) -{ - LogDebug("Set pending operation callback invoked"); - - Assert(data); - OpaquePrivateData* opaqueData = static_cast (data); - Assert(opaqueData->cameraPrivateData); - - switch (opaqueData->eventTypeId) { - case BeginRecordingType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } - case CreatePreviewType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } - case TakePictureType: - { - static_cast* > ( - opaqueData->cameraPrivateData) - ->event->setPendingOperation(pendingOperation); - break; - } - default: - Assert(0); - } -} - - -} -} diff --git a/src/modules/tizen/Camera-Webkit/Camera.h b/src/modules/tizen/Camera-Webkit/Camera.h deleted file mode 100644 index 27201fe..0000000 --- a/src/modules/tizen/Camera-Webkit/Camera.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk(g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_CAMERA_H_ -#define WRT_PLUGINS_CAMERA_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis{ -namespace Camera{ - -DECLARE_GENERIC_EVENT_1(JobDoneTakePictureEvent, - Camera::Api::EventTakePictureSharedPtr) -DECLARE_GENERIC_EVENT_1(JobDoneVideoRecordingEvent, - Camera::Api::EventBeginRecordingSharedPtr) -DECLARE_GENERIC_EVENT_1(JobDoneCreatePreviewEvent, - Camera::Api::EventGetPreviewNodeSharedPtr) - - -typedef DPL::TypeListDecl::Type JobDoneEvents; - -typedef DPL::Event::Controller CameraJobDoneController; - -class Camera: public Api::ICamera, - public CameraJobDoneController -{ -public: - enum CameraState{ - IDLE, - PROCESSING, - COMPLETED - }; - -public: - explicit Camera(const Commons::IWrtCameraPtr& wrtCamera); - - virtual ~Camera(); - - virtual void OnRequestReceived( - const Api::EventTakePictureSharedPtr &event); - virtual void OnRequestReceived( - const Api::EventBeginRecordingSharedPtr &event); - virtual void OnRequestReceived( - const Api::EventEndRecordingSharedPtr &event); - virtual void OnRequestReceived( - const Api::EventGetPreviewNodeSharedPtr &event); - - virtual void OnEventReceived(const JobDoneVideoRecordingEvent &event); - virtual void OnEventReceived(const JobDoneCreatePreviewEvent &event); - virtual void OnEventReceived(const JobDoneTakePictureEvent &event); - - void OnCancelEvent(const Api::EventBeginRecordingSharedPtr& event); - void OnCancelEvent(const Api::EventTakePictureSharedPtr& event); - void OnCancelEvent(const Api::EventGetPreviewNodeSharedPtr& event); - - void setRecordingState(CameraState state); - -private: - static void camCaptureImageSuccessCallback(const char* filename, - void* data); - static void camCaptureVideoSuccessCallback(const char* filename, - void* data); - static void camPreviewSuccessCallback( - Commons::IWrtCamera::CameraPreviewNode node, void* data); - - static void camCaptureImageErrorCallback(int errorCode, void* data); - static void camCaptureVideoErrorCallback(int errorCode, void* data); - static void camPreviewErrorCallback(int errorCode, void* data); - - template - bool checkHighResolutionRequired(const EventType& event) const - { - return event->getCaptureOptionsRef()->getImageResolution() - == Api::ICaptureOptions::IMAGE_RESOLUTION_HIGH; - } - - template - void OnJobDoneReceived(DPL::SharedPtr event) - { - LogDebug("enter"); - if (event) { - EventRequestReceiver::ManualAnswer(event); - } - LogDebug("post"); - } - - template - void cancelEvent(const EventType& event) - { - LogDebug(__FUNCTION__); - - if (event->checkPendingOperation()) { - m_wrtCamera->cancelAsyncOperation(event->getPendingOperation()); - } - } - - static void setPendingOperation( - Commons::IWrtCamera::CameraPendingOperation pendingOperation, void* data); - -private: - Commons::IWrtCameraPtr m_wrtCamera; - - CameraState m_stateRecordingVideo; -}; - -} -} -#endif /* WRTPLUGINSCAMERA_H_ */ diff --git a/src/modules/tizen/Camera-Webkit/CameraManager.cpp b/src/modules/tizen/Camera-Webkit/CameraManager.cpp deleted file mode 100644 index 53d26dd..0000000 --- a/src/modules/tizen/Camera-Webkit/CameraManager.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include "CameraManager.h" -#include -#include -#include -#include "Camera.h" - -namespace WrtDeviceApis { -namespace Camera { - -void CameraManager::OnRequestReceived( - const Api::EventGetCamerasPtr &event) -{ - LogDebug(__FUNCTION__); - try - { - if (m_cameras.empty()) { - DPL::Mutex::ScopedLock lock(&m_accessMutex); - - if (m_cameras.empty()) { - Commons::IWrtCameraManager::WrtCamerasPtr cameras; - cameras = event-> - getConfiguration()-> - getWrtWrapper()-> - getCameraManagerInterface()-> - getCameras(); - - FOREACH(it, *cameras) - { - Api::ICameraSharedPtr icamera(new Camera(*it)); - m_cameras.push_back(icamera); - } - } - } - event->setCamerasRef(m_cameras,0); - LogDebug("Nr of cameras: " << m_cameras.size()); - } - catch(const Commons::Exception &exc) - { - LogError("Exception has occurred: " << std::hex << exc.getCode()); - event->setExceptionCode(exc.getCode()); - } -} - -} -} diff --git a/src/modules/tizen/Camera-Webkit/CameraManager.h b/src/modules/tizen/Camera-Webkit/CameraManager.h deleted file mode 100644 index 6fce3eb..0000000 --- a/src/modules/tizen/Camera-Webkit/CameraManager.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRT_PLUGINS_CAMERA_MANAGER_H_ -#define WRT_PLUGINS_CAMERA_MANAGER_H_ - -#include - -#include -#include - -namespace WrtDeviceApis { -namespace Camera { - -class CameraManager : public Api::ICameraManager -{ -protected: - virtual void OnRequestReceived( - const Api::EventGetCamerasPtr &event); - -private: - DPL::Mutex m_accessMutex; -}; - -} -} -#endif /* */ diff --git a/src/modules/tizen/Camera-Webkit/config.cmake b/src/modules/tizen/Camera-Webkit/config.cmake deleted file mode 100644 index 6efbb40..0000000 --- a/src/modules/tizen/Camera-Webkit/config.cmake +++ /dev/null @@ -1,15 +0,0 @@ -get_current_path() - -set(INCLUDES_PLATFORM_IMPLEMENTATION_CAMERA - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_CAMERA - ${CURRENT_PATH}/Camera.cpp - ${CURRENT_PATH}/CameraManager.cpp - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_CAMERA - PARENT_SCOPE -) diff --git a/src/modules/tizen/Contact/AddressBook.cpp b/src/modules/tizen/Contact/AddressBook.cpp deleted file mode 100644 index 78c3ef0..0000000 --- a/src/modules/tizen/Contact/AddressBook.cpp +++ /dev/null @@ -1,1233 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file AddressBook.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "AddressBook.h" -#include "ContactWrapper.h" - -namespace WrtDeviceApis { -namespace Contact { - -using namespace Api; - -bool AddressBook::m_isDaInit = false; - -AddressBook::AddressBook(IAddressBookObject::BookType type) : - IAddressBookObject(type) -{ - LogDebug("entered"); - //platform layer seems to not support different storage types yet - /* - if ( type == IAddressBookObject::PhoneBook ) { - LogDebug("PhoneBook"); - } - else if ( type == IAddressBookObject::SIMBook ) { - LogDebug("SIMBook"); - } - else { - LogError("wrong book type"); - } - */ - - setDaClientIdByDaInit(); -} - -AddressBook::~AddressBook() -{ - LogDebug("entered"); - unsetDaClientIdByDaDeinit(); -} - -std::string AddressBook::getName() const -{ - //return address book name - return m_name; -} - -void AddressBook::setName(const std::string &value) -{ - //set address book name - m_name = value; -} - -void AddressBook::daNotifyCb(user_notify_info_t *notify_info, - void *user_data) -{ - if (notify_info == NULL) { - LogDebug("notify_info is NULL!!"); - return; - } - - if (notify_info->state == DA_STATE_FAILED || notify_info->state == - DA_STATE_CANCELED) { - if (user_data != NULL) { - DownImgInfo *downImgInfo; - downImgInfo = static_cast(user_data); - (downImgInfo->getWaitableEvent())->Signal(); - } - } -} - -void AddressBook::daGetDdInfoCb(user_dd_info_t* /*dd_info*/, - void* /*user_data*/) -{ - /* Empty CB */ - LogDebug("Entered!"); -} - -void AddressBook::daUpdateDownloadInfoCb(user_download_info_t *download_info, - void *user_data) -{ - LogDebug("Entered!"); - - if (download_info != NULL && user_data != NULL) { - if (download_info->saved_path) { - LogDebug( - "download_info->saved_path : " << download_info->saved_path); - DownImgInfo *downImgInfo = static_cast(user_data); - std::string savedPath = download_info->saved_path; - downImgInfo->setdownloadedImgPath(savedPath); - (downImgInfo->getWaitableEvent())->Signal(); - } - } -} - -void AddressBook::setDaClientIdByDaInit(void) -{ - LogDebug("Entered!! m_isDaInit: " << m_isDaInit); - if (m_isDaInit) { - LogDebug("DaInit already done!"); - return; - } - m_isDaInit = true; - - int da_ret = DA_INVALID_ID; - da_client_cb_t da_cb; - memset(&da_cb, 0, sizeof(da_client_cb_t)); - - da_cb.user_noti_cb = &daNotifyCb; - da_cb.send_dd_info_cb = &daGetDdInfoCb; - da_cb.update_dl_info_cb = &daUpdateDownloadInfoCb; - da_ret = da_init(&da_cb, DA_DOWNLOAD_MANAGING_METHOD_AUTO); - - if (da_ret != DA_RESULT_OK) { - LogDebug("Error during da_init() da_ret: " << da_ret); - } -} - -void AddressBook::unsetDaClientIdByDaDeinit(void) -{ - LogDebug("Entered!! m_isDaInit: " << m_isDaInit); - if(m_isDaInit) { - da_deinit(); - m_isDaInit = false; - } -} - -std::string AddressBook::getRealPath(const std::string &path) const -{ - //translate provided path to real filesystem path - Try - { - LogDebug("path : " << path); - if (Commons::validate("^(http(s)?://)?\\w+.*$", - path, - Commons::VALIDATE_MATCH_CASELESS)) - { - // if path is URL then Img will be downloaded. - LogDebug("path is URL. Start Image download!"); - return downloadImage(path); - } else { - //translate provided path to real filesystem path - Filesystem::Api::IPathPtr currentPath = - Filesystem::Api::IPath::create(path); - return currentPath->getFullPath(); - } - } - Catch(Commons::Exception) - { - //probably path doesn't exist - LogError("invalid path"); - } - //on error return empty string - return std::string(); -} - -std::string AddressBook::downloadImage(const std::string &imgUrl) const -{ - try - { - LogDebug("URL : " << imgUrl); - - DownImgInfo downImgInfo; - int da_ret = DA_INVALID_ID; - int download_id = -1; - - DPL::WaitableEvent waitableEvent; - downImgInfo.setWaitableEvent(&waitableEvent); - da_ret = da_start_download_with_extension( - imgUrl.c_str(), &download_id, - DA_FEATURE_USER_DATA, - static_cast(& - downImgInfo), - NULL); - if (da_ret != DA_RESULT_OK) { - ThrowMsg( - Commons::PlatformException, - "Error during da_start_download_with_extension() da_ret: " - << da_ret); - } - DPL::WaitForSingleHandle(waitableEvent.GetHandle()); - waitableEvent.Reset(); - - if ((downImgInfo.getdownloadedImgPath()).empty()) { - ThrowMsg(Commons::Exception, "Download is Fail!"); - } - return downImgInfo.getdownloadedImgPath(); - } - catch (const Commons::Exception &ex) - { - LogError("Probably invalid URL. " << ex.GetMessage()); - } - //on error return empty string(file path) - return std::string(); -} - -std::vector AddressBook::internalExportToVCard( - const std::vector &contacts) const -{ - //container for result files - std::vector result; - //path for currently exporting contact - std::string path; - //platform stream - char *vcard_stream; - //contact to export - CTSstruct *contact; - //streams - std::fstream outputFile; - std::stringstream name; - //get current time to create unique file names - std::time_t t = std::time(0); - //iterate over all contacts to export - for (std::size_t i = 0; i < contacts.size(); ++i) { - //create new file name for current contact - name.clear(); - name << "/Others/contacts_" << i << "_" << t << ".vcf"; - //translate path for real filesystem - path = getRealPath(name.str()); - if (path.empty()) { - LogError("Cannot convert path to real file system path"); - return std::vector(); - } - LogDebug("filename: " << path); - Try - { - //check if file exists and return if does - if (Filesystem::Manager::fileExists(path)) { - LogError("File already exists"); - return std::vector(); - } - } - Catch(Commons::PlatformException) - { - //error during check, return - LogError("Cannot validate if file exists."); - return std::vector(); - } - //create and open new file - outputFile.open(path.c_str(), std::fstream::out | std::fstream::app); - if (!outputFile.fail()) { - //when failes is created then continue with processing a contact - //convert file into platform struct - ContactWrapperPtr wrapper(new ContactWrapper(m_bookType)); - wrapper->setAbstractContact(contacts[i]); - contact = wrapper->getPlatformContact(); - //call API function to get VCard stresm - if (CTS_SUCCESS == - contacts_svc_get_vcard_from_contact(contact, - &vcard_stream)) { - //save results to file - outputFile.write(vcard_stream, strlen(vcard_stream)); - } - //add file to results - result.push_back(name.str()); - } else { - //return if cannot create file - LogError("cannot open file"); - return std::vector(); - } - //close file - outputFile.close(); - } - //return file names - return result; -} - -void AddressBook::internalAddGroup(const std::string &groupName) const -{ - LogDebug("entered"); - //dont add group when already exists - if (getGroupId(groupName) != -1) { - LogWarning("group already exists"); - return; - } - //create plaform struct describing group - CTSvalue *group = contacts_svc_value_new(CTS_VALUE_GROUP); - if (group) { - //set group name - contacts_svc_value_set_str(group, - CTS_GROUP_VAL_NAME_STR, - groupName.c_str()); - //set default ring tone - contacts_svc_value_set_str(group, CTS_GROUP_VAL_RINGTONE_STR, ""); - //try to add new group - if (contacts_svc_insert_group(0, group) < CTS_SUCCESS) { - //failed, free data and throw exception - contacts_svc_value_free(group); - LogError("contacts_svc_insert_group() Failed"); - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_insert_group()"); - } - //success, free data - contacts_svc_value_free(group); - } else { - //throw exception - ThrowMsg(Commons::PlatformException, "Group object not created"); - } -} - -void AddressBook::internalDeleteGroup(const std::string &groupName) const -{ - LogDebug("entered"); - int groupId = getGroupId(groupName); - if (groupId != -1) { - LogDebug("deleting group, id " << groupId); - if (CTS_SUCCESS != contacts_svc_delete_group(groupId)) { - ThrowMsg(Commons::PlatformException, - "Error during deleting a group"); - } - } -} - -int AddressBook::getGroupId(const std::string &groupName) -{ - LogDebug("entered with group name " << groupName); - CTSiter *iter = NULL; - if (CTS_SUCCESS == contacts_svc_get_list(CTS_LIST_ALL_GROUP, &iter)) { - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *group = contacts_svc_iter_get_info(iter); - if (group) { - const char *foundGroupName = contacts_svc_value_get_str( - group, - CTS_LIST_GROUP_NAME_STR); - if (foundGroupName && groupName == foundGroupName) { - int groupId = contacts_svc_value_get_int( - group, - CTS_LIST_GROUP_ID_INT); - contacts_svc_value_free(group); - contacts_svc_iter_remove(iter); - return groupId; - } - contacts_svc_value_free(group); - } - } - contacts_svc_iter_remove(iter); - } - return -1; -} - -std::vector AddressBook::internalFindGroup( - const std::string &groupName) const -{ - LogDebug("entered with group filter: " << groupName); - std::vector result; - CTSiter *iter = NULL; - if (CTS_SUCCESS == contacts_svc_get_list(CTS_LIST_ALL_GROUP, &iter)) { - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *group = contacts_svc_iter_get_info(iter); - if (group) { - const char *foundGroupName = contacts_svc_value_get_str( - group, - CTS_LIST_GROUP_NAME_STR); - if (foundGroupName) { - if (groupName.empty() || - Commons::validate(groupName, - foundGroupName, - Commons::VALIDATE_MATCH_CASELESS)) - { - LogDebug("found group " << foundGroupName); - result.push_back(foundGroupName); - } - } - contacts_svc_value_free(group); - } - } - contacts_svc_iter_remove(iter); - } - return result; -} - -void AddressBook::internalAddContact(const ContactPtr &newContact) const -{ - LogDebug("entered"); - - //translate provided path to real filesystem path - if (newContact->getPhotoIsSet()) { - std::string realpath = getRealPath(newContact->getPhotoUri()); - newContact->setPhotoUri(realpath); - } - - ContactWrapperPtr contactWrapper(new ContactWrapper(m_bookType)); - contactWrapper->setAbstractContact(newContact); - CTSstruct* contact = contactWrapper->getPlatformContact(); - if (!contact) { - LogError("Error during converting contact object"); - ThrowMsg(Commons::PlatformException, - "Error during converting contact object"); - } - int id = contacts_svc_insert_contact(0, contact); - if (id < 0) { - LogError("error code " << id); - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_insert_contact()"); - } - newContact->setId(id); -} - -void AddressBook::internalUpdateContact(const Api::ContactPtr &updatedContact) -const -{ - LogDebug("entered"); - if (!updatedContact) { - ThrowMsg(Commons::PlatformException, "Contact is NULL"); - } - if (!updatedContact->getIdIsSet()) { - ThrowMsg(Commons::PlatformException, "Contact is not saved yet"); - } - LogDebug("update contact with id " << updatedContact->getId()); - ContactWrapperPtr contactWrapper(new ContactWrapper(m_bookType)); - contactWrapper->setAbstractContact(updatedContact); - CTSstruct* contact = contactWrapper->getPlatformContact(); - if (!contact) { - LogError("Error during converting contact object"); - ThrowMsg(Commons::PlatformException, - "Error during converting contact object"); - } - if (CTS_SUCCESS != contacts_svc_update_contact(contact)) { - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_update_contact()"); - } - LogDebug("update successful"); -} - -ContactPtr AddressBook::internalFindContactById(int id) const -{ - LogDebug("entered with id " << id); - CTSstruct *contact = NULL; - int errorCode = contacts_svc_get_contact(id, &contact); - if (CTS_SUCCESS == errorCode) { - ContactWrapperPtr contactWrapper(new ContactWrapper(m_bookType)); - contactWrapper->setPlatformContact(contact); - ContactPtr contact = contactWrapper->getAbstractContact(); - if (!contact) { - ThrowMsg(Commons::PlatformException, - "Error during converting contact object"); - } - return contact; - } else if (CTS_ERR_DB_RECORD_NOT_FOUND == errorCode) { - LogWarning("record not found"); - return ContactPtr(NULL); - } else { - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_get_contact()"); - } -} - -std::vector AddressBook::internalFindContactByFilter( - const ContactFilterPtr &filter, - int startIndex, - int endIndex, - bool caseSensitive) const -{ - LogDebug("entered"); - std::vector result; - int count = 0; - CTSvalue *platformContact = NULL; - CTSiter *iter = NULL; - if (CTS_SUCCESS == contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter)) { - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - platformContact = contacts_svc_iter_get_info(iter); - if (platformContact) { - int contactId = contacts_svc_value_get_int( - platformContact, - CTS_LIST_CONTACT_ID_INT); - ContactPtr contact = internalFindContactById(contactId); - /*Compare the contact to the filter*/ - if (contact && matchToFilter(filter, contact, caseSensitive)) { - LogDebug("found contact by filter"); - if (count >= startIndex) { - result.push_back(contact); - } - ++count; - } - contacts_svc_value_free(platformContact); - if (endIndex != -1 && count > endIndex) { - contacts_svc_iter_remove(iter); - return result; - } - } - } - contacts_svc_iter_remove(iter); - } - return result; -} - -std::vector AddressBook::internalFindContactByGroup( - const std::string &groupName) const -{ - LogDebug("entered with group: " << groupName); - std::vector result; - CTSvalue *platformContact = NULL; - CTSiter *iter = NULL; - if (CTS_SUCCESS == contacts_svc_get_list(CTS_LIST_ALL_CONTACT, &iter)) { - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - platformContact = contacts_svc_iter_get_info(iter); - if (platformContact) { - int contactId = contacts_svc_value_get_int( - platformContact, - CTS_LIST_CONTACT_ID_INT); - ContactPtr contact = internalFindContactById(contactId); - if (contact) { - std::vector::const_iterator found = - find(contact->getGroups().begin(), - contact->getGroups().end(), groupName); - if (found != contact->getGroups().end()) { - LogDebug("found contact in group"); - result.push_back(contact); - } - } - contacts_svc_value_free(platformContact); - } - } - contacts_svc_iter_remove(iter); - } - return result; -} - -void AddressBook::internalDeleteContactById(int id) const -{ - LogDebug("entered with id " << id); - if (id != -1) { - CTSstruct *contact = NULL; - /*If the contact is not existed, throw NotFoundException*/ - if (CTS_SUCCESS != contacts_svc_get_contact(id, &contact)) { - ThrowMsg(Commons::NotFoundException, - "Can't delete contact, contact doesn't exist. Error code"); - } - - if (CTS_SUCCESS != contacts_svc_delete_contact(id)) { - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_delete_contact()"); - } - } -} - -unsigned int AddressBook::internalGetNumberOfContacts() const -{ - LogDebug("entered"); - int result = contacts_svc_count_with_int( - CTS_GET_COUNT_CONTACTS_IN_ADDRESSBOOK, - 0); - if (result < 0) { - ThrowMsg(Commons::PlatformException, - "Error during executing contacts_svc_count_with_int()"); - } - return result; -} - -std::vector AddressBook::mergeRecords( - const std::vector &contacts) const -{ - LogDebug("entered"); - std::vector merged; - std::vector::const_iterator it; - for (it = contacts.begin(); it != contacts.end(); ++it) { - ContactPtr copy = (*it)->clone(); - /*Merge types of emails with the same email address*/ - copy->setEmails(mergeEmails(copy->getEmails())); - /*Merge types of phonenumbers with the same number*/ - copy->setPhoneNumbers(mergePhoneNumbers(copy->getPhoneNumbers())); - /*Merge types of addresses with the same address info*/ - copy->setAddresses(mergeAddresses(copy->getAddresses())); - merged.push_back(copy); - } - return merged; -} - -std::vector AddressBook::mergeEmails( - const std::vector &emails) const -{ - LogDebug("entered"); - std::vector merged; - std::vector::const_iterator it; - std::vector::const_iterator mergedIt; - std::vector::const_iterator typesIt; - bool found; - for (it = emails.begin(); it != emails.end(); ++it) { - found = false; - for (mergedIt = merged.begin(); mergedIt != merged.end(); ++mergedIt) { - if ((*mergedIt)->getEmail() == (*it)->getEmail()) { - LogDebug("found the same email " << (*mergedIt)->getEmail()); - //the same emails, check types and add if needed - const std::vector &types = - (*it)->getTypes(); - for (typesIt = types.begin(); typesIt != types.end(); - ++typesIt) { - if (!(*mergedIt)->isTypeOf(*typesIt)) { - (*mergedIt)->addType(*typesIt); - LogInfo("merged email type " << *typesIt); - } - } - found = true; - break; - } - } - if (!found) { - LogInfo("copy email"); - merged.push_back((*it)->clone()); - } - } - return merged; -} - -std::vector AddressBook::mergePhoneNumbers( - const std::vector &phoneNumbers) const -{ - LogDebug("entered"); - std::vector merged; - std::vector::const_iterator it; - std::vector::const_iterator mergedIt; - std::vector::const_iterator - typesIt; - bool found; - for (it = phoneNumbers.begin(); it != phoneNumbers.end(); ++it) { - found = false; - for (mergedIt = merged.begin(); mergedIt != merged.end(); ++mergedIt) { - if ((*mergedIt)->getNumber() == (*it)->getNumber()) { - LogDebug( - "found the same phone number " << (*mergedIt)->getNumber()); - //the same emails, check types and add if needed - const std::vector & - types = (*it)->getTypes(); - for (typesIt = types.begin(); typesIt != types.end(); - ++typesIt) { - if (!(*mergedIt)->isTypeOf(*typesIt)) { - LogInfo("merged phone type " << *typesIt); - (*mergedIt)->addType(*typesIt); - } - } - found = true; - break; - } - } - if (!found) { - LogInfo("copy phone"); - merged.push_back((*it)->clone()); - } - } - return merged; -} - -std::vector AddressBook::mergeAddresses( - const std::vector &addresses) const -{ - LogDebug("entered"); - std::vector merged; - std::vector::const_iterator it; - std::vector::const_iterator mergedIt; - std::vector::const_iterator typesIt; - bool found; - for (it = addresses.begin(); it != addresses.end(); ++it) { - found = false; - for (mergedIt = merged.begin(); mergedIt != merged.end(); ++mergedIt) { - if ((*mergedIt)->compareTo((*it))) { - LogDebug("found the same address"); - //the same emails, check types and add if needed - const std::vector &types = - (*it)->getTypes(); - for (typesIt = types.begin(); typesIt != types.end(); - ++typesIt) { - if (!(*mergedIt)->isTypeOf(*typesIt)) { - LogInfo("merged address type " << *typesIt); - (*mergedIt)->addType(*typesIt); - } - } - found = true; - break; - } - } - if (!found) { - LogInfo("copy address"); - merged.push_back((*it)->clone()); - } - } - return merged; -} - -bool AddressBook::matchToFilter(const ContactFilterPtr &filter, - const ContactPtr &contact, - bool caseSensitive) const -{ - LogDebug("entered"); - if (!contact) { - //no object provided - return false; - } - if (!filter) { - //pass all when no filter - return true; - } - unsigned int matchOptions = - caseSensitive ? 0 : Commons::VALIDATE_MATCH_CASELESS; - if (filter->getFullNameIsSet()) { - if (!Commons::validate(filter->getFullNameFilter(), - contact->getFullName(), - matchOptions)) - { - LogDebug("rejected FullName"); - return false; - } - } - if (filter->getFirstNameIsSet()) { - if (!Commons::validate(filter->getFirstNameFilter(), - contact->getFirstName(), - matchOptions)) - { - LogDebug("rejected First Name"); - return false; - } - } - if (filter->getLastNameIsSet()) { - if (!Commons::validate(filter->getLastNameFilter(), - contact->getLastName(), - matchOptions)) - { - LogDebug("rejected Last Name"); - return false; - } - } - if (filter->getCompanyIsSet()) { - if (!Commons::validate(filter->getCompanyFilter(), - contact->getCompany(), - matchOptions)) - { - LogDebug("rejected company"); - return false; - } - } - if (filter->getTitleIsSet()) { - if (!Commons::validate(filter->getTitleFilter(), - contact->getTitle(), - matchOptions)) - { - LogDebug("rejected title"); - return false; - } - } - if (filter->getPhoneticNameIsSet()) { - if (!Commons::validate(filter->getPhoneticNameFilter(), - contact->getPhoneticName(), - matchOptions)) - { - LogDebug("rejected PhoneticName"); - return false; - } - } - if (!matchToFilterEmail(filter, contact, caseSensitive)) { - return false; - } - if (!matchToFilterAddress(filter, contact, caseSensitive)) { - return false; - } - if (!matchToFilterPhoneNumber(filter, contact, caseSensitive)) { - return false; - } - if (!matchToFilterNickname(filter, contact, caseSensitive)) { - return false; - } - return true; -} - -bool AddressBook::matchToFilterAddress(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const -{ - if (filter->getAddressIsSet()) { - bool found; - unsigned int matchOptions = - caseSensitive ? 0 : Commons::VALIDATE_MATCH_CASELESS; - LogDebug("filtering by address"); - const std::vector &addressFilter = - filter->getAddressFilter(); - const std::vector &addresses = contact->getAddresses(); - for (std::size_t i = 0; i < addressFilter.size(); ++i) { - found = false; - const std::vector & - addrFilterTypes = addressFilter[i]->getTypes(); - for (std::size_t j = 0; j < addresses.size(); ++j) { - if (!addrFilterTypes.empty()) { - if (!addresses[j]->isTypeOf(addressFilter[i]->getTypeFilter())) - { - LogDebug("rejected by Type!"); - continue; - } - } - if (addressFilter[i]->getCountryIsSet()) { - if (!Commons::validate(addressFilter[i]->getCountry(), - addresses[j]->getCountry(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getRegionIsSet()) { - if (!Commons::validate(addressFilter[i]->getRegion(), - addresses[j]->getRegion(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getCountyIsSet()) { - if (!Commons::validate(addressFilter[i]->getCounty(), - addresses[j]->getCounty(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getCityIsSet()) { - if (!Commons::validate(addressFilter[i]->getCity(), - addresses[j]->getCity(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getStreetIsSet()) { - if (!Commons::validate(addressFilter[i]->getStreet(), - addresses[j]->getStreet(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getStreetNumberIsSet()) { - if (!Commons::validate(addressFilter[i]->getStreetNumber(), - addresses[j]->getStreetNumber(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getPremisesIsSet()) { - if (!Commons::validate(addressFilter[i]->getPremises(), - addresses[j]->getPremises(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getAdditionalInformationIsSet()) { - if (!Commons::validate( - addressFilter[i]->getAdditionalInformation(), - addresses[j]->getAdditionalInformation(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - if (addressFilter[i]->getPostalCodeIsSet()) { - if (!Commons::validate(addressFilter[i]->getPostalCode(), - addresses[j]->getPostalCode(), - matchOptions)) - { - LogDebug("rejected by address"); - continue; - //return false; - } - } - found = true; - break; - } - if (!found) { - LogDebug("rejected by address"); - return false; - } - } - } - return true; -} - -bool AddressBook::matchToFilterEmail(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const -{ - if (filter->getEmailIsSet()) { - bool found; - unsigned int matchOptions = - caseSensitive ? 0 : Commons::VALIDATE_MATCH_CASELESS; - LogDebug("filtering by email"); - const std::vector &emailFilter = - filter->getEmailFilter(); - const std::vector &emails = contact->getEmails(); - for (std::size_t i = 0; i < emailFilter.size(); ++i) { - found = false; - const std::vector &emailFilterTypes - = emailFilter[i]->getTypes(); - for (std::size_t j = 0; j < emails.size(); ++j) { - if (!emailFilterTypes.empty()) { - if (!emails[j]->isTypeOf(emailFilter[i]->getTypeFilter())) - { - LogDebug("type error!!!"); - continue; - } - } - if (!Commons::validate(emailFilter[i]->getEmail(), - emails[j]->getEmail(), - matchOptions)) - { - LogDebug("rejected by email, different email"); - continue; - } - found = true; - break; - } - if (!found) { - LogDebug("rejected by email, not found email"); - return false; - } - } - } - return true; -} - -bool AddressBook::matchToFilterPhoneNumber(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const -{ - if (filter->getPhoneNumberIsSet()) { - bool found; - unsigned int matchOptions = - caseSensitive ? 0 : Commons::VALIDATE_MATCH_CASELESS; - LogDebug("filtering by phone number"); - const std::vector &phoneNumberFilter = - filter->getPhoneNumberFilter(); - const std::vector &phoneNumber = - contact->getPhoneNumbers(); - for (std::size_t i = 0; i < phoneNumberFilter.size(); ++i) { - found = false; - const std::vector & - phoneNumberFilterTypes = phoneNumberFilter[i]->getTypes(); - for (std::size_t j = 0; j < phoneNumber.size(); ++j) { - if (!phoneNumberFilterTypes.empty()) { - if (!phoneNumber[j]->isTypeOf(phoneNumberFilter[i]-> - getTypeFilter())) - { - LogDebug("rejected by phone type"); - continue; - } - } - if (!Commons::validate(phoneNumberFilter[i]->getNumber(), - phoneNumber[j]->getNumber(), - matchOptions)) - { - LogDebug("rejected by phone number"); - continue; - } - found = true; - break; - } - if (!found) { - LogDebug("rejected by phone number"); - return false; - } - } - } - return true; -} - -bool AddressBook::matchToFilterNickname(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const -{ - if (filter->getNickNameIsSet()) { - bool found; - unsigned int matchOptions = - caseSensitive ? 0 : Commons::VALIDATE_MATCH_CASELESS; - LogDebug("filtering by nickname"); - const std::vector &nicknameFilter = - filter->getNickNameFilter(); - const std::vector &nickname = contact->getNickNames(); - for (std::size_t i = 0; i < nicknameFilter.size(); ++i) { - found = false; - for (std::size_t j = 0; j < nickname.size(); ++j) { - if (!Commons::validate(nicknameFilter[i], - nickname[j], - matchOptions)) - { - continue; - } - found = true; - break; - } - if (!found) { - LogDebug("rejected by nickname"); - return false; - } - } - } - return true; -} - -//************************************** -//* Events * -//************************************** - -void AddressBook::OnRequestReceived(const Api::EventAddContactPtr &event) -{ - LogDebug("entered"); - try - { - const ContactPtr &contact = event->getContact(); - if (contact) { - internalAddContact(contact); - event->setResult(true); - } - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during adding contact."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventUpdateContactPtr &event) -{ - LogDebug("entered"); - try - { - const ContactPtr &contact = event->getContact(); - if (contact) { - internalUpdateContact(contact); - event->setResult(true); - } - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during updating contact."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventDeleteContactPtr &event) -{ - LogDebug("entered"); - try - { - const ContactFilterPtr &filter = event->getFilter(); - if (filter && filter->getIdIsSet()) { - internalDeleteContactById(filter->getIdFilter()); - event->setResult(true); - } - } - catch (const Commons::NotFoundException &ex) - { - LogError("Contact doesn't exist"); - event->setResult(false); - event->setExceptionCode(Commons::ExceptionCodes::NotFoundException); - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during deleting contact."); - LogError(ex.GetMessage()); - event->setResult(false); - } -} - -void AddressBook::OnRequestReceived(const Api::EventFindContactsPtr &event) -{ - LogDebug("entered"); - ContactFilterPtr filter = event->getFilter(); - try - { - if (filter && filter->getIdIsSet()) { - LogDebug("searching for contact by id"); - ContactPtr contact = internalFindContactById(filter->getIdFilter()); - if (contact) { - event->addContact(contact); - } - event->setResult(true); - } else if (filter && filter->getGroupIsSet()) { - LogDebug("searching for contact by group"); - const std::vector &contacts = - internalFindContactByGroup(filter->getGroupFilter()); - event->setContacts(contacts); - event->setResult(true); - } else { - LogDebug("searching for contact by filter"); - const std::vector &contacts = - internalFindContactByFilter(filter, - event->getStartIndex(), - event->getEndIndex(), false); - event->setContacts(contacts); - event->setResult(true); - } - if (!event->getUseSignleTypes()) { - const std::vector &contacts = event->getContacts(); - std::vector merged = mergeRecords(contacts); - event->setContacts(merged); - } - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during getting contact."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived( - const Api::EventGetAddressBookItemCountPtr &event) -{ - LogDebug("entered"); - try - { - unsigned int count = internalGetNumberOfContacts(); - event->setNumberOfAddressBookItems(count); - event->setResult(true); - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during getting contact."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventAddGroupPtr &event) -{ - LogDebug("entered"); - try - { - internalAddGroup(event->getGroupName()); - event->setResult(true); - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during adding group."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventDeleteGroupPtr &event) -{ - LogDebug("entered"); - try - { - internalDeleteGroup(event->getGroupName()); - event->setResult(true); - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during getting contact."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventFindGroupPtr &event) -{ - LogDebug("entered"); - try - { - std::vector groups = internalFindGroup(event->getGroupName()); - event->setFoundGroups(groups); - event->setResult(true); - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during getting groups."); - LogError(ex.GetMessage()); - } -} - -void AddressBook::OnRequestReceived(const Api::EventExportVCardPtr &event) -{ - LogDebug("entered"); - try - { - const std::vector &contacts = event->getContacts(); - LogDebug("number of contacts to export: " << contacts.size()); - if (contacts.size() == 0) { - event->setResult(true); - return; - } - std::vector paths = internalExportToVCard(contacts); - if (paths.size() > 0) { - event->setResult(true); - event->setPathToFiles(paths); - } - } - catch (const Commons::PlatformException &ex) - { - LogError("Error during getting groups."); - LogError(ex.GetMessage()); - } -} -} -} - diff --git a/src/modules/tizen/Contact/AddressBook.h b/src/modules/tizen/Contact/AddressBook.h deleted file mode 100644 index 1342a57..0000000 --- a/src/modules/tizen/Contact/AddressBook.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file AddressBook.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_ADDRESS_BOOK_H_ -#define WRTDEVICEAPIS_CONTACT_ADDRESS_BOOK_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { - -class AddressBook : public Api::IAddressBookObject -{ - private: - class DownImgInfo - { - private: - DPL::WaitableEvent* m_waitableEvent; - std::string m_downloadedImgPath; - - public: - DownImgInfo() : m_waitableEvent(NULL) - { - } - void setWaitableEvent (DPL::WaitableEvent* waitableEvent) - { - m_waitableEvent = waitableEvent; - } - DPL::WaitableEvent* getWaitableEvent (void) const - { - return m_waitableEvent; - } - void setdownloadedImgPath (const std::string &downloadedImgPath) - { - m_downloadedImgPath = downloadedImgPath; - } - std::string getdownloadedImgPath (void) const - { - return m_downloadedImgPath; - } - }; - - public: - explicit AddressBook(Api::IAddressBookObject::BookType type); - virtual ~AddressBook(); - //get name of AddressBook - std::string getName() const; - //set name of AddressBook - void setName(const std::string &value); - //get group id or -1 when no group found - static int getGroupId(const std::string &groupName); - - protected: - void OnRequestReceived(const Api::EventAddContactPtr &event); - void OnRequestReceived(const Api::EventUpdateContactPtr &event); - void OnRequestReceived(const Api::EventDeleteContactPtr &event); - void OnRequestReceived(const Api::EventFindContactsPtr &event); - void OnRequestReceived(const Api::EventGetAddressBookItemCountPtr &event); - void OnRequestReceived(const Api::EventAddGroupPtr &event); - void OnRequestReceived(const Api::EventDeleteGroupPtr &event); - void OnRequestReceived(const Api::EventFindGroupPtr &event); - void OnRequestReceived(const Api::EventExportVCardPtr &event); - - //exports contacts to files and returns paths to it or empty list on error. - std::vector internalExportToVCard( - const std::vector &contacts) const; - //checks if abstract object matches a filter - bool matchToFilter(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const; - void internalAddGroup(const std::string &groupName) const; - void internalDeleteGroup(const std::string &groupName) const; - std::vector internalFindGroup(const std::string &groupName) - const; - void internalAddContact(const Api::ContactPtr &newContact) const; - void internalUpdateContact(const Api::ContactPtr &updatedContact) const; - Api::ContactPtr internalFindContactById(int id) const; - std::vector internalFindContactByFilter( - const Api::ContactFilterPtr &filter, - int startIndex = -1, - int endIndex = -1, - bool caseSensitive = true) const; - std::vector internalFindContactByGroup( - const std::string &groupName) const; - void internalDeleteContactById(int id) const; - unsigned int internalGetNumberOfContacts() const; - bool internalSetContactGroups(int id, - const std::vector &groups) const; - std::vector mergeRecords( - const std::vector &contacts) const; - std::vector mergeEmails( - const std::vector &emails) const; - std::vector mergePhoneNumbers( - const std::vector &phoneNumbers) const; - std::vector mergeAddresses( - const std::vector &addresses) const; - - std::string m_name; - private: - std::string getRealPath(const std::string &path) const; - std::string downloadImage(const std::string &imgUrl) const; - bool matchToFilterAddress(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const; - bool matchToFilterEmail(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const; - bool matchToFilterPhoneNumber(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const; - bool matchToFilterNickname(const Api::ContactFilterPtr &filter, - const Api::ContactPtr &contact, - bool caseSensitive) const; - static void daNotifyCb(user_notify_info_t *notify_info, - void *user_data); - static void daGetDdInfoCb(user_dd_info_t *dd_info, - void *user_data); - static void daUpdateDownloadInfoCb(user_download_info_t *download_info, - void *user_data); - static void setDaClientIdByDaInit(void); - static void unsetDaClientIdByDaDeinit(void); - - static bool m_isDaInit; -}; -} -} - -#endif /* WRTDEVICEAPIS_CONTACT_ADDRESS_BOOK_H_ */ diff --git a/src/modules/tizen/Contact/ContactManager.cpp b/src/modules/tizen/Contact/ContactManager.cpp deleted file mode 100644 index 0cd8bc5..0000000 --- a/src/modules/tizen/Contact/ContactManager.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file ContactManager.cpp - * @author Lukasz Marek(l.marek@samsung.com) - * @version 0.1 - * - */ - -#include -#include -#include -#include -#include "ContactManager.h" -#include "AddressBook.h" - -namespace { -const char *DEVICE_ADDRESSBOOK = "DEVICE AddressBook"; -const char *SIM_ADDRESSBOOK = "SIM AddressBook"; -} - -namespace WrtDeviceApis { -namespace Contact { - -using namespace Api; - -//initialize static variables -int ContactManager::m_instanceCount = 0; -bool ContactManager::m_opened = false; - -ContactManager::ContactManager() : - //create sim and device address books - m_deviceBook(new AddressBook(IAddressBookObject::PhoneBook)), - m_simBook(new AddressBook(IAddressBookObject::SIMBook)) -{ - LogDebug("entered"); - //set address book names - m_deviceBook->setName(DEVICE_ADDRESSBOOK); - m_simBook->setName(SIM_ADDRESSBOOK); - //protect for pararel execution - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - if (m_instanceCount == 0) { - //when it is first instance then open connection to database - if (contacts_svc_connect() == CTS_SUCCESS) { - //contacts database is opened properly - LogDebug("contacts database is opened properly"); - m_opened = true; - } else { - //error during opening contacts database - LogError("error during opening contacts database"); - } - } - //increase counter of instances - m_instanceCount++; -} - -ContactManager::~ContactManager() -{ - LogDebug("entered"); - //protect for pararel execution - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - //decrease counter of instances - m_instanceCount--; - if (m_instanceCount == 0) { - //when it is last instance then clse connection to database - if (contacts_svc_disconnect() != CTS_SUCCESS) { - //error during closing contacts database - LogError("error during closing contacts database"); - } - m_opened = false; - } -} - -void ContactManager::OnRequestReceived(const EventGetAddressBooksPtr &event) -{ - LogDebug("entered"); - if (m_opened) { - //when database is opened then add addressbooks to result... - event->addAddressBook(m_deviceBook); - event->addAddressBook(m_simBook); - //... and set result as success - event->setResult(true); - } else { - //when database is not opened then set result as failed - event->setResult(false); - } -} - -void ContactManager::OnRequestReceived(const Api::EventGetOwnerInfoPtr &event) -{ - LogDebug("entered"); - //TODO: platform doesn't support owner information, returning empty object now. - event->setOwnerInfo(ContactPtr(new Contact())); - event->setDataFound(false); - //set result as success anyway to inform receiver it's not execution error - event->setResult(true); -} -} -} diff --git a/src/modules/tizen/Contact/ContactManager.h b/src/modules/tizen/Contact/ContactManager.h deleted file mode 100644 index 7cf54f7..0000000 --- a/src/modules/tizen/Contact/ContactManager.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactManager.h - * @author Lukasz Marek(l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_MANAGER_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_MANAGER_H_ - -#include -#include -#include "AddressBook.h" - -namespace WrtDeviceApis { -namespace Contact { - -class ContactManager : public Api::IContactManager -{ - public: - ContactManager(); - virtual ~ContactManager(); - protected: - virtual void OnRequestReceived(const Api::EventGetAddressBooksPtr &event); - virtual void OnRequestReceived(const Api::EventGetOwnerInfoPtr &event); - private: - Api::IAddressBookObjectPtr m_deviceBook; - Api::IAddressBookObjectPtr m_simBook; - - static int m_instanceCount; - static bool m_opened; - DPL::Mutex m_constructorMutex; -}; -} -} - -#endif /* WRTDEVICEAPIS_CONTACT_CONTACT_MANAGER_H_ */ diff --git a/src/modules/tizen/Contact/ContactWrapper.cpp b/src/modules/tizen/Contact/ContactWrapper.cpp deleted file mode 100755 index e86a38b..0000000 --- a/src/modules/tizen/Contact/ContactWrapper.cpp +++ /dev/null @@ -1,1480 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactWrapper.cpp - * @author Lukasz Marek(l.marek@samsung.com) - * @author Yujie Zeng(yj.zengk@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include "ContactWrapper.h" -#include "AddressBook.h" - -namespace { -// Custom Type Name -const char* CONTACT_ATTRIBUTE_PHONETIC_NAME = "phoneticName"; -} - -namespace WrtDeviceApis { -namespace Contact { - -using namespace Api; - -ContactWrapper::ContactWrapper(IAddressBookObject::BookType /*type*/) : - m_abstractContact(NULL), - m_platformContact(NULL) -{ - LogDebug("entered"); - //platform layer seems to not support different storage types yet - /* - if ( type == IAddressBookObject::PhoneBook ) { - } - else if ( type == IAddressBookObject::SIMBook ) { - } - else { - LogError("invalid storage type"); - } - */ -} - -ContactWrapper::~ContactWrapper() -{ - LogDebug("entered"); - freePlatformObject(); -} - -void ContactWrapper::freePlatformObject() -{ - if (m_platformContact) { - contacts_svc_struct_free(m_platformContact); - m_platformContact = NULL; - } -} - -void ContactWrapper::freeAbstractObject() -{ - m_abstractContact = ContactPtr(NULL); -} - -Api::ContactPtr ContactWrapper::getAbstractContact() const -{ - return m_abstractContact; -} - -void ContactWrapper::setAbstractContact(const ContactPtr &contact) -{ - m_abstractContact = contact; - convertToPlatformObject(); -} - -CTSstruct* ContactWrapper::getPlatformContact() const -{ - return m_platformContact; -} - -void ContactWrapper::setPlatformContact(CTSstruct* contact) -{ - freePlatformObject(); - m_platformContact = contact; - convertToAbstractObject(); -} - -bool ContactWrapper::convertToPlatformObject() -{ - LogDebug("entered"); - freePlatformObject(); - if (!m_abstractContact) { - LogError("abstract object is not set"); - return false; - } - //if abstrat object has id set then we have to read existing object and update it - if (m_abstractContact->getIdIsSet()) { - LogDebug("reading existing contact"); - contacts_svc_get_contact(m_abstractContact->getId(), &m_platformContact); - } - //if no id is set then create new platform object - else { - LogDebug("creating new contact"); - m_platformContact = contacts_svc_struct_new(CTS_STRUCT_CONTACT); - } - if (!m_platformContact) { - LogError("contact structure not created properly"); - return false; - } - try - { - //store name - if (!convertToPlatformBaseData()) { - ThrowMsg(Commons::UnknownException, - "error during converting base data"); - } - //store address - if (!convertToPlatformAddressObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting address object"); - } - //store email - if (!convertToPlatformEmailObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting email object"); - } - //store phone - if (!convertToPlatformPhoneObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting phone object"); - } - //nickname - if (!convertToPlatformNicknameObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting nickname object"); - } - //phoneticName - if (!convertToPlatformPhoneticnameObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting Phoneticname object"); - } - //group - if (!convertToPlatformGroupObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting group object"); - } - } - catch (const Commons::UnknownException &ex) - { - LogError(ex.GetMessage()); - freePlatformObject(); - return false; - } - return true; -} - -bool ContactWrapper::convertToAbstractObject() -{ - LogDebug("entered"); - freeAbstractObject(); - if (!m_platformContact) { - return false; - } - CTSvalue *value = NULL; - //store id - if (CTS_SUCCESS != - contacts_svc_struct_get_value(m_platformContact, CTS_CF_BASE_INFO_VALUE, - &value)) { - return false; - } - m_abstractContact = ContactPtr(new Contact()); - m_abstractContact->setId(contacts_svc_value_get_int( - value, CTS_BASE_VAL_ID_INT)); - const char *charValue = contacts_svc_value_get_str( - value, - CTS_BASE_VAL_IMG_PATH_STR); - if (charValue) { - m_abstractContact->setPhotoUri(charValue); - } - charValue = contacts_svc_value_get_str(value, - CTS_BASE_VAL_RINGTONE_PATH_STR); - if (charValue) { - m_abstractContact->setRingTonePath(charValue); - } - try - { - //store base information - if (!convertToAbstractBaseData()) { - ThrowMsg(Commons::UnknownException, - "error during converting base data"); - } - //store address - if (!convertToAbstractAddressObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting address object"); - } - //store email - if (!convertToAbstractEmailObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting email object"); - } - //store phone - if (!convertToAbstractPhoneObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting phone object"); - } - //nickname - if (!convertToAbstractNicknameObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting nickname object"); - } - //phoneticName - if (!convertToAbstractPhoneticnameObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting phoneticName object"); - } - //group - if (!convertToAbstractGroupObject()) { - ThrowMsg(Commons::UnknownException, - "error during converting group object"); - } - } - catch (const Commons::UnknownException &ex) - { - LogError(ex.GetMessage()); - freeAbstractObject(); - return false; - } - return true; -} - -bool ContactWrapper::convertToAbstractBaseData() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - CTSvalue *value = NULL; - int errorCode; - const char *charValue = NULL; - errorCode = contacts_svc_struct_get_value(m_platformContact, - CTS_CF_NAME_VALUE, - &value); - if (CTS_SUCCESS == errorCode) { - if (value) { - charValue = contacts_svc_value_get_str(value, - CTS_NAME_VAL_FIRST_STR); - if (charValue) { - m_abstractContact->setFirstName(charValue); - } - charValue = contacts_svc_value_get_str(value, CTS_NAME_VAL_LAST_STR); - if (charValue) { - m_abstractContact->setLastName(charValue); - } - charValue = contacts_svc_value_get_str(value, - CTS_NAME_VAL_DISPLAY_STR); - if (charValue) { - m_abstractContact->setFullName(charValue); - } - charValue = contacts_svc_value_get_str(value, - CTS_NAME_VAL_PREFIX_STR); - if (charValue) { - m_abstractContact->setTitle(charValue); - } - } else { - return false; - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - value = NULL; - errorCode = contacts_svc_struct_get_value(m_platformContact, - CTS_CF_COMPANY_VALUE, - &value); - if (CTS_SUCCESS == errorCode) { - if (value) { - charValue = contacts_svc_value_get_str(value, - CTS_COMPANY_VAL_NAME_STR); - if (charValue) { - m_abstractContact->setCompany(charValue); - } - } else { - return false; - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - return true; -} - -bool ContactWrapper::convertToAbstractAddressObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - GSList *addressList = NULL; - const char *charValue = NULL; - std::vector addresses; - int errorCode = contacts_svc_struct_get_list(m_platformContact, - CTS_CF_POSTAL_ADDR_LIST, - &addressList); - if (CTS_SUCCESS == errorCode) { - for (; addressList; addressList = g_slist_next(addressList)) { - ContactAddressPtr address(new ContactAddress()); - addresses.push_back(address); - int type = contacts_svc_value_get_int( - static_cast(addressList->data), - CTS_POSTAL_VAL_TYPE_INT); - //TODO "no enumeration for address type. Temporarly use email type" - switch (type) { - case CTS_ADDR_TYPE_NONE: - address->addType(ContactAddress::CONTACT_ADDRESS_TYPE_PREF); - break; - case CTS_ADDR_TYPE_HOME: - address->addType(ContactAddress::CONTACT_ADDRESS_TYPE_HOME); - break; - case CTS_ADDR_TYPE_WORK: - address->addType(ContactAddress::CONTACT_ADDRESS_TYPE_WORK); - break; - default: - LogError("invalid address type"); - address->addType(ContactAddress::CONTACT_ADDRESS_TYPE_PREF); - break; - } - //TODO "no place to store: county, premises, additional information in platform struct" - #if 0 - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), ); - if (charValue) { - address->setCounty(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), ); - if (charValue) { - address->setPremises(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), ); - if (charValue) { - address->setAdditionalInformation(charValue); - } - #endif - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_COUNTRY_STR); - if (charValue) { - address->setCountry(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_REGION_STR); - if (charValue) { - address->setRegion(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_LOCALITY_STR); - if (charValue) { - address->setCity(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_STREET_STR); - if (charValue) { - address->setStreet(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_POBOX_STR); - if (charValue) { - address->setStreetNumber(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_POSTALCODE_STR); - if (charValue) { - address->setPostalCode(charValue); - } - charValue = contacts_svc_value_get_str( - static_cast(addressList->data), - CTS_POSTAL_VAL_EXTENDED_STR); - if (charValue) { - address->setAddress(charValue); - } - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - m_abstractContact->setAddresses(addresses); - return true; -} - -bool ContactWrapper::convertToAbstractEmailObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - GSList *emailList = NULL; - const char *charValue = NULL; - std::vector emails; - int errorCode = contacts_svc_struct_get_list(m_platformContact, - CTS_CF_EMAIL_LIST, - &emailList); - if (CTS_SUCCESS == errorCode) { - for (; emailList; emailList = g_slist_next(emailList)) { - ContactEmailPtr email(new ContactEmail()); - emails.push_back(email); - int type = contacts_svc_value_get_int( - static_cast(emailList->data), - CTS_EMAIL_VAL_TYPE_INT); - switch (type) { - case CTS_EMAIL_TYPE_NONE: - email->addType(ContactEmail::CONTACT_EMAIL_TYPE_PREF); - break; - case CTS_EMAIL_TYPE_HOME: - email->addType(ContactEmail::CONTACT_EMAIL_TYPE_HOME); - break; - case CTS_EMAIL_TYPE_WORK: - email->addType(ContactEmail::CONTACT_EMAIL_TYPE_WORK); - break; - default: - LogError("invalid phone type"); - email->addType(ContactEmail::CONTACT_EMAIL_TYPE_PREF); - break; - } - charValue = contacts_svc_value_get_str( - static_cast(emailList->data), - CTS_EMAIL_VAL_ADDR_STR); - if (charValue) { - email->setEmail(charValue); - } - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - m_abstractContact->setEmails(emails); - return true; -} - -bool ContactWrapper::convertToAbstractPhoneObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - GSList *phoneList = NULL; - const char *charValue = NULL; - std::vector phoneNumbers; - int errorCode = contacts_svc_struct_get_list(m_platformContact, - CTS_CF_NUMBER_LIST, - &phoneList); - if (CTS_SUCCESS == errorCode) { - for (; phoneList; phoneList = g_slist_next(phoneList)) { - ContactPhoneNumberPtr phoneNumber(new ContactPhoneNumber()); - phoneNumbers.push_back(phoneNumber); - int type = contacts_svc_value_get_int( - static_cast(phoneList->data), - CTS_NUM_VAL_TYPE_INT); - switch (type) { - case CTS_NUM_TYPE_WORK: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_WORK); - break; - case CTS_NUM_TYPE_NONE: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PREF); - break; - case CTS_NUM_TYPE_HOME: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_HOME); - break; - case CTS_NUM_TYPE_FAX: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_FAX); - break; - case CTS_NUM_TYPE_CELL: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_CELL); - break; - case CTS_NUM_TYPE_PAGER: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PAGER); - break; - case CTS_NUM_TYPE_CAR: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_CAR); - break; - case CTS_NUM_TYPE_VOICE: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_VOICE); - break; - case CTS_NUM_TYPE_MSG: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_MSG); - break; - case CTS_NUM_TYPE_BBS: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_BBS); - break; - case CTS_NUM_TYPE_MODEM: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_MODEM); - break; - case CTS_NUM_TYPE_ISDN: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_ISDN); - break; - case CTS_NUM_TYPE_VIDEO: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_VIDEO); - break; - case CTS_NUM_TYPE_PCS: - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PCS); - break; - default: - LogError("invalid phone type"); - phoneNumber->addType( - ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PREF); - break; - } - charValue = contacts_svc_value_get_str( - static_cast(phoneList->data), - CTS_NUM_VAL_NUMBER_STR); - if (charValue) { - phoneNumber->setNumber(charValue); - } - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - m_abstractContact->setPhoneNumbers(phoneNumbers); - return true; -} - -bool ContactWrapper::convertToAbstractNicknameObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - GSList *nicknNameList = NULL; - const char *charValue = NULL; - std::vector nickNames; - int errorCode = contacts_svc_struct_get_list(m_platformContact, - CTS_CF_NICKNAME_LIST, - &nicknNameList); - if (CTS_SUCCESS == errorCode) { - for (; nicknNameList; nicknNameList = g_slist_next(nicknNameList)) { - charValue = contacts_svc_value_get_str( - static_cast(nicknNameList->data), - CTS_NICKNAME_VAL_NAME_STR); - if (charValue) { - nickNames.push_back(charValue); - } - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - m_abstractContact->setNickNames(nickNames); - return true; -} - -bool ContactWrapper::convertToAbstractPhoneticnameObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - CTSvalue *value = NULL; - int errorCode; - int structFieldType = 0; - const char *charValue = NULL; - - structFieldType = getCustomTypeInContactsSvc( - CONTACT_ATTRIBUTE_PHONETIC_NAME); - if (structFieldType < CTS_SUCCESS) { - LogError("Phonetic name struct type is not found!!"); - return false; - } - - errorCode = - contacts_svc_struct_get_value(m_platformContact, - static_cast( - structFieldType), &value); - if (CTS_SUCCESS == errorCode) { - if (value) { - charValue = contacts_svc_value_get_str(value, - CTS_EXTEND_VAL_DATA2_STR); - if (charValue) { - m_abstractContact->setPhoneticName(charValue); - } - } else { - return false; - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - return true; -} - -bool ContactWrapper::convertToAbstractGroupObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - GSList *groupList = NULL; - const char *charValue = NULL; - std::vector groups; - int errorCode = contacts_svc_struct_get_list(m_platformContact, - CTS_CF_GROUPREL_LIST, - &groupList); - if (CTS_SUCCESS == errorCode) { - for (; groupList; groupList = g_slist_next(groupList)) { - charValue = contacts_svc_value_get_str( - static_cast(groupList->data), - CTS_GROUPREL_VAL_NAME_STR); - if (charValue) { - groups.push_back(charValue); - } - } - } else if (CTS_ERR_NO_DATA != errorCode) { - return false; - } - m_abstractContact->setGroups(groups); - return true; -} - -bool ContactWrapper::convertToPlatformNicknameObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - const std::vector &nicknames = - m_abstractContact->getNickNames(); - - if (nicknames.size() == 0) { - return true; - } - - CTSvalue *nickname = NULL; - bool properlyCreated = true; - GSList *nicknameList = NULL; - //mark existing items to delete them. - - if (CTS_SUCCESS == - contacts_svc_struct_get_list(m_platformContact, CTS_CF_NICKNAME_LIST, - &nicknameList)) { - GSList *nicknameListSave = nicknameList; - for (; nicknameList; nicknameList = g_slist_next(nicknameList)) { - CTSvalue* nickname = static_cast(nicknameList->data); - contacts_svc_value_set_bool(nickname, - CTS_NICKNAME_VAL_DELETE_BOOL, - true); - } - nicknameList = nicknameListSave; - } - //add new items - for (std::size_t i = 0; i < nicknames.size(); ++i) { - nickname = contacts_svc_value_new(CTS_VALUE_NICKNAME); - if (nickname) { - if (CTS_SUCCESS == - contacts_svc_value_set_str(nickname, CTS_NICKNAME_VAL_NAME_STR, - nicknames[i].c_str())) { - nicknameList = g_slist_append(nicknameList, nickname); - } else { - contacts_svc_value_free(nickname); - properlyCreated = false; - break; - } - } else { - properlyCreated = false; - break; - } - } - - if (properlyCreated) { - if (CTS_SUCCESS != - contacts_svc_struct_store_list(m_platformContact, - CTS_CF_NICKNAME_LIST, - nicknameList)) { - properlyCreated = false; - } - } - - return properlyCreated; -} - -bool ContactWrapper::convertToPlatformPhoneticnameObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - CTSvalue *value = NULL; - int structFieldType = 0; - - structFieldType = getCustomTypeInContactsSvc( - CONTACT_ATTRIBUTE_PHONETIC_NAME); - if (structFieldType < CTS_SUCCESS) { - LogError("Phonetic name struct type is not found!!"); - return false; - } - - /** - *If phonetic name information is not existed, add phonetic name information - *If phonetic name information is existed,update phonetic name information - */ - if (CTS_SUCCESS != - contacts_svc_struct_get_value(m_platformContact, - static_cast( - structFieldType), &value)) { - value = contacts_svc_value_new(CTS_VALUE_EXTEND); - if (!value) { - return false; - } - } - if (CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_EXTEND_VAL_DATA2_STR, - m_abstractContact->getPhoneticName().c_str()) - || - CTS_SUCCESS != - contacts_svc_struct_store_value(m_platformContact, - static_cast( - structFieldType), value)) { - contacts_svc_value_free(value); - return false; - } - contacts_svc_value_free(value); - - LogDebug("RETURN TRUE!!!"); - return true; -} - -bool ContactWrapper::convertToPlatformGroupObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - const std::vector &groups = - m_abstractContact->getGroups(); - if (groups.size() == 0) { - return true; - } - CTSvalue *group = NULL; - bool properlyCreated = true; - GSList *groupList = NULL; - //mark existing items to delete them. - if (CTS_SUCCESS == - contacts_svc_struct_get_list(m_platformContact, CTS_CF_GROUPREL_LIST, - &groupList)) { - GSList *groupListSave = groupList; - for (; groupList; groupList = g_slist_next(groupList)) { - LogDebug("clearing group list"); - CTSvalue* delgroup = static_cast(groupList->data); - contacts_svc_value_set_bool(delgroup, - CTS_GROUPREL_VAL_DELETE_BOOL, - true); - } - groupList = groupListSave; - } - //add new items - for (std::size_t i = 0; i < groups.size(); ++i) { - group = contacts_svc_value_new(CTS_VALUE_GROUP_RELATION); - if (group) { - int groupId = -1; - //groupId = AddressBook::getGroupId(groups[i]); - - CTSiter *iter = NULL; - if (CTS_SUCCESS == - contacts_svc_get_list(CTS_LIST_ALL_GROUP, &iter)) { - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *findgroup = contacts_svc_iter_get_info(iter); - if (findgroup) { - const char *foundGroupName = contacts_svc_value_get_str( - findgroup, - CTS_LIST_GROUP_NAME_STR); - if (foundGroupName && groups[i] == foundGroupName) { - groupId = contacts_svc_value_get_int( - findgroup, - CTS_LIST_GROUP_ID_INT); - } - } - } - contacts_svc_iter_remove(iter); - } - LogDebug("group id " << groupId); - if (groupId != -1) { - if (CTS_SUCCESS == - contacts_svc_value_set_int(group, CTS_GROUPREL_VAL_ID_INT, - groupId)) { - groupList = g_slist_append(groupList, group); - } else { - contacts_svc_value_free(group); - properlyCreated = false; - break; - } - } else { - contacts_svc_value_free(group); - properlyCreated = false; - break; - } - } else { - properlyCreated = false; - break; - } - } - if (properlyCreated) { - LogDebug("storing group list"); - if (CTS_SUCCESS != - contacts_svc_struct_store_list(m_platformContact, - CTS_CF_GROUPREL_LIST, - groupList)) { - properlyCreated = false; - } - } - for (; groupList; groupList = g_slist_next(groupList)) { - contacts_svc_value_free(static_cast(groupList->data)); - } - g_slist_free(groupList); - return properlyCreated; -} - -bool ContactWrapper::convertToPlatformPhoneObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - int type; - const std::vector &phoneNumbers = - m_abstractContact->getPhoneNumbers(); - if (phoneNumbers.size() == 0) { - return true; - } - bool properlyCreated = true; - CTSvalue *number = NULL; - GSList *numberList = NULL; - //mark existing items to delete them. - if (CTS_SUCCESS == - contacts_svc_struct_get_list(m_platformContact, CTS_CF_NUMBER_LIST, - &numberList)) { - GSList *numberListSave = numberList; - for (; numberList; numberList = g_slist_next(numberList)) { - LogDebug("clearing phone list"); - CTSvalue* number = static_cast(numberList->data); - contacts_svc_value_set_bool(number, CTS_NUM_VAL_DELETE_BOOL, true); - } - numberList = numberListSave; - } - //add new items - for (std::size_t i = 0; i < phoneNumbers.size(); ++i) { - std::vector types = - phoneNumbers[i]->getTypes(); - for (std::size_t j = 0; j < types.size(); ++j) - { - number = contacts_svc_value_new(CTS_VALUE_NUMBER); - if (number) { - if(types.size() > 0) - { - switch (types[j]) { - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_WORK: - type = CTS_NUM_TYPE_WORK; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PREF: - type = CTS_NUM_TYPE_NONE; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_HOME: - type = CTS_NUM_TYPE_HOME; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_FAX: - type = CTS_NUM_TYPE_FAX; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_CELL: - type = CTS_NUM_TYPE_CELL; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PAGER: - type = CTS_NUM_TYPE_PAGER; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_CAR: - type = CTS_NUM_TYPE_CAR; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_BBS: - type = CTS_NUM_TYPE_BBS; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_MODEM: - type = CTS_NUM_TYPE_MODEM; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_ISDN: - type = CTS_NUM_TYPE_ISDN; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_VIDEO: - type = CTS_NUM_TYPE_VIDEO; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_PCS: - type = CTS_NUM_TYPE_PCS; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_VOICE: - type = CTS_NUM_TYPE_VOICE; - break; - case ContactPhoneNumber::CONTACT_PHONE_NUMBER_TYPE_MSG: - type = CTS_NUM_TYPE_MSG; - break; - default: - LogError("invalid phone type"); - type = CTS_NUM_TYPE_NONE; - break; - } - } - else - { - type = CTS_NUM_TYPE_NONE; - } - if (CTS_SUCCESS == - contacts_svc_value_set_str(number, CTS_NUM_VAL_NUMBER_STR, - phoneNumbers[i]->getNumber(). - c_str()) && - CTS_SUCCESS == - contacts_svc_value_set_bool(number, - CTS_NUM_VAL_DEFAULT_BOOL, - type == CTS_NUM_TYPE_NONE) && - CTS_SUCCESS == - contacts_svc_value_set_int(number, CTS_NUM_VAL_TYPE_INT, - type)) { - numberList = g_slist_append(numberList, number); - } else { - contacts_svc_value_free(number); - properlyCreated = false; - break; - } - } else { - properlyCreated = false; - break; - } - } - if (!properlyCreated) { - break; - } - } - if (properlyCreated) { - if (CTS_SUCCESS != - contacts_svc_struct_store_list(m_platformContact, - CTS_CF_NUMBER_LIST, - numberList)) { - properlyCreated = false; - } - } - for (; numberList; numberList = g_slist_next(numberList)) { - contacts_svc_value_free(static_cast(numberList->data)); - } - g_slist_free(numberList); - return properlyCreated; -} - -bool ContactWrapper::convertToPlatformEmailObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - int type; - const std::vector &emails = - m_abstractContact->getEmails(); - if (emails.size() == 0) { - return true; - } - CTSvalue *email = NULL; - bool properlyCreated = true; - GSList *emailList = NULL; - //mark existing items to delete them. - if (CTS_SUCCESS == - contacts_svc_struct_get_list(m_platformContact, CTS_CF_EMAIL_LIST, - &emailList)) { - GSList *emailListSave = emailList; - for (; emailList; emailList = g_slist_next(emailList)) { - LogDebug("clearing email list"); - CTSvalue* email = static_cast(emailList->data); - contacts_svc_value_set_bool(email, CTS_EMAIL_VAL_DELETE_BOOL, true); - } - emailList = emailListSave; - } - //add new items - for (std::size_t i = 0; i < emails.size(); ++i) { - std::vector types = - emails[i]->getTypes(); - for (std::size_t j = 0; j < types.size(); ++j) - { - email = contacts_svc_value_new(CTS_VALUE_EMAIL); - if(email) - { - if(types.size() > 0) - { - switch (types[j]) { - case ContactEmail::CONTACT_EMAIL_TYPE_HOME: - type = CTS_EMAIL_TYPE_HOME; - break; - case ContactEmail::CONTACT_EMAIL_TYPE_WORK: - type = CTS_EMAIL_TYPE_WORK; - break; - case ContactEmail::CONTACT_EMAIL_TYPE_PREF: - type = CTS_EMAIL_TYPE_NONE; - break; - default: - LogError("invalid phone type"); - type = CTS_EMAIL_TYPE_NONE; - break; - } - } - else - { - type = CTS_EMAIL_TYPE_NONE; - } - if (CTS_SUCCESS == - contacts_svc_value_set_int(email, CTS_EMAIL_VAL_TYPE_INT, - type) && - CTS_SUCCESS == - contacts_svc_value_set_str(email, CTS_EMAIL_VAL_ADDR_STR, - emails[i]->getEmail().c_str())) - { - emailList = g_slist_append(emailList, email); - } else { - contacts_svc_value_free(email); - properlyCreated = false; - break; - } - } - else - { - properlyCreated = false; - break; - } - } - - if (!properlyCreated) { - break; - } - } - if (properlyCreated) { - if (CTS_SUCCESS != - contacts_svc_struct_store_list(m_platformContact, CTS_CF_EMAIL_LIST, - emailList)) { - properlyCreated = false; - } - } - for (; emailList; emailList = g_slist_next(emailList)) { - contacts_svc_value_free(static_cast(emailList->data)); - } - g_slist_free(emailList); - return properlyCreated; -} - -bool ContactWrapper::convertToPlatformAddressObject() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - int type; - const std::vector &addresses = - m_abstractContact->getAddresses(); - if (addresses.size() == 0) { - return true; - } - CTSvalue *address = NULL; - bool properlyCreated = true; - GSList *addressList = NULL; - //mark existing items to delete them. - if (CTS_SUCCESS == - contacts_svc_struct_get_list(m_platformContact, CTS_CF_POSTAL_ADDR_LIST, - &addressList)) { - GSList *addressListSave = addressList; - for (; addressList; addressList = g_slist_next(addressList)) { - LogDebug("clearing address list"); - CTSvalue* address = static_cast(addressList->data); - contacts_svc_value_set_bool(address, - CTS_POSTAL_VAL_DELETE_BOOL, - true); - } - addressList = addressListSave; - } - //add new items - for (std::size_t i = 0; i < addresses.size(); ++i) { - std::vector types = - addresses[i]->getTypes(); - for (std::size_t j = 0; j < types.size(); ++j) { - address = contacts_svc_value_new(CTS_VALUE_POSTAL); - if (address) { - //TODO "no place to store: county, premises, additional information in platform struct" - switch (types[j]) { - case ContactAddress::CONTACT_ADDRESS_TYPE_PREF: - type = CTS_ADDR_TYPE_NONE; - break; - case ContactAddress::CONTACT_ADDRESS_TYPE_WORK: - type = CTS_ADDR_TYPE_WORK; - break; - case ContactAddress::CONTACT_ADDRESS_TYPE_HOME: - type = CTS_ADDR_TYPE_HOME; - break; - default: - LogError("invalid address type"); - type = CTS_EMAIL_TYPE_NONE; - break; - } - //CTS_SUCCESS == contacts_svc_value_set_str(address, , addresses[i]->getCounty().c_str()) && - //CTS_SUCCESS == contacts_svc_value_set_str(address, , addresses[i]->getPremises().c_str()) && - //CTS_SUCCESS == contacts_svc_value_set_str(address, , addresses[i]->getAdditionalInformation().c_str()) && - if (CTS_SUCCESS == - contacts_svc_value_set_int(address, CTS_POSTAL_VAL_TYPE_INT, - type) && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_COUNTRY_STR, - addresses[i]->getCountry().c_str()) - && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_REGION_STR, - addresses[i]->getRegion().c_str()) - && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_LOCALITY_STR, - addresses[i]->getCity().c_str()) - && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_STREET_STR, - addresses[i]->getStreet().c_str()) - && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_POBOX_STR, - addresses[i]->getStreetNumber(). - c_str()) && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_POSTALCODE_STR, - addresses[i]->getPostalCode(). - c_str()) && - CTS_SUCCESS == - contacts_svc_value_set_str(address, - CTS_POSTAL_VAL_EXTENDED_STR, - addresses[i]-> - getAdditionalInformation(). - c_str())) { - addressList = g_slist_append(addressList, address); - } else { - contacts_svc_value_free(address); - properlyCreated = false; - break; - } - } else { - properlyCreated = false; - break; - } - } - if (!properlyCreated) { - break; - } - } - if (properlyCreated) { - if (CTS_SUCCESS != - contacts_svc_struct_store_list(m_platformContact, - CTS_CF_POSTAL_ADDR_LIST, - addressList)) { - properlyCreated = false; - } - } - for (; addressList; addressList = g_slist_next(addressList)) { - contacts_svc_value_free(static_cast(addressList->data)); - } - g_slist_free(addressList); - return properlyCreated; -} - -bool ContactWrapper::convertToPlatformBaseData() -{ - LogDebug("entered"); - if (NULL == m_abstractContact) { - LogError("you should create empty abstract contact object first"); - return false; - } - - if (NULL == m_platformContact) { - LogError("you should provide platform contact object first"); - return false; - } - - /** - *If name information is not existed, add name information - * If name information is existed,update name information - */ - CTSvalue *value = NULL; - - if (CTS_SUCCESS != - contacts_svc_struct_get_value(m_platformContact, CTS_CF_NAME_VALUE, - &value)) { - CTSvalue *value = contacts_svc_value_new(CTS_VALUE_NAME); - if (value) { - if (CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_FIRST_STR, - m_abstractContact->getFirstName(). - c_str()) || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_LAST_STR, - m_abstractContact->getLastName(). - c_str()) || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_DISPLAY_STR, - m_abstractContact->getFullName(). - c_str()) || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_PREFIX_STR, - m_abstractContact->getTitle().c_str()) - || - CTS_SUCCESS != - contacts_svc_struct_store_value(m_platformContact, - CTS_CF_NAME_VALUE, value)) { - contacts_svc_value_free(value); - return false; - } - contacts_svc_value_free(value); - } else { - return false; - } - } else { - if (CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_FIRST_STR, - m_abstractContact->getFirstName().c_str()) - || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_LAST_STR, - m_abstractContact->getLastName().c_str()) - || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_DISPLAY_STR, - m_abstractContact->getFullName().c_str()) - || - CTS_SUCCESS != - contacts_svc_value_set_str(value, CTS_NAME_VAL_PREFIX_STR, - m_abstractContact->getTitle().c_str())) - { - contacts_svc_value_free(value); - return false; - } - contacts_svc_value_free(value); - } - - /** - *If photo and ringtone uri information is not existed, add the information - * If photo and ringtone uri is existed,update the information - */ - CTSvalue *baseinfo = NULL; - if (CTS_SUCCESS != - contacts_svc_struct_get_value(m_platformContact, CTS_CF_BASE_INFO_VALUE, - &baseinfo)) { - baseinfo = contacts_svc_value_new(CTS_VALUE_CONTACT_BASE_INFO); - if (baseinfo) { - if (m_abstractContact->getPhotoIsSet()) { - if (CTS_SUCCESS != - contacts_svc_value_set_str(baseinfo, - CTS_BASE_VAL_IMG_PATH_STR, - m_abstractContact->getPhotoUri() - .c_str())) { - contacts_svc_value_free(baseinfo); - return false; - } - } - if (CTS_SUCCESS != - contacts_svc_value_set_str(baseinfo, - CTS_BASE_VAL_RINGTONE_PATH_STR, - m_abstractContact->getRingTonePath() - .c_str()) || - CTS_SUCCESS != - contacts_svc_struct_store_value(m_platformContact, - CTS_CF_BASE_INFO_VALUE, - baseinfo)) { - contacts_svc_value_free(baseinfo); - return false; - } - - contacts_svc_value_free(baseinfo); - } else { - return false; - } - } else { - const char * oldimgpath = NULL; - oldimgpath = contacts_svc_value_get_str(baseinfo, - CTS_BASE_VAL_IMG_PATH_STR); - - std::string stroldimgpath = ""; - if (NULL != oldimgpath) { - stroldimgpath = static_cast(oldimgpath); - } - - std::string strnewimgpath = m_abstractContact->getPhotoUri(); - if (stroldimgpath != strnewimgpath) { - if (CTS_SUCCESS != - contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_IMG_PATH_STR, - strnewimgpath.c_str())) { - contacts_svc_value_free(value); - return false; - } - } - - if (CTS_SUCCESS != - contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_RINGTONE_PATH_STR, - m_abstractContact->getRingTonePath(). - c_str())) { - return false; - } - contacts_svc_value_free(value); - } - - //save company information - CTSvalue *company = NULL; - company = contacts_svc_value_new(CTS_VALUE_COMPANY); - if (company) { - if (CTS_SUCCESS != - contacts_svc_value_set_str(company, CTS_COMPANY_VAL_NAME_STR, - m_abstractContact->getCompany().c_str()) - || - CTS_SUCCESS != - contacts_svc_struct_store_value(m_platformContact, - CTS_CF_COMPANY_VALUE, - company)) { - contacts_svc_value_free(company); - return false; - } - contacts_svc_value_free(value); - } else { - return false; - } - - return true; -} - -int ContactWrapper::getCustomTypeInContactsSvc(const std::string &typeName) -const -{ - int structFieldType = -1; - - LogDebug("typeName : " << typeName); - structFieldType = contacts_svc_find_custom_type(CTS_TYPE_CLASS_EXTEND_DATA, - const_cast(typeName. - c_str())); - if (CTS_ERR_DB_RECORD_NOT_FOUND == structFieldType) { - LogDebug("CTS_ERR_DB_RECORD_NOT_FOUND!!"); - structFieldType = contacts_svc_insert_custom_type( - CTS_TYPE_CLASS_EXTEND_DATA, - const_cast(typeName.c_str())); - if (CTS_SUCCESS > structFieldType) { - LogDebug("Create fail"); - } - } else if (CTS_SUCCESS > structFieldType) { - LogDebug("contacts_svc_find_custom_type is fail"); - } - - LogDebug("structFieldType : " << structFieldType); - return structFieldType; -} - -void ContactWrapper::printPlatformObject() -{ - LogDebug("entered"); -} - -void ContactWrapper::printAbstractObject() -{ - LogDebug("entered"); -} -} -} diff --git a/src/modules/tizen/Contact/ContactWrapper.h b/src/modules/tizen/Contact/ContactWrapper.h deleted file mode 100644 index f67e517..0000000 --- a/src/modules/tizen/Contact/ContactWrapper.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file ContactManager.h - * @author Lukasz Marek(l.marek@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_CONTACT_CONTACT_WRAPPER_H_ -#define WRTDEVICEAPIS_CONTACT_CONTACT_WRAPPER_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Contact { - -class ContactWrapper -{ - public: - explicit ContactWrapper(Api::IAddressBookObject::BookType type); - virtual ~ContactWrapper(); - Api::ContactPtr getAbstractContact() const; - void setAbstractContact(const Api::ContactPtr &contact); - CTSstruct* getPlatformContact() const; - //WARNING: calling this function will cause to store pointer inside private field - //Structure will be freed by this class when is not needed anymore. - //User should not modify nor free passed pointer. - void setPlatformContact(CTSstruct* contact); - - protected: - bool convertToPlatformObject(); - bool convertToAbstractObject(); - - Api::ContactPtr m_abstractContact; - CTSstruct* m_platformContact; - - private: - void freePlatformObject(); - void freeAbstractObject(); - bool convertToPlatformBaseData(); - bool convertToPlatformAddressObject(); - bool convertToPlatformEmailObject(); - bool convertToPlatformPhoneObject(); - bool convertToPlatformNicknameObject(); - bool convertToPlatformPhoneticnameObject(); - bool convertToPlatformGroupObject(); - bool convertToAbstractBaseData(); - bool convertToAbstractAddressObject(); - bool convertToAbstractEmailObject(); - bool convertToAbstractPhoneObject(); - bool convertToAbstractNicknameObject(); - bool convertToAbstractPhoneticnameObject(); - bool convertToAbstractGroupObject(); - int getCustomTypeInContactsSvc(const std::string &typeName) const; - //for debug purpose only - void printPlatformObject(); - //for debug purpose only - void printAbstractObject(); -}; - -typedef DPL::SharedPtr ContactWrapperPtr; - -} -} - -#endif // WRTDEVICEAPIS_CONTACT_CONTACT_WRAPPER_H_ diff --git a/src/modules/tizen/Contact/config.cmake b/src/modules/tizen/Contact/config.cmake deleted file mode 100644 index c8f2720..0000000 --- a/src/modules/tizen/Contact/config.cmake +++ /dev/null @@ -1,26 +0,0 @@ -get_current_path() - -pkg_search_module(contacts-service REQUIRED contacts-service) -pkg_search_module(pcrecpp REQUIRED libpcrecpp) -pkg_search_module(libdownload-agent REQUIRED libdownload-agent) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_CONTACT - ${contacts-service_INCLUDE_DIRS} - ${pcrecpp_INCLUDE_DIRS} - ${libdownload-agent_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_CONTACT - ${contacts-service_LIBRARIES} - ${pcrecpp_LIBRARIES} - ${libdownload-agent_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_CONTACT - ${CURRENT_PATH}/ContactManager.cpp - ${CURRENT_PATH}/AddressBook.cpp - ${CURRENT_PATH}/ContactWrapper.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DBus/Connection.cpp b/src/modules/tizen/DBus/Connection.cpp deleted file mode 100644 index 0278d59..0000000 --- a/src/modules/tizen/DBus/Connection.cpp +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include "Connection.h" -#include -#include -#include -#include -#include "Message.h" - -namespace WrtDeviceApis { -namespace DBus { -Connection::Connection() : - m_connection(NULL), - m_messageDispatcher(NULL), - m_connected(false) -{ - dbus_error_init(&m_error); - m_messageDispatcher = new MessageDispatcher(this); -} - -Connection::~Connection() -{ - assert(!m_connected && "DBus connection has not been closed."); - delete m_messageDispatcher; - if (dbus_error_is_set(&m_error)) { - dbus_error_free(&m_error); - } -} - -void Connection::open(DBusBusType bus) -{ - if (m_connected) { return; } - - m_connection = dbus_bus_get(bus, &m_error); - if (!m_connection || dbus_error_is_set(&m_error)) { - std::string message = m_error.message; - dbus_error_free(&m_error); - ThrowMsg(Commons::PlatformException, - "Couldn't attach to DBus system bus: " << message); - } - - dbus_connection_set_exit_on_disconnect(m_connection, FALSE); - - for (FilterSetIterator it = m_filters.begin(); it != m_filters.end(); - ++it) { - addFilterInternal(*it); - } - - if (!dbus_connection_set_watch_functions(m_connection, addWatch, - removeWatch, toggleWatch, this, - NULL)) { - ThrowMsg(Commons::PlatformException, "Couldn't set-up watch functions."); - } - - if (!dbus_connection_add_filter(m_connection, filterMessage, this, NULL)) { - ThrowMsg(Commons::PlatformException, - "Couldn't set signal handler callback."); - } - - m_connected = true; -} - -void Connection::close() -{ - LogDebug("ENTER"); - if (!m_connected) { return; } - - dbus_connection_remove_filter(m_connection, filterMessage, this); - - // Calls removeWatch() automagically. - if (!dbus_connection_set_watch_functions(m_connection, NULL, NULL, NULL, - NULL, NULL)) { - DPL::Mutex::ScopedLock lock(&m_watchesMutex); - WatchSetIterator it = m_watches.begin(); - for (; it != m_watches.end(); ++it) { - if (it->second->isEnabled()) { - m_messageDispatcher->removeDescriptor(it->second->getHandle(), - it->second->getType()); - } - } - m_watches.clear(); - } - - // TODO: think how to handle exception on filter removal; 1 - do nothing (now), - // 2 - remove the buggy one but throw an exception, 3 - remove the buggy one - // and don't throw any exception - for (FilterSetIterator it = m_filters.begin(); it != m_filters.end(); - ++it) { - removeFilterInternal(*it); - } - - dbus_connection_unref(m_connection); - - m_connected = false; -} - -void Connection::addFilter(const std::string& rule) -{ - if (m_connected) { - addFilterInternal(rule); - } - m_filters.insert(rule); -} - -void Connection::removeFilter(const std::string& rule) -{ - if (m_connected) { - removeFilterInternal(rule); - } - m_filters.erase(rule); -} - -void Connection::setWorkerThread(DPL::Thread* thread) -{ - assert(!m_connected && "Connection has already been established."); - m_messageDispatcher->SwitchToThread(thread); -} - -void Connection::addFilterInternal(const std::string& rule) -{ - assert(m_connection && "Connection has to be established first."); - dbus_bus_add_match(m_connection, rule.c_str(), &m_error); - if (dbus_error_is_set(&m_error)) { - std::string message = m_error.message; - dbus_error_free(&m_error); - ThrowMsg(Commons::InvalidArgumentException, "Invalid rule: " << message); - } -} - -void Connection::removeFilterInternal(const std::string& rule) -{ - assert(m_connection && "Connection has to be established first."); - dbus_bus_remove_match(m_connection, rule.c_str(), &m_error); - if (dbus_error_is_set(&m_error)) { - std::string message = m_error.message; - dbus_error_free(&m_error); - ThrowMsg(Commons::InvalidArgumentException, "Invalid rule: " << message); - } -} - -dbus_bool_t Connection::addWatch(DBusWatch* watch, void* data) -{ - LogDebug("ENTER"); - assert(data && "Connection should be passed as user data."); - Connection* this_ = static_cast(data); - WatchPtr wrapper(new Watch(watch)); - if (wrapper->isEnabled()) { - this_->m_messageDispatcher->addDescriptor(wrapper->getHandle(), - wrapper->getType()); - } - DPL::Mutex::ScopedLock lock(&this_->m_watchesMutex); - this_->m_watches[wrapper->getHandle()] = wrapper; - return TRUE; -} - -void Connection::removeWatch(DBusWatch* watch, void* data) -{ - LogDebug("ENTER"); - assert(data && "Connection should be passed as user data."); - Connection* this_ = static_cast(data); - Watch wrapper(watch); - if (wrapper.isEnabled()) { - this_->m_messageDispatcher->removeDescriptor(wrapper.getHandle(), - wrapper.getType()); - } - DPL::Mutex::ScopedLock lock(&this_->m_watchesMutex); - this_->m_watches.erase(wrapper.getHandle()); -} - -void Connection::toggleWatch(DBusWatch* watch, void* data) -{ - LogDebug("ENTER"); - assert(data && "Connection should be passed as user data."); - Connection* this_ = static_cast(data); - Watch wrapper(watch); - if (wrapper.isEnabled()) { - this_->m_messageDispatcher->addDescriptor(wrapper.getHandle(), - wrapper.getType()); - } else { - this_->m_messageDispatcher->removeDescriptor(wrapper.getHandle(), - wrapper.getType()); - } -} - -DBusHandlerResult Connection::filterMessage(DBusConnection* /*connection*/, - DBusMessage* message, - void* data) -{ - LogDebug("ENTER"); - if (data) { - Connection* this_ = static_cast(data); - MessagePtr msg; - if (message) { - LogInfo( - "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!"); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - - LogDebug("____HERE"); - FilterSetIterator it = this_->m_filters.begin(); - for (; it != this_->m_filters.end(); ++it) { - // TODO: extend following matching procedure to check not only - // interface's name. - if ((*it).find(msg->getInterface()) != std::string::npos) { - LogDebug("______emitting..."); - MessageEvent event(msg); - this_->EmitEvent(event); - LogDebug("______done"); - } - } - } else { - LogError("User-data not set, this should not happen!"); - } - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; -} - -Connection::MessageDispatcher::MessageDispatcher(Connection* connection) - : m_connection(connection) -{ - assert(m_connection && "Connection cannot be NULL."); - DPL::Event::ControllerEventHandler::Touch(); - DPL::Event::ControllerEventHandler::Touch(); -} - -Connection::MessageDispatcher::~MessageDispatcher() -{ - SwitchToThread(NULL); -} - -void Connection::MessageDispatcher::addDescriptor(DPL::WaitableHandle handle, - DPL::WaitMode::Type mode) -{ - LogDebug("ENTER"); - AddDescriptorEvent event(handle, mode); - DPL::Event::ControllerEventHandler::PostSyncEvent(event); -} - -void Connection::MessageDispatcher::removeDescriptor(DPL::WaitableHandle handle, - DPL::WaitMode::Type mode) -{ - LogDebug("ENTER"); - RemoveDescriptorEvent event(handle, mode); - DPL::Event::ControllerEventHandler::PostSyncEvent(event); -} - -void Connection::MessageDispatcher::OnEventReceived( - const AddDescriptorEvent& event) -{ - LogDebug("ENTER"); - DPL::WaitableHandleWatchSupport::InheritedContext()->AddWaitableHandleWatch( - this, - event.GetArg0(), - event.GetArg1()); -} - -void Connection::MessageDispatcher::OnEventReceived( - const RemoveDescriptorEvent& event) -{ - LogDebug("ENTER"); - DPL::WaitableHandleWatchSupport::InheritedContext()-> - RemoveWaitableHandleWatch(this, event.GetArg0(), event.GetArg1()); -} - -void Connection::MessageDispatcher::OnWaitableHandleEvent( - DPL::WaitableHandle waitableHandle, - DPL::WaitMode::Type mode) -{ - LogDebug("ENTER"); - { - DPL::Mutex::ScopedLock lock(&m_connection->m_watchesMutex); - WatchSetIterator it = m_connection->m_watches.find(waitableHandle); - if (it != m_connection->m_watches.end()) { - unsigned int flags = - (mode == DPL::WaitMode::Write ? DBUS_WATCH_WRITABLE - : DBUS_WATCH_READABLE); - while (!dbus_watch_handle(it->second->get(), flags)) { - LogError("Too few memory!"); - // TODO: add some check-point to not loop infinitely - } - } - // TODO: not sure if there is point in dispatching connection when watch not found? - } - dbus_connection_ref(m_connection->m_connection); - while (dbus_connection_dispatch(m_connection->m_connection) == - DBUS_DISPATCH_DATA_REMAINS) { - } - dbus_connection_unref(m_connection->m_connection); -} - -Connection::Watch::Watch(DBusWatch* watch) : m_watch(watch) -{ - assert(m_watch && "Watch cannot be NULL."); -} - -DPL::WaitableHandle Connection::Watch::getHandle() const -{ - return dbus_watch_get_unix_fd(m_watch); -} - -DPL::WaitMode::Type Connection::Watch::getType() const -{ - if ((dbus_watch_get_flags(m_watch) & DBUS_WATCH_WRITABLE) != 0) { - return DPL::WaitMode::Write; - } - return DPL::WaitMode::Read; -} - -bool Connection::Watch::isEnabled() const -{ - return (TRUE == dbus_watch_get_enabled(m_watch)); -} - -DBusWatch* Connection::Watch::get() const -{ - return m_watch; -} -} // DBus -} // WrtDeviceApis diff --git a/src/modules/tizen/DBus/Connection.h b/src/modules/tizen/DBus/Connection.h deleted file mode 100644 index 22afad7..0000000 --- a/src/modules/tizen/DBus/Connection.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DBUS_CONNECTION_H_ -#define WRTDEVICEAPIS_DBUS_CONNECTION_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "MessageEvent.h" - -namespace WrtDeviceApis { -namespace DBus { -class Connection : public DPL::Event::EventSupport -{ - public: - typedef DPL::Event::EventListener EventListener; - - public: - Connection(); - ~Connection(); - - void open(DBusBusType bus); - void close(); - void addFilter(const std::string& rule); - void removeFilter(const std::string& rule); - void setWorkerThread(DPL::Thread* thread); - - private: - DECLARE_GENERIC_EVENT_2(AddDescriptorEvent, - DPL::WaitableHandle, - DPL::WaitMode::Type) - - DECLARE_GENERIC_EVENT_2(RemoveDescriptorEvent, - DPL::WaitableHandle, - DPL::WaitMode::Type) - - class MessageDispatcher : - public DPL::Event::Controller::Type>, - private DPL::WaitableHandleWatchSupport::WaitableHandleListener - { - public: - explicit MessageDispatcher(Connection* connection); - ~MessageDispatcher(); - void addDescriptor(DPL::WaitableHandle handle, - DPL::WaitMode::Type mode); - void removeDescriptor(DPL::WaitableHandle handle, - DPL::WaitMode::Type mode); - - protected: - void OnEventReceived(const AddDescriptorEvent& event); - void OnEventReceived(const RemoveDescriptorEvent& event); - void OnWaitableHandleEvent(DPL::WaitableHandle waitableHandle, - DPL::WaitMode::Type mode); - - private: - Connection* m_connection; - }; - - class Watch : private DPL::Noncopyable - { - public: - explicit Watch(DBusWatch* watch); - - inline DPL::WaitableHandle getHandle() const; - inline DPL::WaitMode::Type getType() const; - inline bool isEnabled() const; - inline DBusWatch* get() const; - - private: - DBusWatch* m_watch; - }; - typedef DPL::SharedPtr WatchPtr; - - typedef std::map WatchSet; - typedef WatchSet::iterator WatchSetIterator; - - typedef std::set FilterSet; - typedef FilterSet::iterator FilterSetIterator; - - private: - static dbus_bool_t addWatch(DBusWatch* watch, - void* data); - static void removeWatch(DBusWatch* watch, - void* data); - static void toggleWatch(DBusWatch* watch, - void* data); - static DBusHandlerResult filterMessage(DBusConnection* connection, - DBusMessage* message, - void* data); - - private: - void addFilterInternal(const std::string& rule); - void removeFilterInternal(const std::string& rule); - - private: - DBusConnection* m_connection; - DBusError m_error; - - MessageDispatcher* m_messageDispatcher; - bool m_connected; - FilterSet m_filters; - WatchSet m_watches; - DPL::Mutex m_watchesMutex; -}; - -typedef DPL::SharedPtr ConnectionPtr; -} // DBus -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_DBUS_CONNECTION_H_ diff --git a/src/modules/tizen/DBus/Message.cpp b/src/modules/tizen/DBus/Message.cpp deleted file mode 100644 index 592d65d..0000000 --- a/src/modules/tizen/DBus/Message.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include "Message.h" -#include -#include - -namespace WrtDeviceApis { -namespace DBus { -Message::Message(DBusMessage* message) : m_message(message) -{ - assert(m_message && "Message cannot be NULL."); - addRef(); -} - -Message::Message(int type) -{ - m_message = dbus_message_new(type); - if (!m_message) { - ThrowMsg(Commons::PlatformException, "Out of memory."); - } - addRef(); -} - -Message::~Message() -{ - unref(); -} - -int Message::getType() const -{ - return dbus_message_get_type(m_message); -} - -std::string Message::getInterface() const -{ - const char* interface = dbus_message_get_interface(m_message); - return (interface ? interface : std::string()); -} - -std::string Message::getPath() const -{ - const char* path = dbus_message_get_path(m_message); - return (path ? path : std::string()); -} - -bool Message::isSignal(const std::string& name) const -{ - return (dbus_message_is_signal(m_message, - getInterface().c_str(), - name.c_str()) - == TRUE); -} - -Message::ReadIterator Message::getReadIterator() const -{ - return ReadIterator(new ReadIterator_(m_message)); -} - -void Message::addRef() -{ - m_message = dbus_message_ref(m_message); -} - -void Message::unref() -{ - dbus_message_unref(m_message); -} - -Message::ReadIterator_::ReadIterator_(DBusMessage* message) -{ - assert(message && "Message cannot be NULL."); - m_valid = dbus_message_iter_init(message, &m_iterator); -} - -bool Message::ReadIterator_::next() -{ - if (!m_valid) { - Throw(Commons::OutOfRangeException); - } - return (m_valid = (dbus_message_iter_next(&m_iterator) == TRUE)); -} - -bool Message::ReadIterator_::isValid() const -{ - return m_valid; -} - -int Message::ReadIterator_::getArgType() const -{ - if (!m_valid) { - Throw(Commons::OutOfRangeException); - } - return dbus_message_iter_get_arg_type(&m_iterator); -} - -int Message::ReadIterator_::getInt() const -{ - return static_cast(getArgBasic(DBUS_TYPE_INT32)); -} - -std::string Message::ReadIterator_::getString() const -{ - return getArgBasic(DBUS_TYPE_STRING); -} - -template -T Message::ReadIterator_::getArgBasic(int type) const -{ - if (getArgType() != type) { - ThrowMsg(Commons::ConversionException, "Type mismatch."); - } - - if (!m_valid) { - Throw(Commons::OutOfRangeException); - } - - T result; - dbus_message_iter_get_basic(&m_iterator, &result); - return result; -} -} // DBus -} // WrtDeviceApis diff --git a/src/modules/tizen/DBus/Message.h b/src/modules/tizen/DBus/Message.h deleted file mode 100644 index 9ed30b6..0000000 --- a/src/modules/tizen/DBus/Message.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DBUS_MESSAGE_H_ -#define WRTDEVICEAPIS_DBUS_MESSAGE_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace DBus { -class Message : private DPL::Noncopyable -{ - private: - class ReadIterator_; - - public: - typedef DPL::SharedPtr ReadIterator; - - public: - explicit Message(DBusMessage* message); - explicit Message(int type); - ~Message(); - - int getType() const; - std::string getInterface() const; - std::string getPath() const; - bool isSignal(const std::string& name) const; - ReadIterator getReadIterator() const; - - private: - // It doesn't need to be non-copyable - DBusMessageIter doesn't require it. - class ReadIterator_ - { - public: - explicit ReadIterator_(DBusMessage* message); - - bool next(); - bool isValid() const; - - int getArgType() const; - - int getInt() const; - std::string getString() const; - - private: - template - T getArgBasic(int type) const; - - private: - mutable DBusMessageIter m_iterator; - bool m_valid; - }; - - private: - inline void addRef(); - inline void unref(); - - private: - DBusMessage* m_message; -}; - -typedef DPL::SharedPtr MessagePtr; -} // DBus -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_DBUS_MESSAGE_H_ diff --git a/src/modules/tizen/DBus/MessageEvent.h b/src/modules/tizen/DBus/MessageEvent.h deleted file mode 100644 index a37cc55..0000000 --- a/src/modules/tizen/DBus/MessageEvent.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DBUS_MESSAGEEVENT_H_ -#define WRTDEVICEAPIS_DBUS_MESSAGEEVENT_H_ - -#include -#include "Message.h" - -namespace WrtDeviceApis { -namespace DBus { -DECLARE_GENERIC_EVENT_1(MessageEvent, MessagePtr) -} // DBus -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_DBUS_MESSAGEEVENT_H_ diff --git a/src/modules/tizen/DBus/config.cmake b/src/modules/tizen/DBus/config.cmake deleted file mode 100644 index 636b909..0000000 --- a/src/modules/tizen/DBus/config.cmake +++ /dev/null @@ -1,16 +0,0 @@ -get_current_path() - -pkg_search_module(dbus REQUIRED dbus-1) - -set(INCLUDES_IMPLEMENTATION_DBUS - ${dbus_INCLUDE_DIRS} -) - -set(LIBS_IMPLEMENTATION_DBUS - ${dbus_LIBRARIES} -) - -set(SRCS_IMPLEMENTATION_DBUS - ${CURRENT_PATH}/Connection.cpp - ${CURRENT_PATH}/Message.cpp -) diff --git a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp deleted file mode 100644 index f4ec621..0000000 --- a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.cpp +++ /dev/null @@ -1,836 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file AppLauncherManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @author Yujie Zeng (yj.zeng@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "AppLauncherManager.h" - -using namespace WrtPlugins::Api; -using namespace WrtPlugins::Api::AppLauncher; - -namespace { -const char* EMPTY_STRING_PATTERN = "^\\s*$"; -const char* EMAIL_PATTERN = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+$"; -//According to RFC1738,any character is possible in http address -const char* HTTP_ADDRESS_PATTERN = "^(http(s)?://)?\\w+.*$"; -const char* FILE_ADDRESS_PATTERN = "^.*\\..*$"; - -const char* APPLICATION_ALARM = "org.tizen.clock"; // alarm has been included in clock app -const char* APPLICATION_BROWSER = "org.tizen.browser"; -const char* APPLICATION_CALCULATOR = "org.tizen.calculator"; -const char* APPLICATION_CALENDAR = "org.tizen.efl-calendar"; -const char* APPLICATION_CAMERA = "org.tizen.camera-app"; -const char* APPLICATION_CONTACTS = "org.tizen.contacts"; -const char* APPLICATION_FILES = "org.tizen.myfile"; -const char* APPLICATION_GAMES = ""; -const char* APPLICATION_MAIL = "org.tizen.email"; -const char* APPLICATION_MEDIAPLAYER = "org.tizen.music-player"; -const char* APPLICATION_MESSAGING = "org.tizen.message"; -const char* APPLICATION_PHONECALL = "org.tizen.dialer"; -const char* APPLICATION_PHONECALL_CALLING = "org.tizen.call"; -const char* APPLICATION_PICTURES = "org.tizen.gallery"; -const char* APPLICATION_PICTURES_IMG_PATH = "org.tizen.image-viewer"; -const char* APPLICATION_PROG_MANAGER = "org.tizen.taskmgr"; -const char* APPLICATION_SETTINGS = "org.tizen.setting"; -const char* APPLICATION_TASKS = "org.tizen.dailybriefing"; -const char* APPLICATION_WIDGET_MANAGER = "org.tizen.wrt-test-ui"; -const char* APPLICATION_WIDGET = "org.tizen."; -const char* APPLICATION_EMPTY = ""; - -const char* WIDGET_URI_PREFIX = "widget://"; - -const int SUCCESS_LAUNCHER = 0; -const int ERROR_LAUNCHER_INVALID_URI = 1; -const int ERROR_LAUNCHER_INVALID_PARAMETER = 2; -const int ERROR_LAUNCHER_EXECUTION_ERROR = 3; -} - -namespace WrtPlugins { -namespace Platform { -std::map AppLauncherManager::m_applicationTypesByPath; -std::map AppLauncherManager::m_applicationTypesByName; -std::vector AppLauncherManager::m_installedApplications; -std::vector AppLauncherManager::m_installedApplicationsNames; - -AppLauncherManager::AppLauncherManager() -{ - LogDebug("entered"); - static bool initialized = initializeApplicationList(); - (void) initialized; -} - -AppLauncherManager::~AppLauncherManager() -{ - LogDebug("entered"); -} - -bool AppLauncherManager::initializeApplicationList() -{ - //application paths - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_ALARM, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_BROWSER, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_CALCULATOR, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_CALENDAR, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_CAMERA, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_CONTACTS, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_FILES, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_GAMES, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_MAIL, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_MEDIAPLAYER, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_MESSAGING, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_PHONECALL, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_PICTURES, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_PROG_MANAGER, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_SETTINGS, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_TASKS, - APPLICATION_EMPTY)); - m_applicationTypesByPath.insert(std::pair( - APPLICATION_TYPE_WIDGET_MANAGER, - APPLICATION_EMPTY)); - //application names - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_ALARM, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_BROWSER, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_CALCULATOR, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_CALENDAR, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_CAMERA, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_CONTACTS, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_FILES, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_GAMES, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_MAIL, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_MEDIAPLAYER, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_MESSAGING, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_PHONECALL, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_PICTURES, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_PROG_MANAGER, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_SETTINGS, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_TASKS, - APPLICATION_EMPTY)); - m_applicationTypesByName.insert(std::pair( - APPLICATION_TYPE_WIDGET_MANAGER, - APPLICATION_EMPTY)); - - bool registered_application = false; // A variable that gets set if the current pkg_name is needed by WAC spec, needless of weather the package is visible or not. - app_info info = {}; - unsigned int count = record_count(COUNT_MENU, &info); - LogDebug("number of registered applications: " << count); - - DPL::ScopedFree infoAll(static_cast(calloc( - count, - sizeof( - app_info)))); - if (infoAll.Get()) { - if (!record_get(GET_MENU, infoAll.Get())) { - LogError("error during executing record_get() function"); - return false; - } - for (unsigned int i = 0; i < count; i++) { - LogDebug("pkg_name " << infoAll.Get()[i].pkg_name); - LogDebug("app_path " << infoAll.Get()[i].app_path); - LogDebug("app_name " << infoAll.Get()[i].app_name); - registered_application = false; - if (infoAll.Get()[i].app_path == NULL || - infoAll.Get()[i].app_name == NULL) { - LogDebug("Not Registered."); - LogDebug("-----"); - continue; - } - if (0 == - strncmp(APPLICATION_ALARM, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_ALARM] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_ALARM] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_BROWSER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_BROWSER] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_BROWSER] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_CALCULATOR, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_CALCULATOR] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_CALCULATOR] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_CALENDAR, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_CALENDAR] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_CALENDAR] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_CAMERA, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_CAMERA] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_CAMERA] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_CONTACTS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_CONTACTS] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_CONTACTS] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_FILES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_FILES] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_FILES] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_GAMES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_GAMES] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_GAMES] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_MAIL, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_MAIL] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_MAIL] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_MEDIAPLAYER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_MEDIAPLAYER] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_MEDIAPLAYER] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_MESSAGING, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_MESSAGING] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_MESSAGING] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_PHONECALL, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_PHONECALL] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_PHONECALL] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_PICTURES, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_PICTURES] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_PICTURES] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_PROG_MANAGER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_PROG_MANAGER] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_PROG_MANAGER] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_SETTINGS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_SETTINGS] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_SETTINGS] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_TASKS, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_TASKS] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_TASKS] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (0 == - strncmp(APPLICATION_WIDGET_MANAGER, infoAll.Get()[i].pkg_name, - NAME_LEN)) { - m_applicationTypesByPath[APPLICATION_TYPE_WIDGET_MANAGER] = - infoAll.Get()[i].app_path; - m_applicationTypesByName[APPLICATION_TYPE_WIDGET_MANAGER] = - infoAll.Get()[i].app_name; - registered_application = true; - } - if (infoAll.Get()[i].visible == 0 && registered_application == - false) { - LogDebug("Not Registered."); - LogDebug("-----"); - continue; - } - m_installedApplications.push_back(infoAll.Get()[i].app_path); - m_installedApplicationsNames.push_back(infoAll.Get()[i].app_name); - LogDebug("Registered."); - LogDebug("-----"); - } - } - return true; -} - -ApplicationType AppLauncherManager::getRegisteredApplicationType( - const std::string &name) const -{ - if (!name.empty()) { - std::map::const_iterator it; - for (it = m_applicationTypesByPath.begin(); - it != m_applicationTypesByPath.end(); - ++it) { - if (it->second == name) { - return it->first; - } - } - } - return APPLICATION_TYPE_UNDEFINED; -} - -bool AppLauncherManager::isRegisteredApplication(const std::string &name) const -{ - if (name.empty()) { - return false; - } - std::vector::const_iterator pos = - find(m_installedApplications.begin(), - m_installedApplications.end(), name); - return pos != m_installedApplications.end(); -} - -bool AppLauncherManager::validateHttpAddress(const std::string &value) const -{ - if (!pcrecpp::RE(HTTP_ADDRESS_PATTERN).FullMatch(value)) { - LogDebug("not valid paterrn of http address"); - return false; - } - return true; -} - -bool AppLauncherManager::isFilePath(const std::string &value) const -{ - if (!pcrecpp::RE(FILE_ADDRESS_PATTERN).FullMatch(value)) { - return false; - } - return true; -} - -bool AppLauncherManager::validateEmailAddress(const std::string &value) const -{ - if (!pcrecpp::RE(EMAIL_PATTERN).FullMatch(value)) { - LogDebug("not valid paterrn of email address"); - return false; - } - return true; -} - -std::string AppLauncherManager::getRealPath(const std::string &path) const -{ - Try - { - Api::Filesystem::IPathPtr currentPath = Api::Filesystem::IPath::create( - path); - return currentPath->getFullPath(); - } - Catch(Commons::Exception) - { - LogError("invalid path"); - } - return std::string(); -} - -std::string AppLauncherManager::getPathFromApplicationName( - const std::string &applicationName) const -{ - if (0 == applicationName.find(WIDGET_URI_PREFIX) && std::string::npos != - applicationName.find("?")) { - //uri format is: widget://{widgetId}?wname={WidgetName} - LogDebug("found widget:// URI"); - std::string uri = applicationName; - uri.erase(0, strlen(WIDGET_URI_PREFIX)); //remove widget://part - std::string widgetId = uri.substr(0, uri.find("?")); - uri.erase(0, widgetId.size() + 7); //remove widget id and "?wname=" string, so uri contains only widget name now - std::string packageName = APPLICATION_WIDGET + widgetId; - LogDebug( - "Widget id: " << widgetId << ", widget name: " << uri << - ", package: " << packageName); - app_info info = { 0, }; - strncpy(info.pkg_name, packageName.c_str(), NAME_LEN); - if (record_get(GET_ONE_RECORD_BY_PKG_NAME, &info)) { - if (info.app_path && info.app_name && uri == info.app_name) { - return std::string(info.app_path); - } - } - } - for (size_t i = 0; i < m_installedApplicationsNames.size(); ++i) { - if (m_installedApplicationsNames[i] == applicationName) { - return m_installedApplications[i]; - } - } - return std::string(); -} - -std::string AppLauncherManager::getPathFromPackageName( - const std::string &packageName) const -{ - app_info info = { 0, }; - strncpy(info.pkg_name, packageName.c_str(), NAME_LEN); - if (record_get(GET_ONE_RECORD_BY_PKG_NAME, &info)) { - LogDebug("pkg_name " << info.pkg_name); - LogDebug("app_path " << info.app_path); - LogDebug("app_name " << info.app_name); - if (info.app_path) { - return std::string(info.app_path); - } - } - return std::string(); -} - -std::string AppLauncherManager::getPackageNameFromPath(const std::string &path) -const -{ - app_info info = { 0, }; - strncpy(info.app_path, path.c_str(), PATH_LEN); - if (record_get(GET_ONE_RECORD_BY_APP_PATH, &info)) { - LogDebug("pkg_name " << info.pkg_name); - LogDebug("app_path " << info.app_path); - LogDebug("app_name " << info.app_name); - if (info.app_path) { - return std::string(info.pkg_name); - } - } - return std::string(); -} - -int AppLauncherManager::launchApplicationFileInternal( - const std::string &uriParameter, - const std::vector &applicationParams) -{ - LogDebug("entered with uriParameter: '" << uriParameter << "'"); - ApplicationType appType = getRegisteredApplicationType(uriParameter); - if (!isRegisteredApplication(uriParameter)) { - LogDebug("Its not registered application"); - return ERROR_LAUNCHER_INVALID_URI; - } - //try to launch as package using aul - std::string packageName = getPackageNameFromPath(uriParameter); - if (!packageName.empty()) { - LogDebug("executing as package, package name " << packageName); - //check parameters for empty or extra spaces - std::vector params; - std::vector::const_iterator it; - for (it = applicationParams.begin(); - it != applicationParams.end(); - ++it) { - std::string param(Commons::String::trim(*it)); - if (param.empty()) { - continue; - } - params.push_back(param); - } - bundle *kb = NULL; - if (params.size() > 0) { - if (appType == APPLICATION_TYPE_PHONECALL) { - //phone number is provided. - //replace package to make a call, not run application with this functionality - - packageName = APPLICATION_PHONECALL_CALLING; - kb = bundle_create(); - if (!kb) { - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "launch-type", "MO") < 0) { // "MO" : normal call, "EMERGENCY" : emergency call - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "number", params.front().c_str()) < 0) { - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - LogDebug("running with number: " << params.front()); - } else if (appType == APPLICATION_TYPE_BROWSER) { - if (!validateHttpAddress(params.front())) { - return ERROR_LAUNCHER_INVALID_PARAMETER; - } - kb = bundle_create(); - if (!kb) { - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "url", params.front().c_str()) < 0) { - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - LogDebug("running with url: " << params.front().c_str()); - } else if (appType == APPLICATION_TYPE_MEDIAPLAYER) { - LogDebug("opening file: " << getRealPath(params.front()).c_str()); - int result = aul_open_file(getRealPath(params.front()).c_str()); - if (result < 0) { - LogError("Cannot open file, launch application only"); - } else { - return SUCCESS_LAUNCHER; - } - } else if (appType == APPLICATION_TYPE_FILES) { - struct stat sb; - if (stat(getRealPath(params.front()).c_str(), &sb) == -1) { - LogError( - "The selected path does not exist: " << - getRealPath(params.front()).c_str()); - } else { - if (!S_ISDIR(sb.st_mode)) { - LogDebug("opening file: " << getRealPath( - params.front()).c_str()); - int result = aul_open_file(getRealPath( - params.front()).c_str()); - if (result < 0) { - LogError( - "Cannot open file, launch application only"); - } else { - return SUCCESS_LAUNCHER; - } - } else { - kb = bundle_create(); - if (!kb) { - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "path", - getRealPath(params.front()).c_str()) < - 0) { - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - LogDebug("running with folder path: " << - getRealPath(params.front()).c_str()); - } - } - } else if (appType == APPLICATION_TYPE_PICTURES) { - //open photo with image path - //replace package to show only one picture with given image path - packageName = APPLICATION_PICTURES_IMG_PATH; - kb = bundle_create(); - if (!kb) { - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "View Mode", "SINGLE") < 0) { - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - if (bundle_add(kb, "Path", - getRealPath(params.front()).c_str()) < 0) { - bundle_free(kb); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - LogDebug("running with img file path: " << - getRealPath(params.front()).c_str()); - } - //TODO: add more parameters when needed - } - int result = aul_launch_app(packageName.c_str(), kb); - if (kb) { - bundle_free(kb); - } - if (result > 0) { - return SUCCESS_LAUNCHER; - } - LogError("aul_launch_app result " << result); - return ERROR_LAUNCHER_EXECUTION_ERROR; - } - return ERROR_LAUNCHER_EXECUTION_ERROR; -} - -int AppLauncherManager::launchApplicationInternal( - const ApplicationUriType uriType, - const std::string &uriParameter, - const std::vector &applicationParams) -{ - LogDebug( - "entered with uriType: " << uriType << ", uriParameter: " << - uriParameter); - if (APPLICATION_URI_TYPE_HTTP == uriType) { - std::string application = - m_applicationTypesByPath[APPLICATION_TYPE_BROWSER]; - std::vector params; - if (Commons::String::startsWith(uriParameter, "http://")) { - params.push_back(uriParameter); - } else if (!pcrecpp::RE(EMPTY_STRING_PATTERN).FullMatch(uriParameter)) - { - params.push_back("http://" + uriParameter); - } - return launchApplicationFileInternal(application, params); - } else if (APPLICATION_URI_TYPE_HTTPS == uriType) { - std::string application = - m_applicationTypesByPath[APPLICATION_TYPE_BROWSER]; - std::vector params; - if (Commons::String::startsWith(uriParameter, "https://")) { - params.push_back(uriParameter); - } else if (!pcrecpp::RE(EMPTY_STRING_PATTERN).FullMatch(uriParameter)) - { - params.push_back("https://" + uriParameter); - } - return launchApplicationFileInternal(application, params); - } else if (APPLICATION_URI_TYPE_TEL == uriType) { - std::string application = - m_applicationTypesByPath[APPLICATION_TYPE_PHONECALL]; - std::vector params; - params.push_back(uriParameter); - return launchApplicationFileInternal(application, params); - } else if (APPLICATION_URI_TYPE_MAILTO == uriType) { - std::string application = - m_applicationTypesByPath[APPLICATION_TYPE_MAIL]; - std::vector params; - params.push_back(uriParameter); - return launchApplicationFileInternal(application, params); - } else if (APPLICATION_URI_TYPE_SMS == uriType) { - std::string application = - m_applicationTypesByPath[APPLICATION_TYPE_MESSAGING]; - std::vector params; - params.push_back(uriParameter); - return launchApplicationFileInternal(application, params); - } else if (APPLICATION_URI_TYPE_FILE == uriType) { - return launchApplicationFileInternal(uriParameter, applicationParams); - } else if (APPLICATION_URI_TYPE_APPLICATION_BY_NAME == uriType) { - std::string application = getPathFromApplicationName(uriParameter); - return launchApplicationFileInternal(application, applicationParams); - } else { - return ERROR_LAUNCHER_INVALID_URI; - } - return SUCCESS_LAUNCHER; -} - -std::string AppLauncherManager::getDefaultApplicationByMimeInternal( - const std::string &mime) const -{ - LogDebug("entered with mime: " << mime); - const int bufferSize = 1024; - char buffer[bufferSize] = { 0 }; - int result = aul_get_defapp_from_mime(mime.c_str(), buffer, bufferSize - 1); - if (AUL_R_OK == result) { - LogDebug("returning default application"); - return std::string(buffer); - } else { - LogError("aul_get_defapp_from_mime failed, error code " << result); - Throw(Commons::PlatformException); - } - return std::string(); -} - -void AppLauncherManager::OnRequestReceived( - const EventGetDefaultApplicationPtr &event) -{ - LogDebug("entered"); - Try - { - std::string result = getDefaultApplicationByMimeInternal(event->getMime()); - event->setApplicationFullPath(result); - event->setExceptionCode(Commons::ExceptionCodes::None); - } - Catch(Commons::PlatformException) - { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } -} - -void AppLauncherManager::OnRequestReceived( - const EventGetInstalledApplicationsPtr &event) -{ - LogDebug("entered"); - std::vector::const_iterator it1; - for (it1 = m_installedApplications.begin(); - it1 != m_installedApplications.end(); - ++it1) { - event->addApplicationFullPath(*it1); - } - for (it1 = m_installedApplicationsNames.begin(); - it1 != m_installedApplicationsNames.end(); - ++it1) { - event->addApplicationName(*it1); - } - std::map::const_iterator it2; - for (it2 = m_applicationTypesByPath.begin(); - it2 != m_applicationTypesByPath.end(); - ++it2) { - event->addApplicationTypeByPath(*it2); - } - for (it2 = m_applicationTypesByName.begin(); - it2 != m_applicationTypesByName.end(); - ++it2) { - event->addApplicationTypeByName(*it2); - } - event->setExceptionCode(Commons::ExceptionCodes::None); -} - -void AppLauncherManager::OnRequestReceived( - const EventLaunchApplicationPtr &event) -{ - LogDebug("entered"); - ApplicationUriType uriType = event->getApplicationUriType(); - std::string uriParam = event->getApplicationUriParam(); - std::vector parameters = event->getApplicationParameters(); - int result = launchApplicationInternal(uriType, uriParam, parameters); - if (result == SUCCESS_LAUNCHER) { - event->setExceptionCode(Commons::ExceptionCodes::None); - } else if (result == ERROR_LAUNCHER_INVALID_PARAMETER || - result == ERROR_LAUNCHER_INVALID_URI) { - event->setExceptionCode( - Commons::ExceptionCodes::InvalidArgumentException); - } else { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } -} -} -} diff --git a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h b/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h deleted file mode 100644 index d540831..0000000 --- a/src/modules/tizen/DEPRACATED/AppLauncher/AppLauncherManager.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file AppLauncherManager.h - * @author Lukasz Marek (l.marek@samsung.com) - * @author Yujie Zeng (yj.zeng@samsung.com) - * @version 0.1 - */ - -#ifndef _SLP20__APPLAUNCHER_MANAGER_H_ -#define _SLP20__APPLAUNCHER_MANAGER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager -{ - public: - AppLauncherManager(); - virtual ~AppLauncherManager(); - protected: - virtual void OnRequestReceived( - const Api::AppLauncher::EventGetDefaultApplicationPtr &event); - virtual void OnRequestReceived( - const Api::AppLauncher::EventGetInstalledApplicationsPtr &event); - virtual void OnRequestReceived( - const Api::AppLauncher::EventLaunchApplicationPtr &event); - virtual bool isRegisteredApplication(const std::string &name) const; - virtual Api::AppLauncher::ApplicationType getRegisteredApplicationType( - const std::string &name) const; - virtual std::string getRealPath(const std::string &path) const; - virtual bool validateHttpAddress(const std::string &value) const; - virtual bool validateEmailAddress(const std::string &value) const; - virtual bool isFilePath(const std::string &value) const; - - private: - bool initializeApplicationList(); - std::string getPathFromApplicationName(const std::string &applicationName) - const; - std::string getPathFromPackageName(const std::string &packageName) const; - std::string getPackageNameFromPath(const std::string &path) const; - std::string getDefaultApplicationByMimeInternal(const std::string &mime) - const; - int launchApplicationInternal( - const Api::AppLauncher::ApplicationUriType uriType, - const std::string &uriParameter, - const std::vector &applicationParams); - int launchApplicationFileInternal(const std::string &uriParameter, - const std::vector &applicationParam); - static std::map m_applicationTypesByPath; - static std::map m_applicationTypesByName; - static std::vector m_installedApplications; - static std::vector m_installedApplicationsNames; -}; - -typedef DPL::SharedPtr AppLauncherManagerPtr; -} -} - -#endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */ diff --git a/src/modules/tizen/DEPRACATED/AppLauncher/config.cmake b/src/modules/tizen/DEPRACATED/AppLauncher/config.cmake deleted file mode 100644 index 4b6dddb..0000000 --- a/src/modules/tizen/DEPRACATED/AppLauncher/config.cmake +++ /dev/null @@ -1,48 +0,0 @@ -get_current_path() - -pkg_search_module(glib REQUIRED glib-2.0) -pkg_search_module(aul REQUIRED aul) -pkg_search_module(pcre REQUIRED libpcrecpp) -pkg_search_module(dmi REQUIRED desktop-manager-internal) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_APPLAUNCHER - ${glib_INCLUDE_DIRS} - ${pcre_INCLUDE_DIRS} - ${aul_INCLUDE_DIRS} - ${dmi_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_APPLAUNCHER - ${glib_LIBRARIES} - ${pcre_LIBRARIES} - ${aul_LIBRARIES} - ${dmi_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_APPLAUNCHER - ${CURRENT_PATH}/../../API/Filesystem/IManager.cpp - ${CURRENT_PATH}/../../API/Filesystem/IPath.cpp - ${CURRENT_PATH}/../../API/Filesystem/INode.cpp - ${CURRENT_PATH}/../../API/Filesystem/IStream.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventCopy.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventFind.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventResolve.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventMove.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventRemove.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventOpen.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventListNodes.cpp - ${CURRENT_PATH}/../../API/Filesystem/EventReadText.cpp - ${CURRENT_PATH}/../../API/Filesystem/NodeFilter.cpp - ${CURRENT_PATH}/../../API/Filesystem/PathUtils.cpp - ${CURRENT_PATH}/../Filesystem/System.cpp - ${CURRENT_PATH}/../Filesystem/Manager.cpp - ${CURRENT_PATH}/../Filesystem/Utils.cpp - ${CURRENT_PATH}/../Filesystem/Path.cpp - ${CURRENT_PATH}/../Filesystem/Node.cpp - ${CURRENT_PATH}/../Filesystem/Stream.cpp - ${CURRENT_PATH}/../Filesystem/NodeFilterMatcher.cpp - ${CURRENT_PATH}/AppLauncherManager.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.cpp b/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.cpp deleted file mode 100644 index 5c189d3..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include "AttributeInfo.h" -#include - -namespace WrtPlugins { -namespace Platform { -namespace Camera { -namespace AttributeInfo { -ArrayOfInt toArrayOfInt(MMHandleType handle, - const char* name) -{ - ArrayOfInt result; - MMCamAttrsInfo info = {}; - if (mm_camcorder_get_attribute_info(handle, name, &info) < 0) { - ThrowMsg(Commons::PlatformException, - "Error while reading attribute info."); - } else { - if ((MM_CAM_ATTRS_TYPE_INT != info.type) || - (MM_CAM_ATTRS_VALID_TYPE_INT_ARRAY != info.validity_type)) { - ThrowMsg(Commons::ConversionException, "Unable to convert."); - } - result.assign(info.int_array.array, - info.int_array.array + info.int_array.count); - } - return result; -} -} // AttributeInfo -} // Camera -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.h b/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.h deleted file mode 100644 index b529792..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/AttributeInfo.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_CAMERA_ATTRIBUTEINFO_H_ -#define WRTDEVICEAPIS_CAMERA_ATTRIBUTEINFO_H_ - -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Camera { -namespace AttributeInfo { -typedef std::vector ArrayOfInt; - -ArrayOfInt toArrayOfInt(MMHandleType handle, - const char* name); -} // AttributeInfo -} // Camera -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_CAMERA_ATTRIBUTEINFO_H_ diff --git a/src/modules/tizen/DEPRACATED/Camera/Camera.cpp b/src/modules/tizen/DEPRACATED/Camera/Camera.cpp deleted file mode 100644 index 6e87e6f..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/Camera.cpp +++ /dev/null @@ -1,929 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#include "Camera.h" -#include -#include -#include -#include -#include -#include "mm_camcorder.h" -#include -#include "AttributeInfo.h" - -namespace { -const unsigned int DEFAULT_CAPTURE_WIDTH = 640; -const unsigned int DEFAULT_CAPTURE_HEIGHT = 480; -} // namespace - -namespace WrtPlugins { -namespace Platform { -namespace Camera { -//............................................................................. -Camera::Camera() : - m_camcorderHandle(NULL) -{ - m_camcorderPreset.videodev_type = MM_VIDEO_DEVICE_NONE, - m_camcorderPreset.reserved[0] = 0; - m_camcorderPreset.reserved[1] = 0; - m_camcorderPreset.reserved[2] = 0; - m_camcorderPreset.reserved[3] = 0; - - pthread_mutex_init(&m_stateMutex, NULL); - m_state = IDLE; - DPL::Event::ControllerEventHandler::Touch(); -} -//............................................................................. -void Camera::init(MMCamPreset preset) -{ - LogDebug("Creating camcorder"); - memcpy(&m_camcorderPreset, &preset, sizeof(m_camcorderPreset)); - int err = mm_camcorder_create(&m_camcorderHandle, &m_camcorderPreset); - - logCamcorderState(); - if (err != MM_ERROR_NONE) { - LogError("Creating camcorder's failed !!! " << err); - Throw(Commons::UnknownException); - } -} -//............................................................................. -Camera::~Camera() -{ - LogDebug(__FUNCTION__); - - DPL::Event::ControllerEventHandler::SwitchToThread(NULL); - - m_state = PROCESSING; - pthread_mutex_lock(&m_stateMutex); - { - m_state = PROCESSING; - - mm_camcorder_set_message_callback(m_camcorderHandle, NULL, NULL); - mm_camcorder_capture_stop(m_camcorderHandle); - mm_camcorder_stop(m_camcorderHandle); - } - pthread_mutex_unlock(&m_stateMutex); - - unRealizeCamcoder(); - mm_camcorder_destroy(m_camcorderHandle); - pthread_mutex_destroy(&m_stateMutex); -} -//............................................................................. -void Camera::tryIsInvalidParameterError(int errorCode) -{ - switch (errorCode) { - case MM_ERROR_COMMON_INVALID_ATTRTYPE: - case MM_ERROR_COMMON_INVALID_PERMISSION: - case MM_ERROR_COMMON_OUT_OF_ARRAY: - case MM_ERROR_COMMON_OUT_OF_RANGE: - case MM_ERROR_COMMON_ATTR_NOT_EXIST: - LogDebug("Invalid Parameter error"); - Throw(Commons::InvalidArgumentException); - } - LogDebug("it's not Invalid Parameter error"); -} -//............................................................................. -int Camera::lockCameraMutex(Camera *camera) -{ - LogDebug("Trying to lock camera mutex"); - pthread_mutex_lock(&(camera->m_stateMutex)); - LogDebug(".. - locked"); - - if (Camera::PROCESSING == camera->m_state) { - LogWarning( - "Camera object is being killed or performing some locked operations, but it's receiving the message "); - pthread_mutex_unlock(&(camera->m_stateMutex)); - return -1; - } - - if (Camera::IDLE == camera->m_state) { - LogWarning( - "Message has been received, but no one is listening any more"); - pthread_mutex_unlock(&(camera->m_stateMutex)); - return -1; - } - - return 0; -} -//............................................................................. -void Camera::unlockCameraMutex(Camera *camera) -{ - LogDebug("Unlocking camera mutex"); - pthread_mutex_unlock(&(camera->m_stateMutex)); -} -//............................................................................. -/* Body of the callback function msg_callback */ -int Camera::camcorderMessageCallback(int msg_type, - void *msg_param, - void *user_param) -{ - LogDebug(__FUNCTION__); - int error; - - MMMessageParamType *m = static_cast(msg_param); - Platform::Camera::Camera *igcamera = - static_cast(user_param); - - switch (msg_type) { - case MM_MESSAGE_WARNING: - LogWarning("*MSG* Warning occured " << std::hex << m->code); - break; - //lack of break is intended; treating all these messages as error. - case MM_MESSAGE_CAMCORDER_MAX_SIZE: /**< Maximum size, camcorder waits for user's order (cam_commit/cancel).*/ - case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE: /**< No free space, camcorder waits for user's order (cam_commit/cancel).*/ - case MM_MESSAGE_CAMCORDER_TIME_LIMIT: /**< Time limit, camcorder waits for user's order (cam_commit/cancel)*/ - LogError("Unexpected camcorder message: " << std::hex << msg_type); - LogInfo("Force camcorder to commit caputured data"); - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - igcamera->DPL::Event::ControllerEventHandler::PostEvent( - JobDoneEvent()); - break; - - case MM_MESSAGE_CAMCORDER_ERROR: - if (Camera::lockCameraMutex(igcamera) < 0) { - return -1; - } - LogError("*MSG* Error's occured. " << std::hex << m->code); - - switch (igcamera->getState()) { - case Camera::CAPTURING_IMAGE: - igcamera->m_eventTakePicture->setExceptionCode( - Commons::ExceptionCodes::UnknownException); - break; - case Camera::CAPTURING_VIDEO: - igcamera->m_eventBeginRecording->setExceptionCode( - Commons::ExceptionCodes::UnknownException); - break; - default: - break; - } - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - mm_camcorder_set_message_callback(igcamera->m_camcorderHandle, - NULL, - NULL); - igcamera->DPL::Event::ControllerEventHandler::PostEvent( - JobDoneEvent()); - Camera::unlockCameraMutex(igcamera); - break; - - case MM_MESSAGE_CAMCORDER_STATE_CHANGED: - if (Camera::lockCameraMutex(igcamera) < 0) { - return -1; - } - - LogDebug( - "*MSG* State changed " << std::hex << m->state.previous << - "->" << std::hex << m->state.current); - //2->3 - if (MM_CAMCORDER_STATE_PREPARE == m->state.current && - MM_CAMCORDER_STATE_READY == m->state.previous) { - LogDebug("MM_CAMCORDER_STATE_READY->MM_CAMCORDER_STATE_PREPARE "); - switch (igcamera->getState()) { - case Camera::CAPTURING_IMAGE: - error = mm_camcorder_capture_start(igcamera->m_camcorderHandle); - if (error != MM_ERROR_NONE) { - LogError( - "m_camcorderHandle capture start failed " << - std::hex << error); - igcamera->m_eventTakePicture->setExceptionCode( - Commons::ExceptionCodes::UnknownException); - igcamera->DPL::Event::ControllerEventHandler:: - PostEvent(JobDoneEvent()); - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - } - break; - case Camera::CAPTURING_VIDEO: - LogDebug("CAPTURING_VIDEO " << igcamera->m_camcorderHandle); - error = mm_camcorder_record(igcamera->m_camcorderHandle); - if (error != MM_ERROR_NONE) { - LogError( - "m_camcorderHandle record start failed " << - std::hex << error); - igcamera->m_eventBeginRecording->setExceptionCode( - Commons::ExceptionCodes::UnknownException); - igcamera->DPL::Event::ControllerEventHandler:: - PostEvent(JobDoneEvent()); - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - } - break; - default: - break; - } - LogDebug("Done."); - } - //3->4 - if (MM_CAMCORDER_STATE_CAPTURING == m->state.previous && - MM_CAMCORDER_STATE_PREPARE == m->state.current) { - /* Capture Stop */ - LogDebug( - "MM_CAMCORDER_STATE_CAPTURING->MM_CAMCORDER_STATE_PREPARE => stopping capture"); - error = mm_camcorder_capture_stop(igcamera->m_camcorderHandle); - if (error != MM_ERROR_NONE) { - LogError( - "m_camcorderHandle capture stopfailed " << std::hex << - error); - } - igcamera->logCamcorderState(); - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - } - - if (MM_CAMCORDER_STATE_RECORDING == m->state.previous && - MM_CAMCORDER_STATE_PREPARE == m->state.current) { - /* Record Stop */ - LogDebug( - "MM_CAMCORDER_STATE_CAPTURING->MM_CAMCORDER_STATE_PREPARE => stopping recording"); - - /// ... - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - } - - Camera::unlockCameraMutex(igcamera); - break; - case MM_MESSAGE_CAMCORDER_CAPTURED: - if (Camera::lockCameraMutex(igcamera) < 0) { - return -1; - } - LogDebug("*MSG* Captured. !!!"); - if (Camera::CAPTURING_VIDEO == igcamera->getState() || - Camera::CAPTURING_IMAGE == igcamera->getState()) { - mm_camcorder_capture_stop(igcamera->m_camcorderHandle); - mm_camcorder_stop(igcamera->m_camcorderHandle); - mm_camcorder_unrealize(igcamera->m_camcorderHandle); - igcamera->DPL::Event::ControllerEventHandler::PostEvent( - JobDoneEvent()); - } - Camera::unlockCameraMutex(igcamera); - break; - default: - LogDebug( - "*MSG* Message received. MMMessageID = " << std::hex << - msg_type); - break; - } - return true; -} -//............................................................................. -void Camera::OnEventReceived(const JobDoneEvent &event) -{ - //if we received this event it means that we are (should be) in PROCESSING state and we need to send back the answer - //we need to check which one - - LogDebug("JobDoneEvent received"); - if (-1 == Camera::lockCameraMutex(this)) { - return; - } - if (m_eventTakePicture) { - Platform::EventRequestReceiver< Api::Camera::EventTakePicture >:: - ManualAnswer(m_eventTakePicture); - m_eventTakePicture.Reset(); - } else if (m_eventBeginRecording) { - Platform::EventRequestReceiver< Api::Camera::EventBeginRecording >:: - ManualAnswer(m_eventBeginRecording); - m_eventBeginRecording.Reset(); - } else if (NULL != m_eventEndRecording.Get()) { - Platform::EventRequestReceiver< Api::Camera::EventEndRecording>:: - ManualAnswer(m_eventEndRecording); - m_eventEndRecording.Reset(); - } else if (m_eventRequestLiveVideo) { - Platform::EventRequestReceiver< Api::Camera::EventRequestLiveVideo>:: - ManualAnswer(m_eventRequestLiveVideo); - m_eventRequestLiveVideo.Reset(); - } else { - LogError("This part should not be reached"); - assert(0); - } - setState(Camera::IDLE); - Camera::unlockCameraMutex(this); - LogDebug("camera is idle now.."); -} -//............................................................................. -void Camera::OnRequestReceived( - const Api::Camera::EventTakePictureSharedPtr & event) -{ - int err; - LogDebug(__FUNCTION__); - - pthread_mutex_lock(&m_stateMutex); - //check is camera idle and can take a picture and camera object is not currently being destructed - if (Camera::IDLE != m_state) { - pthread_mutex_unlock(&m_stateMutex); - event->setExceptionCode(Commons::ExceptionCodes::AlreadyInUseException); - return; - } - - try - { - m_state = Camera::CAPTURING_IMAGE; - reInitializeCamcorderForPicture(event->getCaptureOptionsRef()); - } - catch (const Commons::Exception &exc) - { - m_state = Camera::IDLE; - pthread_mutex_unlock(&m_stateMutex); - LogDebug("error's occured - invoking error callback"); - event->setExceptionCode(exc.getCode()); - return; - } - - //from now on we will have to call answer manually - event->switchToManualAnswer(); - m_eventTakePicture = event; - LogDebug("setting message callback"); - mm_camcorder_set_message_callback(m_camcorderHandle, - Camera::camcorderMessageCallback, - this); - - /* start receiving the input video stream */ - LogDebug("mm_camcorder_start"); - err = mm_camcorder_start(m_camcorderHandle); - if (err != MM_ERROR_NONE) { - LogError("starting camcorder failed " << std::hex << err); - mm_camcorder_set_message_callback(m_camcorderHandle, NULL, NULL); - m_state = Camera::IDLE; - pthread_mutex_unlock(&m_stateMutex); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - Platform::EventRequestReceiver< Api::Camera::EventTakePicture >:: - ManualAnswer(event); - return; - } - pthread_mutex_unlock(&m_stateMutex); - LogDebug("leaving"); -} -//............................................................................. -void Camera::OnRequestReceived( - const Api::Camera::EventBeginRecordingSharedPtr & event) -{ - int err; - LogDebug(__FUNCTION__); - - pthread_mutex_lock(&m_stateMutex); - //check is camera idle and can record - if (Camera::IDLE != m_state) { - pthread_mutex_unlock(&m_stateMutex); - event->setExceptionCode(Commons::ExceptionCodes::AlreadyInUseException); - return; - } - - try - { - m_state = Camera::CAPTURING_VIDEO; - reInitializeCamcorderForVideo(event->getCaptureOptionsRef()); - } - catch (const Commons::Exception &exc) - { - m_state = Camera::IDLE; - pthread_mutex_unlock(&m_stateMutex); - LogDebug("error's occured - invoking error callback"); - event->setExceptionCode(exc.getCode()); - return; - } - - //from now on we will have to call answer manually - event->switchToManualAnswer(); - m_eventBeginRecording = event; - LogDebug("setting message callback"); - mm_camcorder_set_message_callback(m_camcorderHandle, - Camera::camcorderMessageCallback, - this); - - /* start receiving the input video stream */ - LogDebug("mm_camcorder_start"); - err = mm_camcorder_start(m_camcorderHandle); - if (err != MM_ERROR_NONE) { - LogError("starting camcorder failed " << std::hex << err); - mm_camcorder_set_message_callback(m_camcorderHandle, NULL, NULL); - m_state = Camera::IDLE; - pthread_mutex_unlock(&m_stateMutex); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - Platform::EventRequestReceiver:: - ManualAnswer(event); - return; - } - pthread_mutex_unlock(&m_stateMutex); -} -//............................................................................. -void Camera::OnRequestReceived( - const Api::Camera::EventEndRecordingSharedPtr & event) -{ - LogDebug("end request"); - pthread_mutex_lock(&m_stateMutex); - if (m_state == Camera::CAPTURING_VIDEO) { - logCamcorderState(); - int error = mm_camcorder_commit(m_camcorderHandle); - switch (error) { - case MM_ERROR_NONE: - break; - case MM_ERROR_CAMCORDER_INVALID_STATE: - LogError("MM_ERROR_CAMCORDER_INVALID_STATE's occured"); - break; - default: - //capturing video is in progress but we have an error - LogError( - "mm_camcorder_commit error occured " << std::hex << - error << " stopping it"); - mm_camcorder_cancel(m_camcorderHandle); - mm_camcorder_stop(m_camcorderHandle); - mm_camcorder_unrealize(m_camcorderHandle); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - m_state = Camera::IDLE; - break; - } - } else { - LogDebug("stopVideo has been called but no recording is in progress"); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - } - pthread_mutex_unlock(&m_stateMutex); -} -//............................................................................. -void Camera::OnRequestReceived( - const DPL::SharedPtr & event) -{ - ///TODO Not supported - event->setExceptionCode(Commons::ExceptionCodes::UnsupportedException); -} -//............................................................................. -void Camera::logCamcorderState() -{ - MMCamcorderStateType state; - int retValue = mm_camcorder_get_state(m_camcorderHandle, &state); - if (MM_ERROR_NONE == retValue) { - LogDebug("camcorder's state: " << std::hex << state); - } else { - LogDebug("getting camcorder's state's failed: " << std::hex << retValue); - } -} -//............................................................................. -std::string Camera::getDescription() const -{ - std::string desc; - char *err_attr_name = NULL; - char *description = NULL; - int size = 0; - - if (mm_camcorder_get_attributes(m_camcorderHandle, &err_attr_name, - "camera-device-name", &description, &size, - NULL) < 0) { - LogError("GetDescription problem "); - if (err_attr_name) { - LogError("mm_camcorder_get_attributes " << err_attr_name); - } - std::ostringstream oss; - oss << m_camcorderPreset.videodev_type; - desc.assign(oss.str()); - } else { - desc.assign(description); - } - if (err_attr_name) { - LogDebug("free err_attr_name"); - free(err_attr_name); - } - LogDebug("desc" << desc); - return desc; -} -//............................................................................. -int Camera::camcorderVideoCaptureCallback(MMCamcorderCaptureDataType *src, - MMCamcorderCaptureDataType *thumb, - void *data) -{ - LogDebug(__FUNCTION__); - Platform::Camera::Camera *camera = - static_cast(data); - - if (Camera::CAPTURING_IMAGE != camera->getState()) { - return 1; - } - - assert(src->format == MM_PIXEL_FORMAT_ENCODED); - - printf( - "MM_PIXEL_FORMAT_ENCODED src->data=%p src->length=%d, src->width=%d, src->heigtht=%d \n\n", - src->data, - src->length, - src->width, - src->height); - std::string fileName = - camera->m_eventTakePicture->getCaptureOptionsRef()->getFileName(); - - FILE* fp = fopen(fileName.c_str(), "w+"); - if (fp == NULL) { - LogError("file opening error!!"); - return -1; - } else { - LogDebug("open success"); - if (fwrite(src->data, src->length, 1, fp) != 1) { - LogError("file writing error!!"); - fclose(fp); - return -1; - } - LogDebug("success"); - } - fclose(fp); - return 0; -} -//............................................................................. -void Camera::setCaptureOptions( - const Api::Camera::ICaptureOptionsPtr &captureOptions) -{ - LogDebug("enter"); - - if (NULL == captureOptions) { - return; - } - bool ret = realizeCamcoder(); - if (ret == FALSE) { - LogError("Realize camcoreder failed"); - return; - } - - char *err_attr_name = NULL; - int retValue = 0; - - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_WIDTH)) { - LogDebug("setting width"); - short width = captureOptions->getWidth(); - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_CAPTURE_WIDTH, - width, - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug("couldn't set width attribute " << std::hex << retValue); - Throw(Commons::InvalidArgumentException); - } - } - - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_HEIGHT)) { - LogDebug("setting height"); - short height = captureOptions->getHeight(); - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_CAPTURE_HEIGHT, - height, - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug("couldn't set height attribute " << std::hex << retValue); - Throw(Commons::InvalidArgumentException); - } - } - - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_FRAME_RATE)) { - LogDebug("setting frame rate"); - short frameRate = captureOptions->getFrameRate(); - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_CAMERA_FPS, - frameRate, - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug( - "couldn't set frameRate attribute " << std::hex << - retValue); - Throw(Commons::InvalidArgumentException); - } - } - - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_MAX_BITRATE)) { - unsigned long bitrate = captureOptions->getMaximumBitrate(); - LogDebug("setting max bitrate: " << bitrate); - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_AUDIO_ENCODER_BITRATE, - bitrate, - MMCAM_VIDEO_ENCODER_BITRATE, - bitrate, - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug("couldn't set bitrate attribute " << std::hex << retValue); - Throw(Commons::InvalidArgumentException); - } - } - - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_IMAGE_RESOLUTION)) { - LogDebug("setting image resolution"); - Api::Camera::ICaptureOptions::ImageResolution imageResolution = - captureOptions->getImageResolution(); - - //getting possible range of this argument - MMCamAttrsInfo info; - retValue = mm_camcorder_get_attribute_info(m_camcorderHandle, - MMCAM_IMAGE_ENCODER_QUALITY, - &info); - if (retValue < 0) { - free(err_attr_name); - LogDebug( - "couldn't get MMCAM_IMAGE_ENCODER_QUALITY resolution attribute info" - << std::hex << retValue); - Throw(Commons::InvalidArgumentException); - } - - assert(MM_CAM_ATTRS_VALID_TYPE_INT_RANGE == info.validity_type); - int quality = 0; - switch (imageResolution) { - case Api::Camera::ICaptureOptions::IMAGE_RESOLUTION_LOW: - quality = info.int_range.min; - break; - case Api::Camera::ICaptureOptions::IMAGE_RESOLUTION_HIGH: - quality = info.int_range.max; - break; - case Api::Camera::ICaptureOptions::IMAGE_RESOLUTION_DEFAULT: - quality = info.int_range.def; - break; - default: - break; - } - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_IMAGE_ENCODER_QUALITY, - quality, - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug( - "couldn't set image quality attribute " << std::hex << - retValue); - Throw(Commons::InvalidArgumentException); - } - - if (!captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_WIDTH) && - !captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_HEIGHT) && - (Api::Camera::ICaptureOptions::IMAGE_RESOLUTION_DEFAULT != - captureOptions->getImageResolution())) { - Resolution res = getCaptureResolution( - Api::Camera::ICaptureOptions::IMAGE_RESOLUTION_LOW == - captureOptions->getImageResolution() - ); - LogDebug("Resolution: " << res.getWidth() << "x" << res.getHeight()); - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_CAPTURE_WIDTH, - res.getWidth(), - MMCAM_CAPTURE_HEIGHT, - res.getHeight(), - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug( - "couldn't set image resolution attribute " << - std::hex << retValue); - Throw(Commons::InvalidArgumentException); - } - } - } - - ///"you can't set a file name with "MMCAM_TARGET_FILENAME" when capturing still image" - if (captureOptions->isAttributeValid(Api::Camera::ICaptureOptions:: - SETTED_FILE_NAME)) { - LogDebug("setting target filename"); - std::string fileName = captureOptions->getFileName(); - /* - * Not using Api::Filesystem::IManager::access() intentionally - to not - * introduce dependencies between Camera and Filesystem modules for such - * a minor feature. What's more it allows for a small optimization - only - * one access() call is needed when in case of Filesystem::IManager::access() - * two would be required (no way to get to `errno` variable). - */ - errno = 0; - if (access(fileName.c_str(), W_OK) != 0) { - if (ENOENT != errno) { - ThrowMsg(Commons::PlatformException, - "Can't write to specified file."); - } - } else if (!captureOptions->getOverwrite()) { - ThrowMsg( - Commons::PlatformException, - "Output file already exists but overwrite has not been set."); - } - - if (Camera::CAPTURING_VIDEO == m_state) { - retValue = mm_camcorder_set_attributes(m_camcorderHandle, - &err_attr_name, - MMCAM_TARGET_FILENAME, - fileName.c_str(), - fileName.length() * - sizeof(char), - NULL); - if (retValue < 0) { - free(err_attr_name); - LogDebug( - "couldn't set file name attribute " << std::hex << - retValue); - Throw(Commons::InvalidArgumentException); - } - } - } -} -//............................................................................. -int Camera::reInitializeCamcorderForPicture( - const Api::Camera::ICaptureOptionsPtr &captureOptions) -{ - int err; - /*"However, you have to set every attribute to fit to video mode, but it's tiresome. - So, I recommend to you to call destroy also. - Like this, MMCamcorderStop() -> MMCamcorderUnrealize() -> - MMCamcorderDestroy() -> MMCamcorderCreate().. - get a new handle -> MMCamcorderRealize() -> - set MM_CAMCORDER_MODE_VIDEO -> MMCamcorderStart()"*/ - LogDebug("Reinitializing camcorder for picture capturing"); - mm_camcorder_stop(m_camcorderHandle); - mm_camcorder_unrealize(m_camcorderHandle); - mm_camcorder_destroy(m_camcorderHandle); - - err = mm_camcorder_create(&m_camcorderHandle, &m_camcorderPreset); - if (err < 0) { - LogError("creating camcorder has failed " << std::hex << err); - Throw(Commons::UnknownException); - } - - char *err_attr_name = NULL; - err = mm_camcorder_set_attributes( - m_camcorderHandle, &err_attr_name, - MMCAM_MODE, MM_CAMCORDER_MODE_IMAGE, - MMCAM_IMAGE_ENCODER, MM_IMAGE_CODEC_JPEG, - MMCAM_CAMERA_FORMAT, MM_PIXEL_FORMAT_YUYV, - MMCAM_CAMERA_FPS, 30, - MMCAM_DISPLAY_ROTATION, MM_DISPLAY_ROTATION_NONE, - MMCAM_CAPTURE_FORMAT, MM_PIXEL_FORMAT_ENCODED, - MMCAM_CAPTURE_WIDTH, DEFAULT_CAPTURE_WIDTH, - MMCAM_CAPTURE_HEIGHT, DEFAULT_CAPTURE_HEIGHT, - MMCAM_CAPTURE_COUNT, 1, - MMCAM_DISPLAY_VISIBLE, false, - NULL); - - if (err != 0) { - LogError("error: " << err_attr_name); - free(err_attr_name); - Throw(Commons::InvalidArgumentException); - } - mm_camcorder_set_video_capture_callback( - m_camcorderHandle, - (mm_camcorder_video_capture_callback) Camera:: - camcorderVideoCaptureCallback, - static_cast(this)); - setCaptureOptions(captureOptions); - return 0; -} -//............................................................................. -int Camera::reInitializeCamcorderForVideo( - const Api::Camera::ICaptureOptionsPtr &captureOptions) -{ - /*"However, you have to set every attribute to fit to video mode, but it's tiresome. - So, I recommend to you to call destroy also. - Like this, MMCamcorderStop() -> MMCamcorderUnrealize() -> - MMCamcorderDestroy() -> MMCamcorderCreate().. - get a new handle -> MMCamcorderRealize() -> - set MM_CAMCORDER_MODE_VIDEO -> MMCamcorderStart()"*/ - - LogDebug("Reinitializing camcorder for video capturing"); - - mm_camcorder_stop(m_camcorderHandle); - mm_camcorder_unrealize(m_camcorderHandle); - mm_camcorder_destroy(m_camcorderHandle); - mm_camcorder_create(&m_camcorderHandle, &m_camcorderPreset); - - int err; - char *err_attr_name = NULL; - - err = mm_camcorder_set_attributes((MMHandleType)m_camcorderHandle, - &err_attr_name, - MMCAM_MODE, - MM_CAMCORDER_MODE_VIDEO, - MMCAM_AUDIO_DEVICE, - MM_AUDIO_DEVICE_MIC, - MMCAM_AUDIO_ENCODER, - MM_AUDIO_CODEC_AAC, - MMCAM_VIDEO_ENCODER, - MM_VIDEO_CODEC_MPEG4, - MMCAM_FILE_FORMAT, - MM_FILE_FORMAT_3GP, - MMCAM_CAMERA_WIDTH, - 640, - MMCAM_CAMERA_HEIGHT, - 480, - MMCAM_CAMERA_FORMAT, - MM_PIXEL_FORMAT_NV12, - MMCAM_CAMERA_FPS, - 30, - MMCAM_DISPLAY_ROTATION, - MM_DISPLAY_ROTATION_NONE, - MMCAM_AUDIO_SAMPLERATE, - 44100, - MMCAM_AUDIO_CHANNEL, - 2, - MMCAM_AUDIO_INPUT_ROUTE, - MM_AUDIOROUTE_CAPTURE_NORMAL, - NULL); - - if (err != 0) { - LogError("error: " << err_attr_name); - free(err_attr_name); - Throw(Commons::InvalidArgumentException); - } - - setCaptureOptions(captureOptions); - - return 0; -} -//............................................................................. -bool Camera::realizeCamcoder() -{ - LogDebug(__FUNCTION__); - MMCamcorderStateType state; - int ret = mm_camcorder_get_state(m_camcorderHandle, &state); - if (MM_CAMCORDER_STATE_NULL == state) { - LogDebug("camcorder is not realized - realizing.."); - ret = mm_camcorder_realize(m_camcorderHandle); - if (MM_ERROR_NONE != ret) { - LogError( - "realizing the camcorder handle failed " << std::hex << - ret); - Throw(Commons::UnknownException); - } - return true; - } else { - LogDebug("camcorder's been already realized"); - } - return false; -} -//............................................................................. -int Camera::unRealizeCamcoder() -{ - if (!m_camcorderHandle) { - return -1; - } - MMCamcorderStateType state; - int ret = mm_camcorder_get_state(m_camcorderHandle, &state); - if (MM_CAMCORDER_STATE_READY == state) { - ret = mm_camcorder_unrealize(m_camcorderHandle); - if (MM_ERROR_NONE != ret) { - LogError( - "unrealizing the camcorder handle's failed " << - std::hex << ret); - Throw(Commons::UnknownException); - } - } - return MM_ERROR_NONE; -} -//............................................................................. -Camera::Resolution Camera::getCaptureResolution(bool low) const -{ - Assert(m_camcorderHandle && "Camcorder handle is not valid."); - Resolution result(DEFAULT_CAPTURE_WIDTH, DEFAULT_CAPTURE_HEIGHT); - try { - AttributeInfo::ArrayOfInt captureWidth = - AttributeInfo::toArrayOfInt(m_camcorderHandle, MMCAM_CAPTURE_WIDTH); - - AttributeInfo::ArrayOfInt captureHeight = - AttributeInfo::toArrayOfInt(m_camcorderHandle, MMCAM_CAPTURE_HEIGHT); - - if (!captureWidth.empty() && !captureHeight.empty()) { - if (low) { - result.setSize(captureWidth.front(), captureHeight.front()); - } else { - result.setSize(captureWidth.back(), captureHeight.back()); - } - } - } - catch (const Commons::Exception& ex) { - LogError("Exception: " << ex.GetMessage()); - LogDebug("Falling back to default resolution."); - } - return result; -} -} -} -} diff --git a/src/modules/tizen/DEPRACATED/Camera/Camera.h b/src/modules/tizen/DEPRACATED/Camera/Camera.h deleted file mode 100644 index e1070a1..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/Camera.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTPLUGINSCAMERA_H_ -#define WRTPLUGINSCAMERA_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Camera { -DECLARE_GENERIC_EVENT_0(JobDoneEvent) -//============================================================================= -class Camera : public Api::Camera::ICamera, - public DPL::Event::Controller::Type > -{ - public: - enum CameraState - { - IDLE, //camera is ready to take action - PROCESSING, //camera object is under destruction or performing some inner operations - can't change the state - CAPTURING_IMAGE, //image capture is in progress - CAPTURING_VIDEO //video capture is in progress - }; - - private: - typedef Dimension Resolution; - - private: - - /*setting some default attributes for camcorder*/ - void setDefaultAttributes(); - /* - * Sets camcorder attributes based on capture options - */ - void setCaptureOptions( - const Api::Camera::ICaptureOptionsPtr &captureOptions); - - /* - * checks if given error code means invalid parameter - */ - void tryIsInvalidParameterError(int errorCode); - - MMCamPreset m_camcorderPreset; - - MMHandleType m_camcorderHandle; - - /* - * Current camera state - */ - CameraState m_state; - - /* - * Mutex for m_state - */ - pthread_mutex_t m_stateMutex; - - int reInitializeCamcorderForPicture( - const Api::Camera::ICaptureOptionsPtr &captureOptions); - - int reInitializeCamcorderForVideo( - const Api::Camera::ICaptureOptionsPtr &captureOptions); - - /* - * Wrapper for realizing camcorder - */ - bool realizeCamcoder(); - - /* - * Wrapper for unrealizing camcorder - */ - int unRealizeCamcoder(); - - /* Body of the callback function msg_callback */ - static int camcorderMessageCallback(int msg_type, - void *msg_param, - void *user_param); - - static int camcorderVideoCaptureCallback(MMCamcorderCaptureDataType *src, - MMCamcorderCaptureDataType *thumb, - void *data); - - CameraState getState() const - { - return m_state; - } - - void setState(CameraState newState) - { - m_state = newState; - } - - static int lockCameraMutex(Camera *camera); - - static void unlockCameraMutex(Camera *camera); - - /* logs current camcorder state*/ - void logCamcorderState(); - - Resolution getCaptureResolution(bool low) const; - - Api::Camera::EventTakePictureSharedPtr m_eventTakePicture; - Api::Camera::EventBeginRecordingSharedPtr m_eventBeginRecording; - Api::Camera::EventEndRecordingSharedPtr m_eventEndRecording; - Api::Camera::EventRequestLiveVideoSharedPtr m_eventRequestLiveVideo; - - public: - Camera(); - void init(MMCamPreset preset); - virtual ~Camera(); - - virtual void OnRequestReceived( - const Api::Camera::EventTakePictureSharedPtr &event); - virtual void OnRequestReceived( - const Api::Camera::EventBeginRecordingSharedPtr &event); - virtual void OnRequestReceived( - const Api::Camera::EventEndRecordingSharedPtr &event); - virtual void OnRequestReceived( - const Api::Camera::EventRequestLiveVideoSharedPtr &event); - virtual void OnEventReceived(const JobDoneEvent &event); - - virtual std::string getDescription() const; -}; -//============================================================================= -} -} -} -#endif /* WRTPLUGINSCAMERA_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Camera/CameraManager.cpp b/src/modules/tizen/DEPRACATED/Camera/CameraManager.cpp deleted file mode 100644 index 32e0a3d..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/CameraManager.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#include "CameraManager.h" -#include "mm_camcorder.h" -#include -#include -#include -#include "Camera.h" - -namespace WrtPlugins { -namespace Platform { -namespace Camera { -//............................................................................. -void CameraManager::OnRequestReceived( - const Api::Camera::EventGetCamerasPtr &event) -{ - LogDebug(__FUNCTION__); - try - { - DPL::Mutex::ScopedLock lock(&m_accessMutex); - { - if (m_cameras.empty()) { - for (int i = (MM_VIDEO_DEVICE_NONE + 1); - i < MM_VIDEO_DEVICE_NUM; - ++i) { - LogDebug( - "current camera i=" << i << - " (mm_video_device_num: " << MM_VIDEO_DEVICE_NUM); - MMCamPreset cam_info; - cam_info.videodev_type = static_cast(i); - Camera *icamera = new Camera(); - m_cameras.push_back(Api::Camera::ICameraSharedPtr(icamera)); - icamera->init(cam_info); - } - } - event->setCamerasRef(m_cameras, MM_VIDEO_DEVICE_CAMERA0); - } - LogDebug("Nr of cameras: " << m_cameras.size()); - return; - } - catch (Commons::Exception &exc) - { - LogError("Exception has occurred: " << std::hex << exc.getCode()); - event->setExceptionCode(exc.getCode()); - } -} -//............................................................................. -} -} -} diff --git a/src/modules/tizen/DEPRACATED/Camera/CameraManager.h b/src/modules/tizen/DEPRACATED/Camera/CameraManager.h deleted file mode 100644 index a03ad55..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/CameraManager.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Karol Majewski (k.majewski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTPLUGINSCAMERAMANAGER_H_ -#define WRTPLUGINSCAMERAMANAGER_H_ - -#include -#include - -#include -#include - -namespace WrtDeviceApis { -namespace Camera { - -class CameraManager : public Camera::Api::ICameraManager -{ - private: - DPL::Mutex m_accessMutex; - public: - explicit CameraManager() - { - } - virtual ~CameraManager() - { - } - protected: - virtual void OnRequestReceived( - const Camera::Api::EventGetCamerasPtr &event); -}; - -} -} -#endif /* WRTPLUGINSCAMERAMANAGER_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Camera/config.cmake b/src/modules/tizen/DEPRACATED/Camera/config.cmake deleted file mode 100644 index 15024b7..0000000 --- a/src/modules/tizen/DEPRACATED/Camera/config.cmake +++ /dev/null @@ -1,22 +0,0 @@ -get_current_path() - -pkg_search_module(mm_camcorder REQUIRED mm-camcorder) -#pkg_search_module(mmutil_imgp REQUIRED mmutil-imgp) -#pkg_search_module(mmutil_jpeg REQUIRED mmutil-jpeg) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_CAMERA - ${mm_camcorder_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_CAMERA - ${CURRENT_PATH}/Camera.cpp - ${CURRENT_PATH}/CameraManager.cpp - ${CURRENT_PATH}/AttributeInfo.cpp - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_CAMERA - ${mm_camcorder_LIBRARIES} - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Device/Manager.cpp b/src/modules/tizen/DEPRACATED/Device/Manager.cpp deleted file mode 100644 index f77c660..0000000 --- a/src/modules/tizen/DEPRACATED/Device/Manager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Manager.h" -#include - -namespace { -const bool CLAMSHELL_SUPPORTED = false; -const bool KEYPAD_SUPPORTED = false; -} // anonymous - -namespace WrtPlugins { -namespace Platform { -namespace Device { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Manager::~Manager() -{ -} - -bool Manager::hasClamshell() const -{ - return CLAMSHELL_SUPPORTED; -} - -Api::Device::IClamshell* Manager::getClamshell() const -{ - ThrowMsg(Commons::UnsupportedException, - "Device is not equipped with clamshell."); -} - -bool Manager::hasKeypad() const -{ - return KEYPAD_SUPPORTED; -} - -Api::Device::IKeypad* Manager::getKeypad() const -{ - ThrowMsg(Commons::UnsupportedException, - "Device is not equipped with keypad."); -} - -std::string Manager::getImei() const -{ - Try { - return m_imei.getString(); - } - Catch(Commons::ConversionException) { - ReThrow(Commons::PlatformException); - } -} - -Manager::Manager() : m_imei(VCONFKEY_TELEPHONY_IMEI) -{ -} -} // Device -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Device/Manager.h b/src/modules/tizen/DEPRACATED/Device/Manager.h deleted file mode 100644 index 8edab78..0000000 --- a/src/modules/tizen/DEPRACATED/Device/Manager.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DEVICE_MANAGER_H_ -#define WRTDEVICEAPIS_DEVICE_MANAGER_H_ - -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Device { -class Manager : public Api::Device::IManager -{ - public: - static Manager& getInstance(); - - public: - virtual ~Manager(); - - /** - * @see WrtPlugins::Api::Device::IManager::hasClamshell() - */ - bool hasClamshell() const; - - /** - * @see WrtPlugins::Api::Device::IManager::getClamshell() - */ - - Api::Device::IClamshell* getClamshell() const; - - /** - * @see WrtPlugins::Api::Device::IManager::hasKeypad() - */ - bool hasKeypad() const; - - /** - * @see WrtPlugins::Api::Device::IManager::getKeypad() - */ - Api::Device::IKeypad* getKeypad() const; - - /** - * @see WrtPlugins::Api::Device::IManager::getImei() - */ - std::string getImei() const; - - protected: - Manager(); - - private: - VConf::Key m_imei; -}; -} // Device -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_DEVICE_MANAGER_H_ diff --git a/src/modules/tizen/DEPRACATED/Device/config.cmake b/src/modules/tizen/DEPRACATED/Device/config.cmake deleted file mode 100644 index 1a31471..0000000 --- a/src/modules/tizen/DEPRACATED/Device/config.cmake +++ /dev/null @@ -1,21 +0,0 @@ -get_current_path() - -pkg_search_module(devman REQUIRED devman) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_DEVICE - ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF} - ${devman_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_DEVICE - ${LIBS_PLATFORM_IMPLEMENTATION_VCONF} - ${devman_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_DEVICE - ${CURRENT_PATH}/Manager.cpp - ${SRCS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Display/Manager.cpp b/src/modules/tizen/DEPRACATED/Display/Manager.cpp deleted file mode 100644 index 3bdb2c1..0000000 --- a/src/modules/tizen/DEPRACATED/Display/Manager.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Manager.h" -#include -#include "Screen.h" - -namespace { -const std::size_t NUMBER_OF_AVAILABLE_SCREENS = 1; -const std::size_t INDEX_OF_DEFAULT_SCREEN = 1; -} // anonymous - -namespace WrtPlugins { -namespace Platform { -namespace Display { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Api::Display::IScreen* Manager::getScreen(std::size_t index) const -{ - if (index == 0) { - index = INDEX_OF_DEFAULT_SCREEN; - } - - if (index > NUMBER_OF_AVAILABLE_SCREENS) { - ThrowMsg(Commons::OutOfRangeException, "Screen is not available."); - } - - Screens::iterator it = m_screens.find(index); - if (it == m_screens.end()) { - Api::Display::IScreen* screen = new Screen(index); - m_screens.insert(Screens::value_type(index, screen)); - return screen; - } - return it->second; -} - -std::size_t Manager::getScreensCount() const -{ - return NUMBER_OF_AVAILABLE_SCREENS; -} - -Manager::~Manager() -{ - Screens::iterator it = m_screens.begin(); - for (; it != m_screens.end(); ++it) { - delete it->second; - } -} - -Manager::Manager() -{ -} -} // Display -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Display/Manager.h b/src/modules/tizen/DEPRACATED/Display/Manager.h deleted file mode 100644 index 7180925..0000000 --- a/src/modules/tizen/DEPRACATED/Display/Manager.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DISPLAY_MANAGER_H_ -#define WRTDEVICEAPIS_DISPLAY_MANAGER_H_ - -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Display { -class Manager : public Api::Display::IManager -{ - public: - static Manager& getInstance(); - - public: - ~Manager(); - - /** - * @see WrtPlugins::Api::Display::IManager::getScreen() - */ - Api::Display::IScreen* getScreen(std::size_t index) const; - - /** - * @see WrtPlugins::Api::Display::IManager::getScreensCount() - */ - std::size_t getScreensCount() const; - - protected: - typedef std::map Screens; - - protected: - Manager(); - - protected: - mutable Screens m_screens; ///< Available screen interfaces. -}; -} // Display -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_DISPLAY_MANAGER_H_ diff --git a/src/modules/tizen/DEPRACATED/Display/Screen.cpp b/src/modules/tizen/DEPRACATED/Display/Screen.cpp deleted file mode 100644 index 214bb6f..0000000 --- a/src/modules/tizen/DEPRACATED/Display/Screen.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Screen.h" -#include -#include -#include -#include -#include - -// TODO: attach to platform event informing about changed size! - -namespace { -const char* COMMAND_XDPYINFO = "xdpyinfo"; -const char* PATTERN_COLOR_DEPTH = "depth of root window:\\s+(\\d+)\\s+planes"; -const char* PATTERN_SIZE = "dimensions:\\s+(\\d+)x(\\d+)"; -} // anonymous - -namespace WrtPlugins { -namespace Platform { -namespace Display { -unsigned short Screen::getColorDepth() const -{ - unsigned short colorDepth = 0; - if (!getXDpyProperty(PATTERN_COLOR_DEPTH, &colorDepth)) { - ThrowMsg(Commons::PlatformException, "Could not read color depth."); - } - return colorDepth; -} - -Dimension Screen::getSize() const -{ - unsigned int width = 0, height = 0; - if (!getXDpyProperty(PATTERN_SIZE, &width, &height)) { - ThrowMsg(Commons::PlatformException, "Could not read size."); - } - return Dimension(width, height); -} - -Dimension Screen::getActualSize() const -{ - unsigned int width = 0, height = 0; - if (!getXDpyProperty(PATTERN_SIZE, &width, &height)) { - ThrowMsg(Commons::PlatformException, "Could not read size."); - } - if (getOrientation() == Api::Display::O_LANDSCAPE) { - std::swap(width, height); - } - return Dimension(width, height); -} - -Api::Display::Orientation Screen::getOrientation() const -{ - appcore_rm rot = APPCORE_RM_UNKNOWN; - if (appcore_get_rotation_state(&rot) != 0) { - ThrowMsg(Commons::PlatformException, "Could not get orientation."); - } - switch (rot) { - case APPCORE_RM_LANDSCAPE_NORMAL: - case APPCORE_RM_LANDSCAPE_REVERSE: - return Api::Display::O_LANDSCAPE; - default: - return Api::Display::O_PORTRAIT; - } -} - -Api::Display::State Screen::getState() const -{ - Try { - int state = m_powerState.getInt(); - switch (state) { - case VCONFKEY_PM_STATE_NORMAL: - return Api::Display::ST_ON; - case VCONFKEY_PM_STATE_LCDDIM: - return Api::Display::ST_DIM; - default: - return Api::Display::ST_OFF; - } - } - Catch(Commons::ConversionException) { - ReThrowMsg(Commons::PlatformException, - "Could not get device's power state."); - } -} - -void Screen::addOnChangeOrientation( - const Api::Display::EventChangeOrientationEmitterPtr& emitter) -{ - m_onChangeOrientation.attach(emitter); - ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock(); - if (m_onChangeOrientation.size() == 1) { - if (appcore_set_rotation_cb(onChangeOrientation, this) != 0) { - ThrowMsg(Commons::PlatformException, - "Could not attach to platform event."); - } - } -} - -void Screen::removeOnChangeOrientation( - Api::Display::EventChangeOrientationEmitter::IdType id) -{ - m_onChangeOrientation.detach(id); - ChangeOrientationEmitters::LockType lock = m_onChangeOrientation.getLock(); - if (m_onChangeOrientation.size() == 0) { - if (appcore_unset_rotation_cb() != 0) { - ThrowMsg(Commons::PlatformException, - "Could not detach from platform event."); - } - } -} - -void Screen::addOnChangeState( - const Api::Display::EventChangeStateEmitterPtr& emitter) -{ - m_onChangeState.attach(emitter); - ChangeStateEmitters::LockType lock = m_onChangeState.getLock(); - if (m_onChangeState.size() == 1) { - m_powerState.attachCallback(onChangeState, this); - } -} - -void Screen::removeOnChangeState( - Api::Display::EventChangeStateEmitter::IdType id) -{ - m_onChangeState.detach(id); - ChangeStateEmitters::LockType lock = m_onChangeState.getLock(); - if (m_onChangeState.size() == 0) { - m_powerState.detachCallback(); - } -} - -Screen::Screen(std::size_t index) : - m_index(index), - m_powerState(VCONFKEY_PM_STATE) -{ -} - -bool Screen::getXDpyProperty(const char* pattern, - const pcrecpp::Arg& arg1, - const pcrecpp::Arg& arg2) -{ - FILE* pipe = popen(COMMAND_XDPYINFO, "r"); - if (pipe == NULL) { - ThrowMsg(Commons::PlatformException, - "Could not initialize pipe to xdpyinfo."); - } - - bool matched = false; - pcrecpp::RE re(pattern); - char line[LINE_MAX] = { 0 }; - while (fgets(line, LINE_MAX, pipe)) { - if (re.PartialMatch(line, arg1, arg2)) { - matched = true; - break; - } - } - pclose(pipe); - - return matched; -} - -void Screen::onChangeState(const VConf::Node* /*node*/, - void* data) -{ - Screen* this_ = static_cast(data); - Api::Display::EventChangeStatePtr event(new Api::Display::EventChangeState()); - Try { - event->setState(this_->getState()); - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - this_->m_onChangeState.emit(event); -} - -int Screen::onChangeOrientation(appcore_rm rot, - void* data) -{ - Screen* this_ = static_cast(data); - Api::Display::EventChangeOrientationPtr event( - new Api::Display::EventChangeOrientation()); - Try { - event->setOrientation(this_->getOrientation()); - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - this_->m_onChangeOrientation.emit(event); - //TODO check returned value - return 0; -} -} // Display -} // Platform -} // WrtPlugins - diff --git a/src/modules/tizen/DEPRACATED/Display/Screen.h b/src/modules/tizen/DEPRACATED/Display/Screen.h deleted file mode 100644 index 143a66d..0000000 --- a/src/modules/tizen/DEPRACATED/Display/Screen.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_DISPLAY_SCREEN_H_ -#define WRTDEVICEAPIS_DISPLAY_SCREEN_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Display { -class Manager; - -class Screen : public Api::Display::IScreen -{ - friend class Manager; - - public: - /** - * @see WrtPlugins::Api::Display::IScreen::getColorDepth() - */ - unsigned short getColorDepth() const; - - /** - * @see WrtPlugins::Api::Display::IScreen::getSize() - */ - Dimension getSize() const; - - /** - * @see WrtPlugins::Api::Display::IScreen::getActualSize() - */ - Dimension getActualSize() const; - - /** - * @see WrtPlugins::Api::Display::IScreen::getOrientation() - */ - Api::Display::Orientation getOrientation() const; - - /** - * @see WrtPlugins::Api::Display::IScreen::getState() - */ - Api::Display::State getState() const; - - /** - * @see WrtPlugins::Api::Display::IScreen::addOnChangeOrientation() - */ - void addOnChangeOrientation( - const Api::Display::EventChangeOrientationEmitterPtr& emitter); - - /** - * @see WrtPlugins::Api::Display::IScreen::removeOnChangeOrientation() - */ - void removeOnChangeOrientation( - Api::Display::EventChangeOrientationEmitter::IdType id); - - /** - * @see WrtPlugins::Api::Display::IScreen::addOnChangeState() - */ - void addOnChangeState( - const Api::Display::EventChangeStateEmitterPtr& emitter); - - /** - * @see WrtPlugins::Api::Display::IScreen::removeOnChangeState() - */ - void removeOnChangeState(Api::Display::EventChangeStateEmitter::IdType id); - - protected: - typedef Emitters - ChangeOrientationEmitters; - typedef Emitters ChangeStateEmitters; - - protected: - /** - * Gets data matching specified pattern from output of xdpyinfo program. - * @param pattern Pattern to search for. - * @return Zero or positive value on success, -1 on failure. - */ - static bool getXDpyProperty(const char* pattern, - const pcrecpp::Arg& arg1 = pcrecpp::RE::no_arg, - const pcrecpp::Arg& arg2 = pcrecpp::RE::no_arg); - - /** - * Callback run when device's power state changes. - * @param node Node object (unused). - * @param data User data. - */ - static void onChangeState(const VConf::Node* node, - void* data); - - /** - * Callback run when device's orientation changes. - * @param rot Rotation mode. - * @param data User data. - * @return Error code (?) - not specified in documentation. - */ - static int onChangeOrientation(appcore_rm rot, - void* data); - - protected: - explicit Screen(std::size_t index); - - protected: - std::size_t m_index; ///< Index of the screen. - ChangeOrientationEmitters m_onChangeOrientation; ///< Change orientation emitters. - ChangeStateEmitters m_onChangeState; ///< Change state emitters. - VConf::Key m_powerState; ///< Key for power manager state. -}; -} // Display -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_DISPLAY_SCREEN_H_ diff --git a/src/modules/tizen/DEPRACATED/Display/config.cmake b/src/modules/tizen/DEPRACATED/Display/config.cmake deleted file mode 100644 index 1911b25..0000000 --- a/src/modules/tizen/DEPRACATED/Display/config.cmake +++ /dev/null @@ -1,25 +0,0 @@ -get_current_path() - -pkg_search_module(pcrecpp REQUIRED libpcrecpp) -pkg_search_module(appcore REQUIRED appcore-common) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_DISPLAY - ${pcrecpp_INCLUDE_DIRS} - ${appcore_INCLUDE_DIRS} - ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_DISPLAY - ${pcrecpp_LIBRARIES} - ${appcore_LIBRARIES} - ${LIBS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_DISPLAY - ${CURRENT_PATH}/Manager.cpp - ${CURRENT_PATH}/Screen.cpp - ${SRCS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp deleted file mode 100644 index 35b08ac..0000000 --- a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Bartlomiej Grzelewski - */ - -#include -#include -#include -#include "FeatureManager.h" - -using namespace WrtPlugins::Api; - -namespace WrtPlugins { -namespace Platform { -//static void wrtPlatformCallback(int widgetHandler, JSObjectRef object, void* userParam) -//{ -// FeatureManager::platformCallback(widgetHandler, static_cast(object), userParam); -//} - -void FeatureManager::OnRequestReceived(const Api::EventLoadFeaturePtr &event) -{ - //TODO commented - //EventWrapper *eventWrapper = new EventWrapper(this, event); - LogDebug("Call for dynamic feature: " << event->getFeature().c_str()); - JSCallbackManagerPtr jsCallbackManager = - DPL::StaticPointerCast( - event->getPrivateData()); - /* TODO uncomment - this function _will_ be available in new wrt-engine API */ - LogError("*** CRITICAL wrt_dynamic_feature_request is disable!"); - // wrt_dynamic_feature_request(jsCallbackManager->getContext(), event->getFeature().c_str(), wrtPlatformCallback, eventWrapper); -} - -void FeatureManager::platformCallback(int, - void* object, - void* userParam) -{ - if (object == NULL) { - LogError("Request has been rejected."); - } else { - LogDebug("Request has been approved."); - } - EventWrapper *eventWrapper = static_cast(userParam); - eventWrapper->m_event->setObject(object); - eventWrapper->m_event->setStatus((object == 0) ? false : true); - eventWrapper->m_featureManager->Platform::EventRequestReceiver< - EventLoadFeature>::ManualAnswer(eventWrapper->m_event); - delete eventWrapper; -} -} // namespace Platform -} // namespace WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h b/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h deleted file mode 100644 index ffa419a..0000000 --- a/src/modules/tizen/DEPRACATED/FeatureLoader/FeatureManager.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef _SLP20_FEATUREMANAGER_H_ -#define _SLP20_FEATUREMANAGER_H_ - -/* - * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com) - */ - -#include "API/FeatureLoader/IFeatureManager.h" - -namespace WrtPlugins { -namespace Platform { -class FeatureManager : - public Api::IFeatureManager -{ - public: - FeatureManager() - { - } - virtual ~FeatureManager() - { - } - static void platformCallback(int, - void* object, - void* userParam); - protected: - virtual void OnRequestReceived(const Api::EventLoadFeaturePtr &event); - private: - struct EventWrapper - { - EventWrapper(FeatureManager *featureManager, - const Api::EventLoadFeaturePtr &event) : - m_featureManager(featureManager), - m_event(event) - { - } - - ~EventWrapper() - { - } - - FeatureManager *m_featureManager; - Api::EventLoadFeaturePtr m_event; - }; -}; -} // namespace Platform -} // namespace WrtPlugins - -#endif // _SLP20_FEATUREMANAGER_H_ diff --git a/src/modules/tizen/DEPRACATED/FeatureLoader/config.cmake b/src/modules/tizen/DEPRACATED/FeatureLoader/config.cmake deleted file mode 100644 index 2c9325e..0000000 --- a/src/modules/tizen/DEPRACATED/FeatureLoader/config.cmake +++ /dev/null @@ -1,6 +0,0 @@ -get_current_path() - -set(SRCS_PLATFORM_IMPLEMENTATION_FEATURE_MANAGER - ${CURRENT_PATH}/FeatureManager.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp b/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp deleted file mode 100644 index 5132aec..0000000 --- a/src/modules/tizen/DEPRACATED/Gallery/Gallery.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Gallery.cpp - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include "Gallery.h" - -using namespace std; -using namespace DPL; -using namespace WrtPlugins::Api::Gallery; -using namespace WrtPlugins::Api::Filesystem; - -namespace WrtPlugins { -namespace Platform { -using namespace Filesystem; - -namespace { -//Map file extension to IMediaItem type -map &createExtToTypeMap() -{ - static map retMap; - retMap["jpg"] = IMediaItem::IMAGE; - retMap["jpeg"] = IMediaItem::IMAGE; - retMap["gif"] = IMediaItem::IMAGE; - retMap["bmp"] = IMediaItem::IMAGE; - retMap["png"] = IMediaItem::IMAGE; - retMap["wav"] = IMediaItem::AUDIO; - retMap["mp3"] = IMediaItem::AUDIO; - retMap["wmv"] = IMediaItem::VIDEO; - retMap["3gp"] = IMediaItem::VIDEO; - return retMap; -} - -//Map file extension to MIME type -map &createExtToMimeMap() -{ - static map retMap; - retMap["jpg"] = "image/jpeg"; - retMap["jpeg"] = "image/jpeg"; - retMap["gif"] = "image/gif"; - retMap["bmp"] = "image/bmp"; - retMap["png"] = "image/png"; - retMap["wav"] = "audio/wav"; - retMap["mp3"] = "audio/mpeg3"; - retMap["wmv"] = "video/x - ms - wmv"; - retMap["3gp"] = "video/3gpp"; - return retMap; -} - -bool compareByFilename(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) -{ - return lpm->getFileName().compare(rpm->getFileName()) < 0; -} - -bool compareByFileDate(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) -{ - return lpm->getDate() < rpm->getDate(); -} - -bool compareByType(const IMediaItemPtr &lpm, - const IMediaItemPtr &rpm) -{ - return lpm->getType() < rpm->getType(); -} - -class SearchIdObj -{ - unsigned long m_id; - public: - SearchIdObj(unsigned long id) : m_id(id) - { - } - bool operator ()(const IMediaItemPtr &elem) - { - return elem->getId() == m_id; - } -}; -} //private namespace - -map &Gallery::m_extensionToType = createExtToTypeMap(); -map &Gallery::m_extensionToMime = createExtToMimeMap(); - -unsigned int Gallery::getNumberOfItems() const -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - //if gallery is opened m_view always stores an object - return m_view->size(); -} - -std::string Gallery::getName() const -{ - LogDebug("Gallery name: " << m_name); - return m_name; -} - -void Gallery::open() -{ - if (m_opened) { - Throw(Commons::PlatformWrongStateException); - } - m_mediaItems.clear(); - m_lastId = 0; - Path path("/"); - SharedPtr node(Node::resolve(path)); - node->setPermissions(PERM_READ); - searchFiles(node); - //Destroy previous view and store new one - m_view = IMediaItemsSetPtr(new IMediaItemsSet(m_mediaItems)); - m_opened = true; - LogDebug("Gallery contains " << m_mediaItems.size() << " items"); -} - -void Gallery::searchFiles(const SharedPtr &node) -{ - if (Api::Filesystem::NT_FILE == node->getType()) { - string fileName = node->getPath().getName(); - size_t dotPos = fileName.find_last_of("."); - if (dotPos == string::npos) { - //Not supported file - return; - } - string fileExt = fileName.substr(dotPos + 1); - //Check if file has supported type - map::iterator it = m_extensionToMime.find(fileExt); - if (it != m_extensionToMime.end()) { - IMediaItemPtr mediaItem(new IMediaItem()); - mediaItem->setId(getFreeId()); - mediaItem->setFileName(fileName); - mediaItem->setType(m_extensionToType[fileExt]); - mediaItem->setMimeType(m_extensionToMime[fileExt]); - mediaItem->setDate(node->getCreated()); - m_mediaItems.push_back(mediaItem); - } - return; - } - - //else get recurrent on NT_DIRECTORY - NodeList nodes = node->getChildNodes(); - NodeList::iterator it = nodes.begin(), end = nodes.end(); - while (it != end) { - //Warning: '*it' element will be deleted after out of scope (next iteration) - (*it)->setPermissions(PERM_READ); - searchFiles(SharedPtr(*it)); - ++it; - } -} - -unsigned long Gallery::getFreeId() -{ - return ++m_lastId; -} - -bool Gallery::isOpen() const -{ - return m_opened; -} - -void Gallery::close() -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - m_mediaItems.clear(); - m_view.Reset(); - m_lastId = 0; - m_opened = false; -} - -void Gallery::refresh() -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - m_mediaItems.clear(); - m_view->clear(); - m_lastId = 0; - Path path("/"); - SharedPtr node(Node::resolve(path)); - node->setPermissions(PERM_READ); - searchFiles(DynamicPointerCast(node)); - changeView(m_viewProperties); - LogDebug("Gallery contains " << m_mediaItems.size() << " items"); -} - -void Gallery::changeView(const IViewProperties &props) -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - m_viewProperties = props; - m_view->clear(); - - //Copy elements within date period to view struct - for (IMediaItemsSetIterator it = m_mediaItems.begin(), - end = m_mediaItems.end(); - it != end; ++it) { - if ((m_viewProperties.getStartDate() <= (*it)->getDate()) && - ((*it)->getDate() <= m_viewProperties.getEndDate())) { - m_view->push_back(*it); - } - } - - //sort elements - IViewProperties::SortOrder sortOrder[] = { - m_viewProperties.getSecondarySortOrder(), - m_viewProperties.getPrimarySortOrder() - }; - for (size_t i = 0; i < (sizeof(sortOrder) / sizeof(sortOrder[0])); ++i) { - switch (sortOrder[i]) { - case IViewProperties::BY_FILEDATE: - m_view->sort(compareByFileDate); - break; - case IViewProperties::BY_FILENAME: - m_view->sort(compareByFilename); - break; - case IViewProperties::BY_TYPE: - m_view->sort(compareByType); - break; - default: - break; - } - } - - //reverse order if necessary - if (IViewProperties::DESCENDING == m_viewProperties.getSortOrder()) { - m_view->reverse(); - } - LogDebug("View contains " << m_view->size() << " items"); -} - -const IMediaItemsSetPtr Gallery::getMediaItems() const -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - LogError("View contains " << m_view->size() << " entries"); - return m_view; -} - -const IMediaItemPtr Gallery::getMediaItemById(unsigned long id) const -{ - if (!m_opened) { - Throw(Commons::PlatformWrongStateException); - } - SearchIdObj searchObj(id); - IMediaItemsSetConstIterator elem = find_if( - m_mediaItems.begin(), m_mediaItems.end(), searchObj); - if (elem == m_mediaItems.end()) { - Throw(Commons::InvalidArgumentException); - } - return *elem; -} -} -} diff --git a/src/modules/tizen/DEPRACATED/Gallery/Gallery.h b/src/modules/tizen/DEPRACATED/Gallery/Gallery.h deleted file mode 100644 index 122e1db..0000000 --- a/src/modules/tizen/DEPRACATED/Gallery/Gallery.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_ -#define WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -class Gallery : public Api::Gallery::IGallery -{ - /* - * Gallery name - */ - std::string m_name; - /* - * Stores state of the gallery - */ - bool m_opened; - /* - * Last ID field is used to give for an MediaItem unique ID - */ - unsigned long m_lastId; - /* - * Set of all media items found on device - */ - Api::Gallery::IMediaItemsSet m_mediaItems; - /* - * Set of media items selected by changeView method - */ - Api::Gallery::IMediaItemsSetPtr m_view; - /* - * Properties to manage view of media items - */ - Api::Gallery::IViewProperties m_viewProperties; - - /* - * Map to convert from file extension to media type - */ - static std::map &m_extensionToType; - /* - * Map to convert from file extension to MIME type - */ - static std::map &m_extensionToMime; - - /* - * Recurrent search files trough whole tree exposed by file manager - * \param node - node to start from - * \exception - Filesystem related - */ - void searchFiles(const DPL::SharedPtr &node); - /* - * Gets free ID - */ - unsigned long getFreeId(); - - public: - /* - * Constructor of the gallery - * \param name - the gallery name - */ - Gallery(const std::string &name) : - IGallery(), - m_name(name), - m_opened(false), - m_lastId(0) - { - } - /* - * Destructor of the gallery - */ - virtual ~Gallery() - { - } - - /* - * Gets number of media items selected by current view - * \exception Commons::PlatformWrongStateException when gallery not open - * \return number of media items - */ - virtual unsigned int getNumberOfItems() const; - /* - * Gets name of the gallery - * \return name of the gallery - */ - virtual std::string getName() const; - /* - * Opens the gallery - * \exception Commons::PlatformWrongStateException when gallery is already open - */ - virtual void open(); - /* Gets the current state of the gallery - * \return true if the gallery is open - */ - virtual bool isOpen() const; - /* - * Closes the gallery - * \exception Commons::PlatformWrongStateException when gallery is not open - */ - virtual void close(); - /* - * Refreshes files in the gallery - * \exception Commons::PlatformWrongStateException when gallery is not open - */ - virtual void refresh(); - /* - * Changes current view with given properties - * \param props - view properties - * \exception Commons::PlatformWrongStateException when gallery is not open - */ - virtual void changeView(const Api::Gallery::IViewProperties &props); - /* - * Gets media items selected by current view - * \return set of media items - * \exception Commons::PlatformWrongStateException when gallery is not open - */ - virtual const Api::Gallery::IMediaItemsSetPtr getMediaItems() const; - /* - * Gets specified media item - * \param id of wanted item - * \return an media item - * \exception Commons::PlatformWrongStateException when gallery is not open - */ - virtual const Api::Gallery::IMediaItemPtr getMediaItemById(unsigned long id) - const; -}; -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_PLATFORM_GALLERY_GALLERY_H_ diff --git a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp deleted file mode 100644 index eec5a02..0000000 --- a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file GalleryRequestManager.cpp - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - */ - -#include -#include -#include "GalleryRequestManager.h" -#include "Gallery.h" - -using namespace WrtPlugins::Commons; -using namespace WrtPlugins::Api::Gallery; - -namespace WrtPlugins { -namespace Platform { -void GalleryRequestManager::OnRequestReceived( - const IEventGetGalleriesPtr &event) -{ - IGallerySetPtr galleries(new IGallerySet()); - galleries->push_back(IGalleryPtr(new Gallery("Device"))); - event->setGalleries(galleries); - event->setResult(ExceptionCodes::None); -} - -void GalleryRequestManager::OnRequestReceived(const IEventOpenPtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - gallery->open(); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} - -void GalleryRequestManager::OnRequestReceived(const IEventRefreshPtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - gallery->refresh(); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} - -void GalleryRequestManager::OnRequestReceived(const IEventClosePtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - gallery->close(); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} - -void GalleryRequestManager::OnRequestReceived(const IEventChangeViewPtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - gallery->changeView(event->getProperties()); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} - -void GalleryRequestManager::OnRequestReceived( - const IEventGetMediaItemsPtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - IMediaItemsSetPtr mediaItems(gallery->getMediaItems()); - event->setMediaItems(mediaItems); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} - -void GalleryRequestManager::OnRequestReceived( - const IEventGetMediaItemByIdPtr &event) -{ - Try - { - IGalleryPtr gallery(event->getGallery()); - IMediaItemPtr mediaItem(gallery->getMediaItemById(event->getId())); - event->setMediaItem(mediaItem); - event->setResult(ExceptionCodes::None); - } - Catch(Exception) - { - LogError("Gallery exception message: " << - _rethrown_exception.GetMessage() << - " Code: " << _rethrown_exception.getCode()); - event->setResult(_rethrown_exception.getCode()); - } -} -} -} diff --git a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h b/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h deleted file mode 100644 index da344b1..0000000 --- a/src/modules/tizen/DEPRACATED/Gallery/GalleryRequestManager.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file GalleryRequestManager.h - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - */ - -#ifndef WRT_PLUGINS_GALLERYREQUESTMANAGER_H_ -#define WRT_PLUGINS_GALLERYREQUESTMANAGER_H_ - -#include - -namespace WrtPlugins { -namespace Platform { -class GalleryRequestManager : public Api::Gallery::IGalleryRequestManager -{ - public: - - protected: - virtual void OnRequestReceived( - const Api::Gallery::IEventGetGalleriesPtr &event); - virtual void OnRequestReceived(const Api::Gallery::IEventOpenPtr &event); - virtual void OnRequestReceived(const Api::Gallery::IEventRefreshPtr &event); - virtual void OnRequestReceived(const Api::Gallery::IEventClosePtr &event); - virtual void OnRequestReceived( - const Api::Gallery::IEventChangeViewPtr &event); - virtual void OnRequestReceived( - const Api::Gallery::IEventGetMediaItemsPtr &event); - virtual void OnRequestReceived( - const Api::Gallery::IEventGetMediaItemByIdPtr &event); -}; -} -} - -#endif //WRT_PLUGINS_GALLERYREQUESTMANAGER_H_ diff --git a/src/modules/tizen/DEPRACATED/Gallery/config.cmake b/src/modules/tizen/DEPRACATED/Gallery/config.cmake deleted file mode 100644 index e6f7e22..0000000 --- a/src/modules/tizen/DEPRACATED/Gallery/config.cmake +++ /dev/null @@ -1,19 +0,0 @@ -get_current_path() - -pkg_search_module(libpcrecpp REQUIRED libpcrecpp) - -set(SRCS_PLATFORM_IMPLEMENTATION_GALLERY - ${CURRENT_PATH}/Gallery.cpp - ${CURRENT_PATH}/GalleryRequestManager.cpp - PARENT_SCOPE -) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_GALLERY - ${libpcrecpp_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_GALLERY - ${libpcrecpp_LIBRARIES} - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp deleted file mode 100644 index 53a94c2..0000000 --- a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Wojciech Bielawski (w.bielawski@samsung.com) - */ - -#include "Geolocation.h" -#include -#include -#include - -using namespace WrtPlugins::Api::Geolocation; -using namespace DPL; - -namespace WrtPlugins { -namespace Platform { -namespace Geolocation { -namespace { -static void positionChangedCallback(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy, - Geolocation* this_) -{ - if (this_) { - this_->positionHasChanged(obj, type, data, accuracy); - } else { - LogError("Callback private data is NULL."); - } -} -} //private namespace - -Geolocation::Geolocation() : - m_location(NULL), - m_currentLocationMethod(METHOD_GPS), - m_initialized(false) -{ - LogDebug("Enter"); -} - -Geolocation::~Geolocation() -{ - LogDebug("Enter"); - stop(); -} - -void Geolocation::getCurrentPosition(const EventGetCurrentPositionPtr& event) -{ - initialize(); - EventRequestReceiver::PostRequest(event); -} - -void Geolocation::OnRequestReceived(const EventGetCurrentPositionPtr& event) -{ - LogDebug("Entered"); - gint ret; - LocationPosition* pos = NULL; - LocationAccuracy* acc = NULL; - ret = location_get_position(m_location, &pos, &acc); - if (LOCATION_ERROR_NONE != ret) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) { - location_position_free(pos); - location_accuracy_free(acc); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } - event->setTimestamp(static_cast(pos->timestamp)); - event->setLatitude(static_cast(pos->latitude)); - event->setLongitude(static_cast(pos->longitude)); - event->setAltitude(static_cast(pos->altitude)); - event->setAccuracy(static_cast(acc->horizontal_accuracy)); - event->setAltitudeAccuracy(static_cast(acc->vertical_accuracy)); - location_position_free(pos); - location_accuracy_free(acc); - - LocationVelocity* velocity = NULL; - ret = location_get_velocity(m_location, &velocity, &acc); - if (LOCATION_ERROR_NONE != ret) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) { - location_velocity_free(velocity); - location_accuracy_free(acc); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } - event->setSpeed(static_cast(velocity->speed)); - event->setDirection(static_cast(velocity->direction)); - event->setAltitudeSpeed(static_cast(velocity->climb)); - event->setMethod(m_currentLocationMethod); - location_velocity_free(velocity); - location_accuracy_free(acc); -} - -long Geolocation::watchPosition(const EventPositionChangedEmitterPtr& emitter, - long timeout, - long maximumAge, - bool highAccuracy) -{ - initialize(); - m_positionEmitters.attach(emitter); - return static_cast(emitter->getId()); -} - -void Geolocation::clearWatch(EventPositionChangedEmitter::IdType id) -{ - m_positionEmitters.detach(id); -} - -void Geolocation::positionHasChanged(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy) -{ - LogDebug("Enter"); - if (POSITION_UPDATED != type) { - //nothing to do - return; - } - - //convert data from platform to API form - LocationPosition *pos = static_cast(data); - LocationAccuracy *acc = static_cast(accuracy); - LocationVelocity* velocity = NULL; - - EventPositionChangedPtr event(new EventPositionChanged()); - PositionProperties props; - props.altitude = static_cast(pos->altitude); - props.latitude = static_cast(pos->latitude); - props.longitude = static_cast(pos->longitude); - props.timestamp = static_cast(pos->timestamp); - props.accuracy = static_cast(acc->horizontal_accuracy); - props.altitudeAccuracy = static_cast(acc->vertical_accuracy); - - gint ret = location_get_velocity(m_location, &velocity, &acc); - if (LOCATION_ERROR_NONE != ret) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } else if (LOCATION_ACCURACY_LEVEL_NONE != acc->level) { - location_velocity_free(velocity); - location_accuracy_free(acc); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - return; - } - props.speed = static_cast(velocity->speed); - props.direction = static_cast(velocity->direction); - props.altitudeSpeed = static_cast(velocity->climb); - location_velocity_free(velocity); - location_accuracy_free(acc); - - event->setPositionProperties(props); - m_positionEmitters.emit(event); -} - -void Geolocation::changeLocationMethod(ApiLocationMethod method) -{ - LogDebug("Enter"); - if (method != m_currentLocationMethod) { - m_currentLocationMethod = method; - if (m_location) { - restart(); - } - } -} - -void Geolocation::initialize() -{ - LogDebug("ENTER"); - if (!m_initialized) { - DPL::Mutex::ScopedLock lock(&m_initializationMutex); - if (!m_initialized) { - if (LOCATION_ERROR_NONE != location_init()) { - ThrowMsg(Commons::PlatformException, - "Couldn't init location module."); - } - m_initialized = true; - start(); - } - } -} - -void Geolocation::restart() -{ - stop(); - start(); -} - -void Geolocation::start() -{ - LogDebug("ENTER"); - assert(m_initialized && "Geolocation has not been initialized."); - if (m_location) { - return; - } - - m_location = location_new(convertMethodToPlatform(m_currentLocationMethod)); //may return NULL - if (NULL == m_location) { - ThrowMsg(Commons::PlatformException, - "Couldn't create new location object."); - } - - if (LOCATION_ERROR_NONE != location_start(m_location)) { - location_free(m_location); - m_location = NULL; - ThrowMsg(Commons::PlatformException, "Couldn't start localizing."); - } - m_signalId = g_signal_connect(m_location, "service-updated", - G_CALLBACK(positionChangedCallback), this); -} - -void Geolocation::stop() -{ - LogDebug("ENTER"); - if (!m_initialized || !m_location) { - return; - } - - g_signal_handler_disconnect(m_location, m_signalId); - if (LOCATION_ERROR_NONE != location_stop(m_location)) { - ThrowMsg(Commons::PlatformException, "Couldn't stop location object."); - } - if (LOCATION_ERROR_NONE != location_free(m_location)) { - ThrowMsg(Commons::PlatformException, "Couldn't free location module."); - } - m_location = NULL; -} - -LocationMethod Geolocation::convertMethodToPlatform(ApiLocationMethod method) -const -{ - switch (method) { - case METHOD_GPS: - return LOCATION_METHOD_GPS; - case METHOD_AGPS: - return LOCATION_METHOD_HYBRID; - case METHOD_CPS: - return LOCATION_METHOD_CPS; - case METHOD_IPS: - return LOCATION_METHOD_IPS; - case METHOD_WPS: - return LOCATION_METHOD_WPS; - case METHOD_BEST: - return LOCATION_METHOD_HYBRID; - } - LogError("Unknown location method"); - return LOCATION_METHOD_HYBRID; -} -} -} -} diff --git a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h b/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h deleted file mode 100644 index b13bcc5..0000000 --- a/src/modules/tizen/DEPRACATED/Geolocation/Geolocation.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_ -#define WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace Geolocation { -class Geolocation : public Api::Geolocation::IGeolocation -{ - LocationObject *m_location; - gulong m_signalId; - Api::Geolocation::IGeolocation::ApiLocationMethod m_currentLocationMethod; - - friend class WrtPlugins::Api::Geolocation::GeolocationFactory; - - public: - virtual ~Geolocation(); - - /** - * @See: IGelocation::getCurrentPosition - */ - virtual void getCurrentPosition( - const Api::Geolocation::EventGetCurrentPositionPtr& event); - - /** - * @See: IGelocation::watchPosition - */ - virtual long watchPosition( - const Api::Geolocation::EventPositionChangedEmitterPtr& emitter, - long timeout, - long maximumAge, - bool highAccuracy); - - /** - * @See: IGelocation::clearWatch - */ - virtual void clearWatch( - Api::Geolocation::EventPositionChangedEmitter::IdType id); - - /** - * @See: IGelocation::changeLocationMethod - */ - virtual void changeLocationMethod(ApiLocationMethod method); - - /** - * Method to run from platform's callback function - */ - void positionHasChanged(LocationObject *obj, - guint type, - gpointer data, - gpointer accuracy); - - protected: - Geolocation(); - virtual void OnRequestReceived( - const Api::Geolocation::EventGetCurrentPositionPtr& event); - - private: - typedef Emitters - PositionChangedEmitters; - - void initialize(); - void start(); - void stop(); - void restart(); - LocationMethod convertMethodToPlatform(ApiLocationMethod method) const; - - PositionChangedEmitters m_positionEmitters; - DPL::Mutex m_initializationMutex; - bool m_initialized; -}; -} -} -} - -#endif /* WRTDEVICEAPIS_PLATFORM_GEOLOCATION_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Geolocation/config.cmake b/src/modules/tizen/DEPRACATED/Geolocation/config.cmake deleted file mode 100644 index d952110..0000000 --- a/src/modules/tizen/DEPRACATED/Geolocation/config.cmake +++ /dev/null @@ -1,21 +0,0 @@ -get_current_path() - -pkg_search_module(location REQUIRED location) -pkg_search_module(glib REQUIRED glib-2.0) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_GEOLOCATION - ${location_INCLUDE_DIRS} - ${glib_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_GEOLOCATION - ${location_LIBRARIES} - ${glib_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_GEOLOCATION - ${CURRENT_PATH}/Geolocation.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Memory/Manager.cpp b/src/modules/tizen/DEPRACATED/Memory/Manager.cpp deleted file mode 100644 index 2bde62d..0000000 --- a/src/modules/tizen/DEPRACATED/Memory/Manager.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include "Manager.h" - -namespace { -const char* MEMINFO_FILE = "/proc/meminfo"; -const char* MEMORY_TOTAL_PATTERN = "^MemTotal:\\s+(\\d+)\\s*kB$"; -const char* MEMORY_FREE_PATTERN = "^MemFree:\\s+(\\d+)\\s*kB$"; -} - -namespace WrtPlugins { -namespace Platform { -namespace Memory { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -unsigned long Manager::getTotal() const -{ - return getMeminfoValue(MEMORY_TOTAL_PATTERN); -} - -unsigned long Manager::getFree() const -{ - return getMeminfoValue(MEMORY_FREE_PATTERN); -} - -Manager::Manager() -{ -} - -unsigned long Manager::getMeminfoValue(const char* pattern) const -{ - assert(pattern && "Pattern not set."); - - std::ifstream file(MEMINFO_FILE); - if (!file) { - ThrowMsg(Commons::PlatformException, "Memory info file not found."); - } - - unsigned long result = 0; - bool matched = false; - std::string line; - while ((std::getline(file, line).rdstate() & - (std::ifstream::failbit | std::ifstream::eofbit)) == 0) { - if (pcrecpp::RE(pattern).FullMatch(line, &result)) { - matched = true; - break; - } - } - file.close(); - - if (!matched) { - ThrowMsg(Commons::UnsupportedException, "Total memory data not found."); - } - - return result; -} -} // Memory -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/Memory/Manager.h b/src/modules/tizen/DEPRACATED/Memory/Manager.h deleted file mode 100644 index a40608c..0000000 --- a/src/modules/tizen/DEPRACATED/Memory/Manager.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_MEMORY_MANAGER_H_ -#define WRTDEVICEAPIS_MEMORY_MANAGER_H_ - -#include - -namespace WrtPlugins { -namespace Platform { -namespace Memory { -class Manager : public Api::Memory::IManager -{ - public: - static Manager& getInstance(); - - public: - unsigned long getTotal() const; - unsigned long getFree() const; - - private: - Manager(); - - /** - * Reads value from meminfo file looking it up using specified regex pattern. - * Function matches each (whole!) line against specified pattern. - * @param pattern Perl-like regular expresion used to search through meminfo. - * @return Found value. - * @throw PlatformException If could not find meminfo file. - * @throw UnsupportedException If pattern didn't match any line in meminfo file. - */ - unsigned long getMeminfoValue(const char* pattern) const; -}; -} // Memory -} // Platform -} // WrtPlugins - -#endif /* WRTDEVICEAPIS_MEMORY_MANAGER_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Memory/config.cmake b/src/modules/tizen/DEPRACATED/Memory/config.cmake deleted file mode 100644 index 7d9157a..0000000 --- a/src/modules/tizen/DEPRACATED/Memory/config.cmake +++ /dev/null @@ -1,18 +0,0 @@ -get_current_path() - -pkg_search_module(pcrecpp REQUIRED libpcrecpp) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_MEMORY - ${pcrecpp_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_MEMORY - ${pcrecpp_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_MEMORY - ${CURRENT_PATH}/Manager.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/System/Date.cpp b/src/modules/tizen/DEPRACATED/System/Date.cpp deleted file mode 100644 index 308de72..0000000 --- a/src/modules/tizen/DEPRACATED/System/Date.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Date.h" -#include -#include - -namespace { -const std::size_t MAX_BUFFER_SIZE = 80; -} // anonymous - -namespace WrtPlugins { -namespace Platform { -namespace System { -Api::System::IDate::Format Date::m_defualtFormat = "%c"; - -Date::Date() -{ - m_timestamp = time(NULL); -} - -std::string Date::toString() const -{ - return toString(m_defualtFormat); -} - -std::string Date::toString(const Format& format) const -{ - if (format.empty()) { - ThrowMsg(Commons::PlatformException, "Format is not set."); - } - - char buffer[MAX_BUFFER_SIZE] = { 0 }; - struct tm* tm = std::localtime(&m_timestamp); - if (std::strftime(buffer, MAX_BUFFER_SIZE, format.c_str(), tm) == 0) { - ThrowMsg(Commons::PlatformException, "Could not get date string."); - } - - return buffer; -} -} // System -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/System/Date.h b/src/modules/tizen/DEPRACATED/System/Date.h deleted file mode 100644 index 8097694..0000000 --- a/src/modules/tizen/DEPRACATED/System/Date.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_SYSTEM_DATE_H_ -#define WRTDEVICEAPIS_SYSTEM_DATE_H_ - -#include -#include - -namespace WrtPlugins { -namespace Platform { -namespace System { -class Date : public Api::System::IDate -{ - public: - Date(); - - /** - * @see WrtPlugins::Api::System::IDate::toString() - */ - std::string toString() const; - - /** - * @see WrtPlugins::Api::System::IDate::toString() - */ - std::string toString(const Format& format) const; - - protected: - static Format m_defualtFormat; ///< Default format for to string conversion. - - protected: - std::time_t m_timestamp; ///< Timestamp, number of seconds since UNIX epoch. -}; -} // System -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_SYSTEM_DATE_H_ diff --git a/src/modules/tizen/DEPRACATED/System/Environment.cpp b/src/modules/tizen/DEPRACATED/System/Environment.cpp deleted file mode 100644 index b75dfa9..0000000 --- a/src/modules/tizen/DEPRACATED/System/Environment.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Environment.h" -#include -#include -#include -#include -extern "C" { - #include -} -#include -#include -#include - -namespace { -const char* VARIABLE_LANGUAGE_NAME = "LANG"; -const char* VENDOR_NAME = "Samsung"; -const char* FILE_INFO_INI = "/etc/info.ini"; -const char* FILE_CPUINFO = "/proc/cpuinfo"; -const char* PATTERN_CPUINFO_HARDWARE = "^Hardware\\s*:\\s+(\\w+)\\s*$"; -} // anonymous - -namespace WrtPlugins { -namespace Platform { -namespace System { -// TODO: Most of those values (if not any) doesn't have to be recalculated every -// time someone request them. Optimalization could be introduced to do it -// only once, e.g. on first request. - -Environment& Environment::getInstance() -{ - static Environment instance; - return instance; -} - -std::string Environment::getLanguage() const -{ - return getVariable(VARIABLE_LANGUAGE_NAME); -} - -std::string Environment::getOsVersion() const -{ - struct utsname buf; - if (uname(&buf) != 0) { - ThrowMsg(Commons::PlatformException, "Could not get uname data."); - } - return buf.sysname; -} - -std::string Environment::getSoftwareVersion() const -{ - dictionary* dict = iniparser_load(FILE_INFO_INI); - if (dict == NULL) { - ThrowMsg(Commons::PlatformException, "Could not get SW version."); - } - char* major = - iniparser_getstring(dict, ("Version:Major"), const_cast("")); - - const char* minor = - iniparser_getstring(dict, "Version:Minor", const_cast("")); - - std::stringstream ss; - ss << major; - if ((*major != '\0') && (*minor != '\0')) { - ss << "-"; - } - ss << minor; - iniparser_freedict(dict); - - return ss.str(); -} - -std::string Environment::getHardwareName() const -{ - FILE* file = fopen(FILE_CPUINFO, "r"); - if (file == NULL) { - ThrowMsg(Commons::UnsupportedException, "Could not open cpuinfo file."); - } - - std::string result; - char line[LINE_MAX] = { 0 }; - pcrecpp::RE re(PATTERN_CPUINFO_HARDWARE); - while (fgets(line, LINE_MAX, file) && !re.FullMatch(line, &result)) { - } - fclose(file); - - if (result.empty()) { - ThrowMsg(Commons::UnsupportedException, "Hardware name not found."); - } - - return result; -} - -std::string Environment::getVendorName() const -{ - return VENDOR_NAME; -} - -std::string Environment::getVariable(const char* name) -{ - char* value = getenv(name); - if (value == NULL) { - std::stringstream ss; - ss << "Could not read variable " << name << "."; - ThrowMsg(Commons::PlatformException, ss.str()); - } - return value; -} - -Environment::Environment() -{ -} -} // System -} // Platform -} // WrtPlugins diff --git a/src/modules/tizen/DEPRACATED/System/Environment.h b/src/modules/tizen/DEPRACATED/System/Environment.h deleted file mode 100644 index a135e96..0000000 --- a/src/modules/tizen/DEPRACATED/System/Environment.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_ -#define WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_ - -#include - -namespace WrtPlugins { -namespace Platform { -namespace System { -class Environment : public Api::System::IEnvironment -{ - public: - static Environment& getInstance(); - - public: - /** - * @see WrtPlugins::Api::System::IEnvironment::getLanguage() - */ - std::string getLanguage() const; - - /** - * @see WrtPlugins::Api::System::IEnvironment::getOsVersion() - */ - std::string getOsVersion() const; - - /** - * @see WrtPlugins::Api::System::IEnvironment::getSoftwareVersion() - */ - std::string getSoftwareVersion() const; - - /** - * @see WrtPlugins::Api::System::IEnvironment::getHardwareName() - */ - std::string getHardwareName() const; - - /** - * @see WrtPlugins::Api::System::IEnvironment::getVendorName() - */ - std::string getVendorName() const; - - protected: - /** - * Gets value of specified environment variable. - * @param name Name of the variable. - * @return Value of the variable. - * @throw PlatformException If specified variable doesn't exist. - */ - static std::string getVariable(const char* name); - - protected: - Environment(); -}; -} // System -} // Platform -} // WrtPlugins - -#endif // WRTDEVICEAPIS_SYSTEM_ENVIRONMENT_H_ diff --git a/src/modules/tizen/DEPRACATED/System/config.cmake b/src/modules/tizen/DEPRACATED/System/config.cmake deleted file mode 100644 index 5185d77..0000000 --- a/src/modules/tizen/DEPRACATED/System/config.cmake +++ /dev/null @@ -1,19 +0,0 @@ -get_current_path() - -pkg_search_module(iniparser REQUIRED iniparser) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_SYSTEM - ${iniparser_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_SYSTEM - ${iniparser_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_SYSTEM - ${CURRENT_PATH}/Environment.cpp - ${CURRENT_PATH}/Date.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp deleted file mode 100644 index 7d8bd57..0000000 --- a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file LogEntryWrapper.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.2 - */ - -#include -#include -#include -#include "LogEntryWrapper.h" -#include "commons/Exception.h" - -using namespace WrtPlugins::Api; - -namespace WrtPlugins { -namespace Platform { -LogEntryWrapper::LogEntryWrapper(CTSvalue *log) : - m_logEntry(new LogEntry()) -{ - LogDebug("entered"); - convertPlatformStructToAbstractStruct(log); -} - -LogEntryWrapper::~LogEntryWrapper() -{ - LogDebug("entered"); -} - -bool LogEntryWrapper::matchFilters(const LogFilterPtr &filter) -{ - LogDebug("entered"); - if (!m_logEntry) { - Throw(WrtPlugins::Commons::NullPointerException); - } - if (!filter) { - return true; - } - if (filter->getIdIsSet() && filter->getIdFilter() != m_logEntry->getId()) { - return false; - } - if (filter->getStartTimeIsSet() && - (filter->getStartTimeMinFilter() > m_logEntry->getStartTime() || - filter->getStartTimeMaxFilter() < m_logEntry->getStartTime())) { - return false; - } - if (filter->getDurationIsSet() && - (filter->getDurationMinFilter() > m_logEntry->getDuration() || - filter->getDurationMaxFilter() < m_logEntry->getDuration())) { - return false; - } - if (filter->getPhoneNumberIsSet() && - !pcrecpp::RE(filter->getPhoneNumberFilter()).FullMatch(m_logEntry-> - getPhoneNumber())) - { - return false; - } - if (filter->getDescriptionIsSet() && - !pcrecpp::RE(filter->getDescriptionFilter()).FullMatch(m_logEntry-> - getDescription())) - { - return false; - } - if (filter->getFolderIsSet() && - !filter->checkIfFolderIsSet(m_logEntry->getFolder())) { - return false; - } else if (m_logEntry->getFolder() == LogEntry::INVALID_FOLDER) { - return false; - } - return true; -} - -bool LogEntryWrapper::convertPlatformStructToAbstractStruct(CTSvalue *log) -{ - LogDebug("entered"); - if (!m_logEntry) { - return false; - } - if (!log) { - return true; - } - const char *charVal = - contacts_svc_value_get_str(log, CTS_LIST_PLOG_NUMBER_STR); - if (charVal) { - LogDebug("phone number " << charVal); - m_logEntry->setPhoneNumber(charVal); - } - charVal = contacts_svc_value_get_str(log, CTS_LIST_PLOG_SHORTMSG_STR); - if (charVal) { - m_logEntry->setDescription(charVal); - } - m_logEntry->setDuration( - contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT)); - LogDebug("id " << - contacts_svc_value_get_int(log, CTS_LIST_PLOG_DURATION_INT)); - m_logEntry->setStartTime( - contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TIME_INT)); - m_logEntry->setId( - contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT)); - LogDebug("id " << contacts_svc_value_get_int(log, CTS_LIST_PLOG_ID_INT)); - switch (contacts_svc_value_get_int(log, CTS_LIST_PLOG_LOG_TYPE_INT)) { - case CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN: - case CTS_PLOG_TYPE_VOICE_INCOMMING_SEEN: - case CTS_PLOG_TYPE_VIDEO_INCOMMING_UNSEEN: - case CTS_PLOG_TYPE_VIDEO_INCOMMING_SEEN: - m_logEntry->setFolder(LogEntry::MISSED_CALLS_FOLDER); - break; - case CTS_PLOG_TYPE_VIDEO_INCOMMING: - case CTS_PLOG_TYPE_VOICE_INCOMMING: - m_logEntry->setFolder(LogEntry::RECEIVED_CALLS_FOLDER); - break; - case CTS_PLOG_TYPE_VIDEO_OUTGOING: - case CTS_PLOG_TYPE_VOICE_OUTGOING: - m_logEntry->setFolder(LogEntry::INITIATED_CALLS_FOLDER); - break; - default: - LogDebug("Invalid folder"); - m_logEntry->setFolder(LogEntry::INVALID_FOLDER); - break; - } - return true; -} - -Api::LogEntryPtr LogEntryWrapper::getAbstractCall() const -{ - return m_logEntry; -} -} -} \ No newline at end of file diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h b/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h deleted file mode 100644 index d317034..0000000 --- a/src/modules/tizen/DEPRACATED/Telephony/LogEntryWrapper.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file LogEntryWrapper.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.2 - */ - -#ifndef _SLP20_LOG_ENTRY_WRAPPER_H_ -#define _SLP20_LOG_ENTRY_WRAPPER_H_ - -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -class LogEntryWrapper -{ - public: - explicit LogEntryWrapper(CTSvalue *log); - virtual ~LogEntryWrapper(); - bool matchFilters(const Api::LogFilterPtr &filter); - Api::LogEntryPtr getAbstractCall() const; - private: - Api::LogEntryPtr m_logEntry; - bool convertPlatformStructToAbstractStruct(CTSvalue *log); -}; - -typedef DPL::SharedPtr LogEntryWrapperPtr; -} -} - -#endif /* _SLP20_EVENT_WRAPPER_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp b/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp deleted file mode 100644 index a14061f..0000000 --- a/src/modules/tizen/DEPRACATED/Telephony/LogManager.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file LogManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.2 - */ - -#include -#include -#include -#include "LogManager.h" -#include "LogEntryWrapper.h" - -using namespace WrtPlugins::Api; - -namespace WrtPlugins { -namespace Platform { -int LogManager::m_instanceCount = 0; - -LogManager::LogManager() -{ - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - if (m_instanceCount == 0) { - LogDebug("opening calllog DB"); - if (CTS_SUCCESS != contacts_svc_connect()) { - LogError("database not opened"); - } - } - m_instanceCount++; -} - -LogManager::~LogManager() -{ - LogDebug("entered"); - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - m_instanceCount--; - if (m_instanceCount == 0) { - LogDebug("closing calllog DB"); - contacts_svc_disconnect(); - } -} - -void LogManager::OnRequestReceived(const Api::IEventGetNumberOfLogsPtr &event) -{ - LogDebug("entered"); - Try - { - int result = getNumberOfLogsInternal(event->getFilter()); - event->setNumberOfLogs(result); - } - Catch(Commons::Exception) - { - LogError("Error during searching logs"); - return; - } - event->setResult(true); -} - -void LogManager::OnRequestReceived(const Api::IEventFindLogEntriesPtr &event) -{ - LogDebug("entered"); - Try - { - std::vector result = findLogEntriesInternal( - event->getFilter(), event->getFirstCall(), event->getLastCall()); - std::vector::const_iterator it; - for (it = result.begin(); it != result.end(); it++) { - event->addLog(*it); - } - } - Catch(Commons::Exception) - { - LogError("Error during searching logs"); - return; - } - event->setResult(true); -} - -void LogManager::OnRequestReceived(const Api::IEventDeleteLogEntryPtr &event) -{ - LogDebug("entered"); - Try - { - if (!event->getFilter() || !event->getFilter()->getIdIsSet()) { - return; - } - deleteLogEntryInternal(event->getFilter()->getIdFilter()); - } - Catch(Commons::Exception) - { - LogError("Error during deleting log"); - return; - } - event->setResult(true); -} - -void LogManager::OnRequestReceived(const Api::IEventClearLogPtr &event) -{ - LogDebug("entered"); - Try - { - clearLogInternal(event->getFilter()); - } - Catch(Commons::Exception) - { - LogError("Error during deleting logs"); - return; - } - event->setResult(true); -} - -int LogManager::getNumberOfLogsInternal(const LogFilterPtr &filter) -{ - LogDebug("entered"); - if (!filter) { - LogWarning("filter is NULL"); - return 0; - } - int result = 0; - CTSiter *iter = NULL; - contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter); - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *log = contacts_svc_iter_get_info(iter); - if (NULL == log) { - LogError("funtion returned NULL value"); - continue; - } - LogEntryWrapperPtr wrapper(new LogEntryWrapper(log)); - if (wrapper->matchFilters(filter)) { - result++; - } - contacts_svc_value_free(log); - } - contacts_svc_iter_remove(iter); - return result; -} - -std::vector LogManager::findLogEntriesInternal( - const LogFilterPtr &filter, - const int minIndex, - const int maxIndex) -{ - LogDebug("entered"); - std::vector result; - CTSiter *iter = NULL; - contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter); - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *log = contacts_svc_iter_get_info(iter); - if (NULL == log) { - LogError("funtion returned NULL value"); - continue; - } - LogEntryWrapperPtr wrapper(new LogEntryWrapper(log)); - if (wrapper->matchFilters(filter)) { - result.push_back(wrapper->getAbstractCall()); - } - contacts_svc_value_free(log); - } - contacts_svc_iter_remove(iter); - return result; -} - -void LogManager::deleteLogEntryInternal(int id) const -{ - LogDebug("entered"); - if (CTS_SUCCESS != contacts_svc_delete_phonelog(CTS_PLOG_DEL_BY_ID, id)) { - ThrowMsg(Commons::PlatformException, "Cannot delete log"); - } - return; -} - -void LogManager::clearLogInternal(const LogFilterPtr &filter) -{ - LogDebug("entered"); - CTSiter *iter = NULL; - contacts_svc_get_list(CTS_LIST_GROUPING_PLOG, &iter); - while (CTS_SUCCESS == contacts_svc_iter_next(iter)) { - CTSvalue *log = contacts_svc_iter_get_info(iter); - if (NULL == log) { - LogError("funtion returned NULL value"); - continue; - } - LogEntryWrapperPtr wrapper(new LogEntryWrapper(log)); - if (wrapper->matchFilters(filter)) { - deleteLogEntryInternal(wrapper->getAbstractCall()->getId()); - } - contacts_svc_value_free(log); - } - contacts_svc_iter_remove(iter); - return; -} -} -} \ No newline at end of file diff --git a/src/modules/tizen/DEPRACATED/Telephony/LogManager.h b/src/modules/tizen/DEPRACATED/Telephony/LogManager.h deleted file mode 100644 index c5c53a3..0000000 --- a/src/modules/tizen/DEPRACATED/Telephony/LogManager.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file LogManager.h - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.2 - */ - -#ifndef _SLP20__LOG_MANAGER_H_ -#define _SLP20__LOG_MANAGER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtPlugins { -namespace Platform { -class LogManager : public Api::ILogManager -{ - public: - LogManager(); - virtual ~LogManager(); - protected: - virtual void OnRequestReceived( - const Api::IEventGetNumberOfLogsPtr &event); - virtual void OnRequestReceived( - const Api::IEventFindLogEntriesPtr &event); - virtual void OnRequestReceived( - const Api::IEventDeleteLogEntryPtr &event); - virtual void OnRequestReceived( - const Api::IEventClearLogPtr &event); - int getNumberOfLogsInternal( - const Api::LogFilterPtr &filter); - std::vector findLogEntriesInternal( - const Api::LogFilterPtr &filter, - const int minIndex = -1, - const int maxIndex = -1); - void deleteLogEntryInternal(int id) const; - void clearLogInternal( - const Api::LogFilterPtr &filter); - static int m_instanceCount; - DPL::Mutex m_constructorMutex; -}; - -typedef DPL::SharedPtr LogManagerPtr; -} -} - -#endif /* _SLP20__LOG_MANAGER_H_ */ diff --git a/src/modules/tizen/DEPRACATED/Telephony/config.cmake b/src/modules/tizen/DEPRACATED/Telephony/config.cmake deleted file mode 100644 index 23d80a3..0000000 --- a/src/modules/tizen/DEPRACATED/Telephony/config.cmake +++ /dev/null @@ -1,26 +0,0 @@ -get_current_path() - -pkg_search_module(contacts-service REQUIRED contacts-service) -pkg_search_module(glib REQUIRED glib-2.0) -pkg_search_module(libpcrecpp REQUIRED libpcrecpp) - - -set(INCLUDES_PLATFORM_IMPLEMENTATION_TELEPHONY - ${contacts-service_INCLUDE_DIRS} - ${glib_INCLUDE_DIRS} - ${libpcrecpp_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_TELEPHONY - ${contacts-service_LIBRARIES} - ${glib_LIBRARIES} - ${libpcrecpp_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_TELEPHONY - ${CURRENT_PATH}/LogManager.cpp - ${CURRENT_PATH}/LogEntryWrapper.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/DEPRACATED/UI/config.cmake b/src/modules/tizen/DEPRACATED/UI/config.cmake deleted file mode 100644 index e8aefbc..0000000 --- a/src/modules/tizen/DEPRACATED/UI/config.cmake +++ /dev/null @@ -1,6 +0,0 @@ -get_current_path() - -set(SRCS_PLATFORM_IMPLEMENTATION_UI -# ${CURRENT_PATH}/Camera.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/Haptics/Manager.cpp b/src/modules/tizen/Haptics/Manager.cpp deleted file mode 100644 index afb658d..0000000 --- a/src/modules/tizen/Haptics/Manager.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include "Manager.h" - -namespace { -const std::size_t NUMBER_OF_AVAILABLE_MOTORS = 2; -} // anonymous - -namespace WrtDeviceApis { -namespace Haptics { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Motor* Manager::getMotor(std::size_t index) const -{ - switch (index) { - case 0: - return new Motor(DEV_IDX_ALL); - case 1: - return new Motor(DEV_IDX_0); - case 2: - return new Motor(DEV_IDX_1); - } - ThrowMsg(Commons::OutOfRangeException, "Motor unavailable."); -} - -std::size_t Manager::getMotorsCount() const -{ - return NUMBER_OF_AVAILABLE_MOTORS; -} - -Manager::Manager() -{ -} -} // Haptics -} // WrtDeviceApis diff --git a/src/modules/tizen/Haptics/Manager.h b/src/modules/tizen/Haptics/Manager.h deleted file mode 100644 index 545be95..0000000 --- a/src/modules/tizen/Haptics/Manager.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_HAPTICS_MANAGER_H_ -#define WRTDEVICEAPIS_HAPTICS_MANAGER_H_ - -#include -#include -#include "Motor.h" - -namespace WrtDeviceApis { -namespace Haptics { -class Manager : public Api::IManager -{ - public: - - /** - * Gets class definition getInstance. - * @remarks set before. - * @return Class Manager instance. - */ - - static Manager& getInstance(); - - public: - - /** - * Gets Motor pointer which find by index - * @remarks set before. - * @return Class Motor pointer - */ - Motor* getMotor(std::size_t index) const; - - /** - * Gets Motors Count - * @remarks set before. - * @return size_t type - */ - - std::size_t getMotorsCount() const; - - private: - Manager(); -}; -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_MANAGER_H_ */ diff --git a/src/modules/tizen/Haptics/Motor.cpp b/src/modules/tizen/Haptics/Motor.cpp deleted file mode 100644 index 2e774fe..0000000 --- a/src/modules/tizen/Haptics/Motor.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file Motor.cpp - * @modify Lileiming (leiming.li@samsung.com) - * @version 0.1 - * @brief add function run_beep &stop_beep - */ - -#include -#include -#include -#include -#include "Motor.h" -#include - -namespace WrtDeviceApis { -namespace Haptics { -namespace { -const int INVALID_BEEP_HANDLER = -1; -} - -Motor::Motor(haptic_dev_idx index) : - EventHapticActionReqReceiver(Commons::ThreadEnum::HAPTICS_THREAD), - EventStartMotorReqReceiver(Commons::ThreadEnum::HAPTICS_THREAD), - EventPlayBeepReqReceiver(Commons::ThreadEnum::HAPTICS_THREAD), - m_beepHandle(INVALID_BEEP_HANDLER) -{ - m_device = device_haptic_open(index, 0); - if (m_device < 0) { - ThrowMsg(Commons::PlatformException, "Could not open haptic device."); - } -} - -Motor::~Motor() -{ - if (device_haptic_close(m_device) < 0) { - LogDebug("Could not close haptic device."); - } -} - -int Motor::playBeep(unsigned long duration, - int /*volume*/) -{ - int retMmSound = -1; - - retMmSound = mm_sound_play_tone(MM_SOUND_TONE_PROP_BEEP, VOLUME_TYPE_SYSTEM, 1, duration, &m_beepHandle); -// retMmSound = mm_sound_play_beep(VOLUME_TYPE_SYSTEM, duration, &m_beepHandle); - if (retMmSound < 0) { - m_beepHandle = INVALID_BEEP_HANDLER; - ThrowMsg(Commons::PlatformException, "Play Beep is Failed!"); - } - - return retMmSound; -} - -void Motor::playBeep(const Api::EventPlayBeepPtr& event) -{ - EventPlayBeepReqReceiver::PostRequest(event); -} - -void Motor::stopBeep() -{ - if (m_beepHandle == INVALID_BEEP_HANDLER) { - LogError("m_beepHandle is wrong!!"); - ThrowMsg(Commons::PlatformException, "m_beepHandle is wrong!!"); - } - if (mm_sound_stop_sound(m_beepHandle) != 0) { - LogError("mm_sound_stop_sound FAIL!!"); - ThrowMsg(Commons::PlatformException, "mm_sound_stop_sound FAIL!!"); - } - m_beepHandle = INVALID_BEEP_HANDLER; -} - -void Motor::run(unsigned long duration) -{ - if (device_haptic_play_monotone(m_device, duration) != 0) { - ThrowMsg(Commons::PlatformException, "Could not run haptic motor."); - } -} - -void Motor::run(const Api::HapticPatternPtr& pattern) -{ - LogInfo("Entered!"); - - m_pattern.Reset(); - if (!pattern || 0 == pattern->length()) { - return; // nothing to do - } - m_current = 0; - m_pattern = pattern; - if (m_event) { - LogDebug("Wait current event! And then run Next pattern!"); - return; - } - runNextPattern(); -} - -void Motor::run(const Api::EventStartMotorPtr& event) -{ - EventStartMotorReqReceiver::PostRequest(event); -} - -void Motor::stopMotor() -{ - if (device_haptic_stop_play(m_device) != 0) { - LogError("Haptic motor stop fail!"); - ThrowMsg(Commons::PlatformException, "Could not stop haptic motor."); - } -} - -void Motor::stopVibration() -{ - LogDebug("Entered!"); - - /* Stop pattern */ - if (m_pattern) { - m_current = m_pattern->length(); - } - - /* Stop Motor */ - stopMotor(); -} - -void Motor::OnRequestReceived(const EventHapticActionPtr& event) -{ - LogInfo("Haptic action event received"); - - DPL::Mutex::ScopedLock lock(&m_patternMutex); - if (event->checkCancelled()) { - LogWarning("Haptic pattern canceled by another one"); - return; // event has been canceled by another Motor::run -> nothing to do - } - - runNextPattern(); -} - -void Motor::OnRequestReceived(const Api::EventStartMotorPtr& event) -{ - LogInfo("Start motor event received"); - try - { - if (event == NULL) { - LogError("Event is NULL!"); - ThrowMsg(Commons::PlatformException, "Event is NULL!!"); - } - - unsigned long duration = 0; - Api::HapticPatternPtr patternPtr = event->getPatternRef(); - size_t patternLength = patternPtr->length(); - - if (event->getDuration() > 0) { - // Ignore duration if duration is lower than 0 - duration = event->getDuration(); - } - - if ((duration > 0) && (patternLength == 0)) { - // run motor during duration - run(duration); - } else if ((duration == 0) && (patternLength > 0)) { - // run motor by pattern - run(patternPtr); - } else if ((duration > 0) && (patternLength > 0)) { - // run motor by pattern during duration - arragePattern(patternPtr, duration); - run(patternPtr); - } else { - LogDebug("duration is 0 and pattern is null!!! Do Nothing!"); - } - } - catch (Commons::PlatformException) { - LogError("platform exception"); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } -} - -void Motor::OnRequestReceived(const Api::EventPlayBeepPtr& event) -{ - LogInfo("Play beep event received"); - try - { - if (event == NULL) { - LogError("event is NULL!"); - ThrowMsg(Commons::PlatformException, "Event is NULL!!"); - } - - LogDebug( - "duration: " << event->getDuration() << ", volume: " << - event->getVolume()); - if (event->getDuration() <= 0) { - LogDebug("duration is less than 0!! Do Nothing!"); - return; - } - if (playBeep(static_cast(event->getDuration()), - event->getVolume()) < 0) { - LogError("playBeep returned error!!"); - ThrowMsg(Commons::PlatformException, "Play Beep is Failed!"); - } - } - catch (Commons::PlatformException) { - LogError("platform exception"); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } -} - -void Motor::runNextPattern() -{ - // always stop the motor - LogInfo("stopping motor"); - stopMotor(); - - if (m_current >= m_pattern->length()) { - m_event.Reset(); - m_pattern.Reset(); - LogInfo("end of pattern"); - return; // end of pattern - } - - unsigned long duration = m_pattern->duration(m_current); - - bool active = false; - Try { - active = m_pattern->isActive(m_current); - } - Catch(Commons::OutOfRangeException) { - LogError("Platform sequence size exceeded. Finishing."); - m_event.Reset(); - m_pattern.Reset(); - return; - } - - // action - if (active) { - LogInfo("haptic action for " << duration << "ms"); - run(duration); - } - // pause - else { - LogInfo("pausing for " << duration << "ms"); - } - - LogInfo("post request delayed for " << duration << "ms"); - m_current++; - m_event = EventHapticActionPtr(new EventHapticAction()); - m_event->setForAsynchronousCall(NULL); // not interested in answer - - // post delayed event - EventHapticActionReqReceiver::PostRequest(m_event, duration / 1000.0); -} - -void Motor::arragePattern(Api::HapticPatternPtr& patternPtr, - const unsigned long duration) -{ - LogInfo("Entered!!"); - - if (patternPtr == NULL) { - LogError("patternPtr is NULL"); - return; - } - - size_t patternLength = patternPtr->length(); - unsigned long totalPatternDuration = 0; - unsigned long repeatCnt = 0; - unsigned long addingCnt = 0; - size_t currentInterval = 0; - - for (size_t i = 0; i < patternLength; i++) { - totalPatternDuration += patternPtr->duration(i); - } - if ((duration % totalPatternDuration) == 0) { - repeatCnt = (duration / totalPatternDuration); - } else { - repeatCnt = (duration / totalPatternDuration) + 1; - } - addingCnt = repeatCnt - 1; - - /* Repeat pattern during duration */ - for (unsigned long i = 0; i < addingCnt; i++) { - for (currentInterval = 0; - currentInterval < patternLength; - currentInterval++) { - patternPtr->addInterval(patternPtr->duration( - currentInterval), - patternPtr->isActive(currentInterval)); - } - } -} -} // Haptics -} // WrtDeviceApis diff --git a/src/modules/tizen/Haptics/Motor.h b/src/modules/tizen/Haptics/Motor.h deleted file mode 100644 index be4dd41..0000000 --- a/src/modules/tizen/Haptics/Motor.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_HAPTICS_MOTOR_H_ -#define WRTDEVICEAPIS_HAPTICS_MOTOR_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Haptics { -// Dummy event for asynchronous haptic motor schedule -class EventHapticAction : public Commons::IEvent -{ -}; -typedef DPL::SharedPtr EventHapticActionPtr; -typedef Commons::EventRequestReceiver EventHapticActionReqReceiver; -typedef Commons::EventRequestReceiver EventStartMotorReqReceiver; -typedef Commons::EventRequestReceiver EventPlayBeepReqReceiver; - -class Motor : - public Api::IMotor, - public EventHapticActionReqReceiver, - public EventStartMotorReqReceiver, - public EventPlayBeepReqReceiver -{ - public: - explicit Motor(haptic_dev_idx index); - virtual ~Motor(); - - /** - * Run vibrate for duration. - * @param duration is unsigned long and value in milliseconds.. - * @return none - */ - void run(unsigned long duration); - - /** - * Run vibrate for given pattern . - * @param The pattern argument is a DOMString composed by '.' and '_' chars. - * @return none - */ - void run(const Api::HapticPatternPtr& pattern); - - /** - * Run vibrate for given event . - * @param The event argument is event included duration & pattern. - * @return none - */ - void run(const Api::EventStartMotorPtr& event); - - /** - * stop motor for vibrating device - * @param none - * @return none - */ - void stopMotor(); - - /** - * stop vibration. (pattern and motor) - * @param none - * @return none - */ - void stopVibration(); - - /** - * Run notify for given duration and volume.if volume!=0 beep device,volume=0&vibrate open vibrate device - * @param duration value is unsigned long in millsecond. - * @param volume value is 0~7 - * @return none - */ - int playBeep(unsigned long duration, - int volume); - - /** - * Run notify for given duration and volume.if volume!=0 beep device,volume=0&vibrate open vibrate device - * @param duration value is unsigned long in millsecond. - * @param volume value is 0~7 - * @return none - */ - void playBeep(const Api::EventPlayBeepPtr& event); - - /** - * stop beep/vibrate/light-on device - * @param none - * @return none - */ - void stopBeep(); - - protected: - void OnRequestReceived(const EventHapticActionPtr& event); - void OnRequestReceived(const Api::EventStartMotorPtr& event); - void OnRequestReceived(const Api::EventPlayBeepPtr& event); - - private: - void runNextPattern(); - void arragePattern(Api::HapticPatternPtr& patternPtr, - const unsigned long duration); - - private: - int m_device; ///< Platform haptic device handle. - int m_beepHandle; ///< Platform beep handle. - Api::HapticPatternPtr m_pattern; // haptic action pattern - EventHapticActionPtr m_event; // haptic action scheduling event - size_t m_current; // current haptic action pattern interval - DPL::Mutex m_patternMutex; -}; -} // Haptics -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_HAPTICS_MOTOR_H_ */ diff --git a/src/modules/tizen/Haptics/config.cmake b/src/modules/tizen/Haptics/config.cmake deleted file mode 100644 index 17b1f90..0000000 --- a/src/modules/tizen/Haptics/config.cmake +++ /dev/null @@ -1,31 +0,0 @@ -get_current_path() - -pkg_search_module(haptic REQUIRED devman_haptic) -#pkg_search_module(appcore REQUIRED appcore-common) -#pkg_search_module(avsystem REQUIRED avsystem) -pkg_search_module(mm-sound REQUIRED mm-sound) -#pkg_search_module(audiosessionmgr REQUIRED audio-session-mgr) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_HAPTICS - ${haptic_INCLUDE_DIRS} - # ${appcore_INCLUDE_DIRS} - # ${avsystem_INCLUDE_DIRS} - ${mm-sound_INCLUDE_DIRS} - # ${audiosessionmgr_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_HAPTICS - ${haptic_LIBRARIES} - #${appcore_LIBRARIES} - #${avsystem_LIBRARIES} - ${mm-sound_LIBRARIES} - #${audiosessionmgr_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_HAPTICS - ${CURRENT_PATH}/Manager.cpp - ${CURRENT_PATH}/Motor.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/MMPlayer/Manager.cpp b/src/modules/tizen/MMPlayer/Manager.cpp index 543a932..4a39576 100644 --- a/src/modules/tizen/MMPlayer/Manager.cpp +++ b/src/modules/tizen/MMPlayer/Manager.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "MMPlayer.h" @@ -107,17 +108,12 @@ void Manager::OnRequestReceived(const EventOpenPtr& event) //Check if current installation path should be added if ((fullName[0] != '/') && (fullName.find("://") == string::npos)) { try { + using namespace WrtDeviceApis::Commons; std::string installationPath; - Commons::IWrtWrapperPtr wrapper = event->getWrtWrapper(); - if (!wrapper) { - LogError("Wrt API not accessible. Can't get installation path."); - event->setExceptionCode( - Commons::ExceptionCodes::PlatformException); - return; - } - - WidgetDB::Api::IWidgetDBPtr widgetDB = WidgetDB::Api::getWidgetDB( - wrapper->getWidgetId()); + int widgetId = WrtAccessSingleton::Instance().getWidgetId(); + + WidgetDB::Api::IWidgetDBPtr widgetDB = + WidgetDB::Api::getWidgetDB(widgetId); installationPath = widgetDB->getConfigValue( WidgetDB::Api::ConfigAttribute::INSTALL_PATH); diff --git a/src/modules/tizen/Messaging/Attachment.cpp b/src/modules/tizen/Messaging/Attachment.cpp deleted file mode 100644 index fecda99..0000000 --- a/src/modules/tizen/Messaging/Attachment.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Attachment.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include -#include "Attachment.h" - -extern "C" { -#include -#include -} - -using namespace WrtDeviceApis::Commons; -using namespace std; - -//-------------------------------------------------------------------------- -namespace WrtDeviceApis { -namespace Messaging { - -Attachment::Attachment(const string& fullPath, - bool isVirtualPath) -{ - LogDebug("entered"); - init(fullPath, isVirtualPath); -} - -std::string Attachment::getRealPath(const std::string &path) const -{ - Try - { - Filesystem::Api::IPathPtr currentPath = Filesystem::Api::IPath::create( - path); - return currentPath->getFullPath(); - } - - Catch(Commons::Exception) { - LogError("invalid path"); - ReThrow(Commons::InvalidArgumentException); - } -} -} -} - diff --git a/src/modules/tizen/Messaging/Attachment.h b/src/modules/tizen/Messaging/Attachment.h deleted file mode 100644 index 7eb4bdd..0000000 --- a/src/modules/tizen/Messaging/Attachment.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Attachment.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MESSAGE_ATTACHMENT_H -#define MESSAGE_ATTACHMENT_H - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -//-------------------------------------------------------------------------- - -class Attachment : public Api::IAttachment -{ - public: - - explicit Attachment(const std::string& fullPath, - bool isVirtualPath); - - private: - - virtual std::string getRealPath(const std::string &path) const; -}; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/BinarySms.cpp b/src/modules/tizen/Messaging/BinarySms.cpp deleted file mode 100644 index 2544054..0000000 --- a/src/modules/tizen/Messaging/BinarySms.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file BinarySms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "BinarySms.h" -#include - -using namespace std; - -using namespace WrtDeviceApis::Messaging; -using namespace WrtDeviceApis::Messaging::Api; - -namespace WrtDeviceApis { -namespace Messaging { -BinarySms::BinarySms(const string& id) : - IMessage(Api::BINARYSMS, id) -{ - LogDebug("enter"); - - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); -} - -BinarySms::~BinarySms() -{ - LogDebug("enter"); -} - -void BinarySms::update(bool /*draftsOnly*/) -{ - LogDebug("updating m_id=" << getIdRef()); -} - -void BinarySms::readAllData() -{ - //#warning "TODO" -} - -void BinarySms::moveToFolder(const FolderType /*newFolder*/) -{ - //#warning "TODO" -} - -void BinarySms::moveToFolder(const string& /*newFolder*/) -{ - //#warning "TODO" -} - -void BinarySms::copyToFolder(const FolderType /*newFolder*/) -{ - //#warning "TODO" -} - -void BinarySms::copyToFolder(const string& /*newFolder*/) -{ - //#warning "TODO" -} - -void BinarySms::remove() -{ - //#warning "TODO" -} - -void BinarySms::send() -{ - //#warning "TODO" -} - -void BinarySms::sendCancel() -{ - //#warning "TODO" -} -} -} diff --git a/src/modules/tizen/Messaging/BinarySms.h b/src/modules/tizen/Messaging/BinarySms.h deleted file mode 100644 index 0a871da..0000000 --- a/src/modules/tizen/Messaging/BinarySms.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file BinarySms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef BINARY_SMS_H -#define BINARY_SMS_H - -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -class BinarySms : - public Api::IBinarySms -{ - public: - - explicit BinarySms(const std::string& id = ""); - - virtual ~BinarySms(); - - // implementation of interface of IMessage class - virtual void update(bool draftsOnly = false); - - virtual void readAllData(); - - virtual void moveToFolder(const Api::FolderType newFolder); - - virtual void moveToFolder(const std::string& newFolder); - - virtual void copyToFolder(const Api::FolderType newFolder); - - virtual void copyToFolder(const std::string& newFolder); - - virtual void remove(); - - virtual void send(); - - virtual void sendCancel(); -}; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/CallbackMgr.cpp b/src/modules/tizen/Messaging/CallbackMgr.cpp deleted file mode 100644 index 87f3382..0000000 --- a/src/modules/tizen/Messaging/CallbackMgr.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CallbackMgr.cpp - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#include "CallbackMgr.h" -#include -#include -#include "ISendingObserver.h" -#include "MsgServiceHandleMgr.h" - -extern "C" { -#include -#include -#include -} - -IMPLEMENT_SINGLETON(WrtDeviceApis::Messaging::CallbackMgr) - -namespace WrtDeviceApis { -namespace Messaging { - -CallbackMgr::CallbackMgr() -{ - LogInfo("enter"); - // register callback once per process - if (NULL == MsgGetCommonHandle()) { - LogError("Unable to open handle"); - } else { - if (msg_reg_sent_status_callback(MsgGetCommonHandle(), sendCallback, - static_cast(this)) != - MSG_SUCCESS) { - LogError("callback registration error"); - } else { - LogDebug("callback registred succesfully"); - } - } -} - -CallbackMgr::~CallbackMgr() -{ - LogInfo("enter"); -} - -MSG_ERROR_T CallbackMgr::registerAndSend(SendingFunction sendingFn, - const msg_message_t& message, - ISendingObserver* observer) -{ - LogDebug("trying to send message, msgId=" << msg_get_message_id(message)); - - MSG_SENDINGOPT_S pSendOpt; - memset(&pSendOpt, 0, sizeof(MSG_SENDINGOPT_S)); - MSG_REQUEST_S req; - memset(&req, 0, sizeof(MSG_REQUEST_S)); - req.reqId = 0; - req.msg = message; - req.sendOpt = pSendOpt; - - DPL::Mutex::ScopedLock lock(&m_mutex); - MSG_ERROR_T err = (*sendingFn)(MsgGetCommonHandle(), &req); - if (err == MSG_SUCCESS) { - if (observer) { - m_sendRequests[req.reqId] = observer; - observer->setSendigRequestId(req.reqId); - observer->setRecipient(msg_get_ith_address(message, 0)); - } - } - return err; -} - -void CallbackMgr::unregister(int reqId) -{ - DPL::Mutex::ScopedLock lock(&m_mutex); - - SendReqMap::iterator it = m_sendRequests.find(reqId); - if (it == m_sendRequests.end()) { - LogWarning("No matching request found"); - return; - } - LogInfo("Matching send request found!"); - m_sendRequests.erase(it); -} - -void CallbackMgr::sendCallback(MSG_HANDLE_T /*handle*/, - MSG_SENT_STATUS_S *sent_status, - void *user_param) -{ - LogInfo( - "callback received. Req id = " << sent_status->reqId << - " Status = " << (int)sent_status->status); - CallbackMgr* instance = static_cast(user_param); - if (!instance) { - LogError("Empty user data!"); - return; - } - - instance->call(sent_status); -} - -void CallbackMgr::call(MSG_SENT_STATUS_S *sent_status) -{ - DPL::Mutex::ScopedLock lock(&m_mutex); - - SendReqMap::iterator it = m_sendRequests.find(sent_status->reqId); - if (it == m_sendRequests.end()) { - LogWarning("No matching request found"); - return; - } - LogInfo("Matching send request found!"); - - // call it - it->second->sendingCallback(sent_status); - - m_sendRequests.erase(it); -} -} -} - diff --git a/src/modules/tizen/Messaging/CallbackMgr.h b/src/modules/tizen/Messaging/CallbackMgr.h deleted file mode 100644 index 6198e79..0000000 --- a/src/modules/tizen/Messaging/CallbackMgr.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CallbackMgr.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef CALLBACKMGR_H_ -#define CALLBACKMGR_H_ - -#include -#include -#include - -extern "C" { -#include -#include -} - -namespace WrtDeviceApis { -namespace Messaging { -class ISendingObserver; - -/* - * - */ -class CallbackMgr -{ - protected: - CallbackMgr(); - - static void sendCallback(MSG_HANDLE_T handle, - MSG_SENT_STATUS_S *sent_status, - void *user_param); - - void call(MSG_SENT_STATUS_S *sent_status); - - public: - ~CallbackMgr(); - - typedef int (*SendingFunction)(MSG_HANDLE_T, MSG_REQUEST_S*); - - // register for sending callback - MSG_ERROR_T registerAndSend(SendingFunction sendingFn, - const msg_message_t& message, - ISendingObserver* observer); - - // unregister callback - void unregister(int reqId); - - private: - DPL::Mutex m_mutex; - - typedef std::map SendReqMap; - SendReqMap m_sendRequests; -}; - -typedef DPL::Singleton CallbackMgrSingleton; -} -} - -#endif /* CALLBACKMGR_H_ */ diff --git a/src/modules/tizen/Messaging/Email.cpp b/src/modules/tizen/Messaging/Email.cpp deleted file mode 100755 index 526a60f..0000000 --- a/src/modules/tizen/Messaging/Email.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Email.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Messaging.h" -#include "Email.h" -#include "EmailService.h" -#include "EmailUtils.h" -#include "EmailConverter.h" -#include "MailSender.h" - -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); - -using namespace std; -using namespace WrtDeviceApis::Messaging; -using namespace WrtDeviceApis::Messaging::Api; - -namespace WrtDeviceApis { -namespace Messaging { -namespace { -//#define USE_OUTBOX - -#ifdef USE_OUTBOX -const Api::FolderType DEFAULT_FOLDER = Api::OUTBOX; -//const char* DEFAULT_FOLDER_NAME = EMF_OUTBOX_NAME; -#else -const Api::FolderType DEFAULT_FOLDER = Api::DRAFTBOX; -//const char* DEFAULT_FOLDER_NAME = EMF_DRAFTBOX_NAME; -#endif -} - -Email::Email(const string& id) : IMessage(Api::EMAIL, id) -{ - LOG_ENTER - - try { - if (getIdRef().empty()) { - create(); - } - // always read the message (after creation some of attributes change - // i.e. body->plain) - reload(); - } - catch (const Commons::PlatformException& ex) { - LogError("Exception: " << ex.DumpToString()); - } - - LOG_EXIT -} - -Email::~Email() -{ - LogDebug("ENTER"); -} - -void Email::send() -{ - LOG_ENTER - - update(); - - MailSender::getInstance().send( - Api::MessageFactory::convertToEmail(SharedFromThis()) - ); - - LOG_EXIT -} - -void Email::sendCancel() -{ - LOG_ENTER - - MailSender::getInstance().cancel(getIntId()); - - LOG_EXIT -} - -void Email::update(bool draftsOnly) -{ - LOG_ENTER - - DPL::Mutex::ScopedLock mx(&m_updateMutex); - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail is NULL."); - } - - if (!draftsOnly || (getCurrentFolder() == Api::DRAFTBOX)) { - updateBody(); - updateSubject(); - updateRecipients(); - updateFrom(); - updateAttachments(); - updatePriority(); - } else { - LogWarning("Updating only read status. Folder: " << getCurrentFolder()); - } - updateReadStatus(); - - int error = email_update_message(getIntId(), m_mail.Get()); - if (EMF_ERROR_NONE != error) { - LogWarning("Nothing to update or error. [" << error << "]"); - } - - LOG_EXIT -} - -int Email::getAccountId() const -{ - return m_accountId; -} - -void Email::readAllData() -{ - reload(); -} - -void Email::moveToFolder(const Api::FolderType newFolder) -{ - LOG_ENTER - - moveToFolder(EmailConverter::toMailboxName(newFolder)); - - LOG_EXIT -} - -void Email::moveToFolder(const string& newFolder) -{ - update(); - - int accountId = Messaging::getInstance().getEmailAccountId(getFromRef()); - ScopedMailbox mailbox( - EmailService::createMailbox(accountId, newFolder.c_str()) - ); - - int mailId = getIntId(); - - int error = email_move_mail_to_mailbox(&mailId, 1, mailbox.Get()); - if (EMF_ERROR_NONE != error) { - ThrowMsg( - Commons::PlatformException, - "Couldn't move mail to folder: " << newFolder << ". [" << - error << "]"); - } -} - -void Email::copyToFolder(const FolderType newFolder) -{ - LOG_ENTER - - copyToFolder(EmailConverter::toMailboxName(newFolder)); - - LOG_EXIT -} - -void Email::copyToFolder(const string& newFolder) -{ - LOG_ENTER - - update(); - - int accountId = Messaging::getInstance().getEmailAccountId(getFromRef()); - - ScopedMail mail(EmailService::cloneMail(m_mail.Get())); - ScopedMailbox mailbox( - EmailService::createMailbox(accountId, newFolder.c_str()) - ); - - int mailId = EmailService::addMailToMailbox(mail.Get(), mailbox.Get()); - // TODO Is following check necessary? - if (0 == mailId) { - ThrowMsg(Commons::PlatformException, "Cloned mail didn't get new id."); - } - - LOG_EXIT -} - -void Email::remove() -{ - EmailService::deleteMail(m_accountId, getIntId()); -} - -void Email::create() -{ - LOG_ENTER - - EmailAccountInfo account = IMessaging::getInstance().getCurrentEmailAccount(); - ScopedMail mail(EmailService::createMail(account)); - ScopedMailbox mailbox( - EmailService::getMailboxByType(account.getIntId(), - EMF_MAILBOX_TYPE_DRAFT) - ); - setId(convertId(EmailService::addMailToMailbox(mail.Get(), mailbox.Get()))); - setFolderType(Api::DRAFTBOX); - - LOG_EXIT -} - -void Email::reload() -{ - LOG_ENTER - - EmailAccountInfo account = Messaging::getInstance().getCurrentEmailAccount(); - - m_mail.Reset(EmailService::readMail(account.getIntId(), getIntId())); - - if (m_mail->head) { readHeader(); } - if (m_mail->body) { readBody(); } - if (m_mail->info) { readInfo(); } - - m_mailbox.Reset( - EmailService::getMailboxByMailId(account.getIntId(), getIntId()) - ); - setFolderType(EmailConverter::toFolderType(m_mailbox->mailbox_type)); - - LOG_EXIT -} - -void Email::readHeader() -{ - LOG_ENTER - - Assert(m_mail && m_mail->head && "Header is NULL."); - - if (m_mail->head->subject) { - setSubject(m_mail->head->subject); - } - - if (m_mail->head->to) { - appendToRecipients(EmailUtils::stripAddressLine(m_mail->head->to)); - } - - if (m_mail->head->cc) { - appendCcRecipients(EmailUtils::stripAddressLine(m_mail->head->cc)); - } - - if (m_mail->head->bcc) { - appendBccRecipients(EmailUtils::stripAddressLine(m_mail->head->bcc)); - } - - time_t rawtime; - time(&rawtime); - struct tm tmpTime = *(localtime(&rawtime)); - tmpTime.tm_year = m_mail->head->datetime.year; - tmpTime.tm_mon = m_mail->head->datetime.month; - tmpTime.tm_mday = m_mail->head->datetime.day; - tmpTime.tm_hour = m_mail->head->datetime.hour; - tmpTime.tm_min = m_mail->head->datetime.minute; - tmpTime.tm_sec = m_mail->head->datetime.second; - mktime(&tmpTime); - setDateTime(tmpTime); - - if (m_mail->head->from) { - Recipients from; - from.setRecipients(m_mail->head->from); - setSourceAddress(from); - setSourceAddressValidity(true); //not needed to update in platform - } - - LOG_EXIT -} - -void Email::readBody() -{ - LOG_ENTER - - Assert(m_mail && m_mail->body && "Body is NULL."); - - if (m_mail->body->plain) { - DPL::ScopedFClose file(::fopen(m_mail->body->plain, "r")); - if (!file) { - ThrowMsg(Commons::PlatformException, - "Cannot read body file: " << m_mail->body->plain); - } - fseek(file.Get(), 0, SEEK_END); - long int size = ftell(file.Get()); - fseek(file.Get(), 0, SEEK_SET); - DPL::ScopedPtr data(new char[size + 1]); - memset(data.Get(), 0, size + 1); - fread(data.Get(), 1, size, file.Get()); - setBody(data.Get()); - } - - if (m_mail->body->attachment && m_mail->body->attachment_num > 0) { - LogDebug("reading attachments"); - emf_attachment_info_t* attach = m_mail->body->attachment; - for (int i = 0; i < m_mail->body->attachment_num; ++i) { - if (!attach) { - ThrowMsg(Commons::PlatformException, - "Attachment list shorter than expected."); - } - try { - IAttachmentPtr tmpAtt = appendAttachment(attach->savename, - false); - tmpAtt->rename(attach->name); - attach = attach->next; - } - catch (const Commons::Exception& ex) { - LogError("Error while trying to append attachment " << - attach->savename << ": " << ex.DumpToString()); - } - } - } - - LOG_EXIT -} - -void Email::readInfo() -{ - LOG_ENTER - - Assert(m_mail && m_mail->info && "Info is NULL."); - - setReadStatus(m_mail->info->flags.seen == 1); - - m_accountId = m_mail->info->account_id; - - setPriority( - EmailConverter::toMessagePriority( - m_mail->info->extra_flags.priority - ) - ); - setSize(m_mail->info->rfc822_size); - - LOG_EXIT -} - -void Email::updateBody() -{ - LOG_ENTER - - if (isBodyValid()) { return; } - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail is NULL."); - } - - if (!m_mail->body) { - ThrowMsg(Commons::PlatformException, "Body is NULL."); - } - if (!m_mail->body->plain) { - ThrowMsg(Commons::PlatformException, "Body file is NULL."); - } - if (!m_mail->info) { - ThrowMsg(Commons::PlatformException, "Info is NULL."); - } - - FILE* f = fopen(m_mail->body->plain, "w"); - if (NULL != f) { - fprintf(f, getBodyRef().c_str()); - fclose(f); - } - m_mail->info->body_downloaded = true; - setBodyValidity(true); - - LOG_EXIT -} - -void Email::updateSubject() -{ - LOG_ENTER - - if (isSubjectValid()) { return; } - - LogDebug("update subject, msgId=" << getIdRef()); - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail not allocated."); - } - - if (!m_mail->head) { - m_mail->head = EmailService::alloc(); - } - - m_mail->head->subject = Commons::String::strdup(getSubjectRef()); - setSubjectValidity(true); - - LOG_EXIT -} - -void Email::updateReadStatus() -{ - LOG_ENTER - - if (isReadStatusValid()) { return; } - - LogDebug("update read, msgId=" << getIdRef()); - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail not allocated."); - } - - if (!m_mail->info) { - EmailService::alloc(); - } - - m_mail->info->flags.seen = isRead(); - setReadStatusValidity(true); - - LOG_EXIT -} - -void Email::updateRecipients() -{ - LOG_ENTER - - if (getToValidity() && getCcValidity() && getBccValidity()) { return; } - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail is NULL."); - } - - if (!m_mail->head) { - m_mail->head = EmailService::alloc(); - } - - if (!getToValidity()) { - std::string addressLine = EmailUtils::formatAddressLine(getToRecipients()); - if (m_mail->head->to) { - free(m_mail->head->to); - } - m_mail->head->to = Commons::String::strdup(addressLine); - setToValidity(true); - } - - if (!getCcValidity()) { - std::string addressLine = EmailUtils::formatAddressLine(getCcRecipients()); - if (m_mail->head->cc) { - free(m_mail->head->cc); - } - m_mail->head->cc = Commons::String::strdup(addressLine); - setCcValidity(true); - } - - if (!getBccValidity()) { - std::string addressLine = EmailUtils::formatAddressLine( - getBccRecipients()); - if (m_mail->head->bcc) { - free(m_mail->head->bcc); - } - m_mail->head->bcc = Commons::String::strdup(addressLine); - setBccValidity(true); - } - - LOG_EXIT -} - -void Email::updateFrom() -{ - LOG_ENTER - - if (getFromValidity()) { return; } - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail is NULL."); - } - - if (!m_mail->info) { - EmailService::alloc(); - } - - m_mail->info->account_id = Messaging::getInstance().getEmailAccountId( - getFrom()); - // TODO Update m_mail->head->from as well - - setFromValidity(true); - - LOG_EXIT -} - -void Email::updateAttachments() -{ - LOG_ENTER - - if (isAttachmentsValid()) { return; } - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail is NULL."); - } - - emf_attachment_info_t* attachment = NULL; - Try { - LogDebug("update attachments, msgId=" << getIdRef()); - - if (!m_mail->body) { - m_mail->body = EmailService::alloc(); - } else { - m_mail->body->attachment_num = 0; - if (NULL != m_mail->body->attachment) { - EmailService::freeAttachment(m_mail->body->attachment); - m_mail->body->attachment = NULL; - } - } - - std::size_t attachmentSize = getAttachmentsCount(); - if (attachmentSize > 0) { - if (!m_mail->info) { - ThrowMsg(Commons::PlatformException, "Mail info is NULL."); - } - - for (std::size_t i = 0; i < attachmentSize; ++i) { - IAttachmentPtr att = getAttachment(i); - if (!att) { - continue; - } - - LogDebug("updating attachment=" << att->getShortName()); - - attachment = EmailService::alloc(); - attachment->name = Commons::String::strdup(att->getShortName()); - attachment->savename = Commons::String::strdup( - att->getFullPath() - ); - attachment->downloaded = true; - attachment->next = NULL; - - int error = email_add_attachment(m_mailbox.Get(), - m_mail->info->uid, - attachment); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Error while adding attachment. [" << error << "]"); - } - - EmailService::freeAttachment(attachment); - } - - setAttachmentsValidity(true); - } - } - Catch(Commons::PlatformException) { - EmailService::freeAttachment(attachment); - throw; - } - - LOG_EXIT -} - -void Email::updatePriority() -{ - LOG_ENTER - - if (isPriorityValid()) { return; } - - if (!m_mail) { - ThrowMsg(Commons::PlatformException, "Mail not allocated."); - } - - if (!m_mail->info) { - m_mail->info = EmailService::alloc(); - } - - m_mail->info->extra_flags.priority = EmailConverter::toMailPriority( - getPriority()); - setPriorityValid(true); - - LOG_EXIT -} - -int Email::getIntId() const -{ - return convertId(getIdRef()); -} -} -} diff --git a/src/modules/tizen/Messaging/Email.h b/src/modules/tizen/Messaging/Email.h deleted file mode 100644 index 03a8c6c..0000000 --- a/src/modules/tizen/Messaging/Email.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Email.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef EMAIL_H -#define EMAIL_H - -#include -#include -#include -#include - -#include "ScopedMail.h" -#include "ScopedMailbox.h" - -// The email service library -extern "C" { -//temporary solution for email-service problem (compilation break) -#ifndef NOW_REVERT -//#define NOW_REVERT -#endif -#ifndef SUPPORT_CONTACT_ON_SIM -//#define SUPPORT_CONTACT_ON_SIM -#endif -#ifndef _A_PROJECT_ -#define _A_PROJECT_ -#endif - -#ifndef _PREVIEW_IN_MAILIST -#define _PREVIEW_IN_MAILIST -#endif -} - -namespace WrtDeviceApis { -namespace Messaging { -class Email : public Api::IEmail -{ - public: - explicit Email(const std::string& id = std::string()); - - virtual ~Email(); - - virtual void send(); - - virtual void sendCancel(); - - // implementation of interface of IMessage class - virtual void update(bool draftsOnly = false); - - virtual void readAllData(); - - virtual void moveToFolder(const Api::FolderType newFolder); - - virtual void moveToFolder(const std::string& newFolder); - - virtual void copyToFolder(const Api::FolderType newFolder); - - virtual void copyToFolder(const std::string& newFolder); - - virtual void remove(); - - virtual int getAccountId() const; - - private: - void create(); - - void reload(); - - void readHeader(); - - void readBody(); - - void readInfo(); - - void updateBody(); - - void updateRecipients(); - - void updateFrom(); - - void updateAttachments(); - - void updateSubject(); - - void updateReadStatus(); - - void updatePriority(); - - int getIntId() const; - - private: - DPL::Mutex m_updateMutex; - int m_accountId; - ScopedMail m_mail; - ScopedMailbox m_mailbox; -}; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/EmailConverter.cpp b/src/modules/tizen/Messaging/EmailConverter.cpp deleted file mode 100644 index 390b433..0000000 --- a/src/modules/tizen/Messaging/EmailConverter.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include - -#include - -#include "EmailConverter.h" - -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailConverter { - -emf_mail_priority_t toMailPriority(Api::MessagePriority::Priority priority) -{ - LOG_ENTER - switch (priority) { - case Api::MessagePriority::LOW: return EMF_MAIL_PRIORITY_LOW; - case Api::MessagePriority::NORMAL: return EMF_MAIL_PRIORITY_NORMAL; - case Api::MessagePriority::HIGH: return EMF_MAIL_PRIORITY_HIGH; - default: - ThrowMsg(Commons::PlatformException, - "Unsupported priority: " << priority); - } -} - -Api::MessagePriority::Priority toMessagePriority(emf_mail_priority_t priority) -{ - LOG_ENTER - switch (priority) { - case EMF_MAIL_PRIORITY_LOW: return Api::MessagePriority::LOW; - case EMF_MAIL_PRIORITY_NORMAL: return Api::MessagePriority::NORMAL; - case EMF_MAIL_PRIORITY_HIGH: return Api::MessagePriority::HIGH; - default: - // TODO Think it through, log is enough or exception should be thrown. - // ThrowMsg(Commons::PlatformException, - // "Unsupported platform priority: " << priority); - LogWarning("Unsupported platform priority"); - } - - // TODO Fix this. What to return if non-existing priority returned by platform. - return Api::MessagePriority::NORMAL; -} - -Api::MessagePriority::Priority toMessagePriority(unsigned char priority) -{ - return toMessagePriority(static_cast(priority)); -} - -emf_mailbox_type_e toMailboxType(Api::FolderType folder) -{ - LOG_ENTER - switch (folder) { - case Api::INBOX: return EMF_MAILBOX_TYPE_INBOX; - case Api::OUTBOX: return EMF_MAILBOX_TYPE_OUTBOX; - case Api::SENTBOX: return EMF_MAILBOX_TYPE_SENTBOX; - case Api::DRAFTBOX: return EMF_MAILBOX_TYPE_DRAFT; - case Api::SPAMBOX: return EMF_MAILBOX_TYPE_SPAMBOX; - case Api::ALL_FOLDERS: return EMF_MAILBOX_TYPE_ALL_EMAILS; - case Api::USERDEFINED_FOLDER: return EMF_MAILBOX_TYPE_USER_DEFINED; - default: - ThrowMsg(Commons::PlatformException, "Conversion failed."); - } -} - -const char* toMailboxName(Api::FolderType folder) -{ - LOG_ENTER - switch (folder) { - case Api::INBOX: return EMF_INBOX_NAME; - case Api::OUTBOX: return EMF_OUTBOX_NAME; - case Api::SENTBOX: return EMF_SENTBOX_NAME; - case Api::DRAFTBOX: return EMF_DRAFTBOX_NAME; - case Api::SPAMBOX: return EMF_SPAMBOX_NAME; - default: - ThrowMsg(Commons::PlatformException, - "Mailbox not found. Folder: " << folder); - } -} - -Api::FolderType toFolderType(emf_mailbox_type_e mailboxType) -{ - LOG_ENTER - switch (mailboxType) { - case EMF_MAILBOX_TYPE_INBOX: return Api::INBOX; - case EMF_MAILBOX_TYPE_OUTBOX: return Api::OUTBOX; - case EMF_MAILBOX_TYPE_SENTBOX: return Api::SENTBOX; - case EMF_MAILBOX_TYPE_DRAFT: return Api::DRAFTBOX; - case EMF_MAILBOX_TYPE_SPAMBOX: return Api::SPAMBOX; - case EMF_MAILBOX_TYPE_ALL_EMAILS: return Api::ALL_FOLDERS; - case EMF_MAILBOX_TYPE_USER_DEFINED: return Api::USERDEFINED_FOLDER; - default: - ThrowMsg(Commons::PlatformException, "Conversion failed."); - } -} -} -} -} diff --git a/src/modules/tizen/Messaging/EmailConverter.h b/src/modules/tizen/Messaging/EmailConverter.h deleted file mode 100644 index 65d26b8..0000000 --- a/src/modules/tizen/Messaging/EmailConverter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WAC_MESSAGING_EMAILCONVERTER_H_ -#define WAC_MESSAGING_EMAILCONVERTER_H_ - -#include - -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailConverter { -emf_mail_priority_t toMailPriority(Api::MessagePriority::Priority priority); - -Api::MessagePriority::Priority toMessagePriority(emf_mail_priority_t priority); -Api::MessagePriority::Priority toMessagePriority(unsigned char priority); - -emf_mailbox_type_e toMailboxType(Api::FolderType folder); - -const char* toMailboxName(Api::FolderType folder); - -Api::FolderType toFolderType(emf_mailbox_type_e mailboxType); -} -} -} - -#endif diff --git a/src/modules/tizen/Messaging/EmailService.cpp b/src/modules/tizen/Messaging/EmailService.cpp deleted file mode 100644 index 1d7dd9c..0000000 --- a/src/modules/tizen/Messaging/EmailService.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include -#include - -#include -#include - -#include - -#include -#include "EmailUtils.h" -#include "EmailService.h" -#include "ScopedMail.h" -#include "ScopedMailbox.h" - -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailService { -emf_mail_t* createMail(const Api::EmailAccountInfo& account) -{ - LOG_ENTER - ScopedMail result(alloc()); - - result->info = alloc(); - result->info->account_id = account.getIntId(); - result->info->flags.draft = 1; - result->info->extra_flags.priority = EMF_MAIL_PRIORITY_NORMAL; - - result->head = alloc(); - std::string from = EmailUtils::formatAddress(account.getAddress(), - account.getName()); - result->head->from = strdup(from.c_str()); - - result->body = alloc(); - std::string bodyFile = tmpnam(NULL); - // TODO: change following two lines to some (not implemented yet) call - // to Filesystem module (e.g. Filesystem::IManager::getInstance().touch(PATH)). - FILE* f = fopen(bodyFile.c_str(), "w"); - fclose(f); - result->body->plain = strdup(bodyFile.c_str()); - - LOG_EXIT - return result.Release(); -} - -emf_mail_t* readMail(int accountId, - int mailId) -{ - LOG_ENTER - emf_mail_t* result = NULL; - - emf_mailbox_t mailbox; - memset(&mailbox, 0, sizeof(emf_mailbox_t)); - mailbox.account_id = accountId; - - int error = email_get_mail(&mailbox, mailId, &result); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't find message " << mailId << ". [" << error << "]"); - } - - LOG_EXIT - return result; -} - -void deleteMail(int accountId, - int mailId) -{ - LOG_ENTER - emf_mailbox_t mailbox; - memset(&mailbox, 0, sizeof(emf_mailbox_t)); - mailbox.account_id = accountId; - - int error = email_delete_message(&mailbox, &mailId, 1, 0); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Error while deleting mail. [" << error << "]"); - } - LOG_EXIT -} - -emf_mailbox_t* getMailboxByType(int accountId, - emf_mailbox_type_e type) -{ - LOG_ENTER - emf_mailbox_t* result = NULL; - - int error = email_get_mailbox_by_mailbox_type(accountId, type, &result); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't retrieve mailbox. [" << error << "]"); - } - - LOG_ENTER - return result; -} - -int addMailToMailbox(emf_mail_t* mail, - emf_mailbox_t* mailbox) -{ - LOG_ENTER - Assert(mail && mailbox); - - int error = email_add_message(mail, mailbox, 1); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't add message to mailbox. [" << error << "]"); - } - - LOG_EXIT - return mail->info->uid; -} - -void freeAttachment(emf_attachment_info_t* attachment) -{ - LOG_ENTER - if (NULL == attachment) { return; } - - int error = email_free_attachment_info(&attachment); - if (EMF_ERROR_NONE != error) { - LogWarning("Couldn't free attachment. [" << error << "]"); - } - LOG_ENTER -} - -emf_mailbox_t* createMailbox(int accountId, - const char* name) -{ - LOG_ENTER - emf_mailbox_t* result = alloc(); - result->account_id = accountId; - result->name = (NULL != name ? strdup(name) : NULL); - - LOG_EXIT - return result; -} - -// TODO This clonning is not efficent. -emf_mail_t* cloneMail(const emf_mail_t* mail) -{ - LOG_ENTER - emf_mail_t* result = readMail(mail->info->account_id, mail->info->uid); - result->info->uid = 0; - - LOG_EXIT - return result; -} - -emf_mailbox_t* getMailboxByMailId(int accountId, - int mailId) -{ - LOG_ENTER - char* mailboxName = NULL; - int error = email_get_mailbox_name_by_mail_id(mailId, &mailboxName); - // Platform may allocate mailboxName and yet return an error code. - DPL::ScopedFree freeGuard(mailboxName); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't get mailbox name. [" << error << "]"); - } - - emf_mailbox_t* result = NULL; - error = email_get_mailbox_by_name(accountId, mailboxName, &result); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't get mailbox. [" << error << "]"); - } - - LOG_EXIT - return result; -} -} -} -} diff --git a/src/modules/tizen/Messaging/EmailService.h b/src/modules/tizen/Messaging/EmailService.h deleted file mode 100644 index d10aa33..0000000 --- a/src/modules/tizen/Messaging/EmailService.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WAC_MESSAGING_EMAILSERVICE_H_ -#define WAC_MESSAGING_EMAILSERVICE_H_ - -#include -#include -#include - -#include - -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailService { - -template -T* alloc() -{ - T* result = static_cast(::malloc(sizeof(T))); - if (NULL == result) { - throw std::bad_alloc(); - } - ::memset(result, 0, sizeof(*result)); - return result; -} - -emf_mail_t* createMail(const WrtDeviceApis::Messaging::Api::EmailAccountInfo& account); - -emf_mail_t* readMail(int accountId, - int mailId); - -emf_mailbox_t* getMailboxByType(int accountId, - emf_mailbox_type_e type); - -int addMailToMailbox(emf_mail_t* mail, - emf_mailbox_t* mailbox); - -void deleteMail(int accountId, - int mailId); - -void freeAttachment(emf_attachment_info_t* attachment); - -emf_mailbox_t* createMailbox(int accountId, - const char* name); - -emf_mail_t* cloneMail(const emf_mail_t* mail); - -emf_mailbox_t* getMailboxByMailId(int accountId, - int mailId); -} -} -} - -#endif diff --git a/src/modules/tizen/Messaging/EmailUtils.cpp b/src/modules/tizen/Messaging/EmailUtils.cpp deleted file mode 100644 index ee7eccc..0000000 --- a/src/modules/tizen/Messaging/EmailUtils.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include -#include - -#include -#include -#include -#include "EmailUtils.h" - -namespace { -const char* EMAIL_ADDRESS_REGEX = - "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}"; - -using WrtDeviceApis::Commons::StringBuilder; - -const std::string EMAIL_ADDRESS_REGEX_GROUP = - StringBuilder() - .append("(") - .append(EMAIL_ADDRESS_REGEX) - .append(")") - .toString(); -} - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailUtils { -std::string formatAddress(const std::string& address, - const std::string& name) -{ - if (address.empty()) { - ThrowMsg(Commons::PlatformException, "Address is empty."); - } - - std::stringstream ss; - if (!name.empty()) { - ss << "\"" << name << "\" "; - } - ss << "<" << address << ">"; - - return ss.str(); -} - -std::string formatAddressLine(const Api::Recipients& recipients) -{ - std::string result; - for (size_t i = 0; i < recipients.getRecipientSize(); ++i) { - result += formatAddress(recipients.getRecipient(i)) + ";"; - } - return result; -} - -std::string stripAddress(const std::string& address) -{ - std::string result; - pcrecpp::RE re(EMAIL_ADDRESS_REGEX_GROUP); - if (!re.PartialMatch(address, &result)) { - ThrowMsg(Commons::PlatformException, "Couldn't discover email address"); - } - return result; -} - -Api::Recipients stripAddressLine(const std::string& addressLine) -{ - typedef std::vector Addresses; - - Api::Recipients result; - Addresses addresses = Commons::String::split(addressLine, ';'); - for (Addresses::iterator it = addresses.begin(); - it != addresses.end(); - ++it) { - result.appendRecipient(stripAddress(*it)); - } - return result; -} -} -} -} diff --git a/src/modules/tizen/Messaging/EmailUtils.h b/src/modules/tizen/Messaging/EmailUtils.h deleted file mode 100644 index 2f5d86c..0000000 --- a/src/modules/tizen/Messaging/EmailUtils.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WAC_MESSAGING_EMAILUTILS_H_ -#define WAC_MESSAGING_EMAILUTILS_H_ - -#include - -#include - -namespace WrtDeviceApis { -namespace Messaging { -namespace EmailUtils { -/** - * Formats address as: "Name"
. - * @param address E-mail address. - * @param name Name, omitted if empty. - * @return Formatted address. - */ -std::string formatAddress(const std::string& address, - const std::string& name = std::string()); - -/** - * Formats multiple addresses as: "Name1" ;"Name2" ... - * @param recipients Recipients to build address line from. - * @return Formatted addresses. - */ -std::string formatAddressLine(const Api::Recipients& recipients); - -/** - * Extracts bare e-mail address. - * @param address Address to strip. - * @return E-mail address. - */ -std::string stripAddress(const std::string& address); - -/** - * Extracts recipients bare e-mail addresses. - * @param addressLine Address line to split and strip. - * @return Recipients. - */ -Api::Recipients stripAddressLine(const std::string& addressLine); -} -} -} - -#endif diff --git a/src/modules/tizen/Messaging/ISendingObserver.h b/src/modules/tizen/Messaging/ISendingObserver.h deleted file mode 100644 index fb5d766..0000000 --- a/src/modules/tizen/Messaging/ISendingObserver.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file ISendingObserver.h - * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef ISENDINGOBSERVER_H_ -#define ISENDINGOBSERVER_H_ - -#include "CallbackMgr.h" - -extern "C" { -#include -} - -namespace WrtDeviceApis { -namespace Messaging { -/* - * - */ -class ISendingObserver -{ - public: - ISendingObserver() : m_reqId(0) - { - } - - virtual ~ISendingObserver() - { - if (m_reqId) { - CallbackMgrSingleton::Instance().unregister(m_reqId); - } - } - - void setSendigRequestId(int id) - { - m_reqId = id; - } - - void setRecipient(const char* arg) - { - m_recipient = arg; - } - - std::string getRecipient() const - { - return m_recipient; - } - - virtual void sendingCallback(MSG_SENT_STATUS_S *sent_status) = 0; - - private: - int m_reqId; - std::string m_recipient; -}; -} -} - -#endif /* ISENDINGOBSERVER_H_ */ diff --git a/src/modules/tizen/Messaging/MailNotifier.cpp b/src/modules/tizen/Messaging/MailNotifier.cpp deleted file mode 100644 index 50968ed..0000000 --- a/src/modules/tizen/Messaging/MailNotifier.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file MailNotifier.cpp - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include -#include -#include -#include "MailNotifier.h" -#include "StorageChangeMessage.h" -#include "NetworkStatus.h" - -namespace { -const std::string DBUS_INTERFACE_STORAGE_CHANGE = "User.Email.StorageChange"; -const std::string DBUS_FILTER_STORAGE_CHANGE = - "type='signal',interface='" + DBUS_INTERFACE_STORAGE_CHANGE + "'"; -} - -namespace WrtDeviceApis { -namespace Messaging { - -MailNotifier::MailNotifier() : m_connection(new DBus::Connection()) -{ - m_connection->AddListener(this); - m_connection->addFilter(DBUS_FILTER_STORAGE_CHANGE); - m_connection->open(DBUS_BUS_SYSTEM); -} - -MailNotifier::~MailNotifier() -{ - m_connection->RemoveListener(this); - m_connection->close(); -} - -void MailNotifier::setWorkerThread(DPL::Thread* thread) -{ - m_connection->SwitchListenerToThread(this, thread); -} - -void MailNotifier::OnEventReceived(const DBus::MessageEvent& event) -{ - LogDebug("ENTER"); - DBus::MessagePtr message = event.GetArg0(); - if (message->getInterface() == DBUS_INTERFACE_STORAGE_CHANGE) - { - onStorageChange(message); - } -} - -void MailNotifier::onStorageChange(const DBus::MessagePtr& message) -{ - LogDebug("ENTER"); - StorageChangeMessage sc = StorageChangeMessage::parse(message); - int mailId = sc.getMailId(); - switch (sc.getType()) - { - case NOTI_MAIL_ADD: - LogDebug("NOTI_MAIL_ADD [mail id = " << mailId << "]"); - m_incomming.push_back(mailId); - break; - - case NOTI_MAIL_UPDATE: - LogDebug("NOTI_MAIL_UPDATE [mail id: " << mailId << "]"); - if (sc.getExtra() == UPDATE_PARTIAL_BODY_DOWNLOAD) - { - auto it = std::find(m_incomming.begin(), m_incomming.end(), mailId); - if (m_incomming.end() != it) - { - m_incomming.erase(it); - DPL::Event::EventSupport::EmitEvent( - EmailReceivedEvent(mailId)); - } - } - break; - } -} - -} -} diff --git a/src/modules/tizen/Messaging/MailNotifier.h b/src/modules/tizen/Messaging/MailNotifier.h deleted file mode 100644 index 33d8bf3..0000000 --- a/src/modules/tizen/Messaging/MailNotifier.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file MailNotifier.h - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef SRC_MODULES_TIZEN_MESSAGING_MAILNOTIFIER_H_ -#define SRC_MODULES_TIZEN_MESSAGING_MAILNOTIFIER_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { - -DECLARE_GENERIC_EVENT_1(EmailReceivedEvent, int); - -class MailNotifier : public DPL::Event::EventSupport, - private DPL::Event::EventListener -{ -public: - MailNotifier(); - virtual ~MailNotifier(); - - void setWorkerThread(DPL::Thread* thread); - -protected: - virtual void OnEventReceived(const DBus::MessageEvent& event); - - virtual void onStorageChange(const DBus::MessagePtr& message); - -private: - DBus::ConnectionPtr m_connection; - std::vector m_incomming; -}; - -} -} - -#endif diff --git a/src/modules/tizen/Messaging/MailSender.cpp b/src/modules/tizen/Messaging/MailSender.cpp deleted file mode 100644 index 561a0c0..0000000 --- a/src/modules/tizen/Messaging/MailSender.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "MailSender.h" -#include "NetworkStatus.h" -#include "Messaging.h" - -namespace { -const char* DBUS_FILTER_NETWORK_STATUS = - "type='signal',interface='User.Email.NetworkStatus'"; -} - -namespace WrtDeviceApis { -namespace Messaging { -MailSender& MailSender::getInstance() -{ - static MailSender instance; - return instance; -} - -void MailSender::send(const Api::IEmailPtr& mail) -{ - Assert(mail && "Mail must not be NULL."); - - int mailId = mail->convertId(mail->getIdRef()); - SendRequestsIterator it = m_requests.find(mailId); - if (m_requests.end() != it) { - ThrowMsg(Commons::PlatformException, - "Email: " << mailId << " already requested to be send."); - } - - sendInternal(mail); -} - -void MailSender::cancel(int mailId) -{ - SendRequestsIterator it = m_requests.find(mailId); - if (m_requests.end() == it) { - ThrowMsg(Commons::PlatformException, - "Email: " << mailId << " not found."); - } - - cancelInternal(it->second); -} - -// TODO Copied from former solution, refactor it. -void MailSender::OnEventReceived(const DBus::MessageEvent& event) -{ - LogDebug("HERE"); - NetworkStatusPtr msg(new NetworkStatus(event.GetArg0())); - int mailId = msg->getMailId(); - - SendRequestsIterator it = m_requests.find(mailId); - if (m_requests.end() != it) { - switch (msg->getStatus()) { - case NOTI_SEND_START: - LogInfo("Start sending e-mail: " << mailId); - break; - - case NOTI_SEND_FINISH: - { - const Api::IEmailPtr& mail = it->second.mail; - Api::EventSendMessageReqReceiver* requestReceiver = - mail->getRequestReceiver(); - if (requestReceiver) - { - Api::EventSendMessagePtr event = mail->getSendMessageEvent(); - event->addRecipientsSendResult( - mail->getToRecipientsPtr()->getRecipientsRef(), - true); - event->addRecipientsSendResult( - mail->getCcRecipientsPtr()->getRecipientsRef(), - true); - event->addRecipientsSendResult( - mail->getBccRecipientsPtr()->getRecipientsRef(), - true); - requestReceiver->ManualAnswer(event); - } - LogInfo("E-mail sent: " << mailId); - m_requests.erase(mailId); - break; - } - - case NOTI_SEND_FAIL: - { - const Api::IEmailPtr& mail = it->second.mail; - Api::EventOnSendingFailedEmitterPtr emitter = mail->getEmitter(); - Api::EventSendMessageReqReceiver *requestReceiver = - mail->getRequestReceiver(); - if (emitter) { - Api::EventOnSendingFailedPtr event( - new Api::EventOnSendingFailed() - ); - switch (msg->getErrorCode()) { - case EMF_ERROR_NO_SIM_INSERTED: - case EMF_ERROR_FLIGHT_MODE: - event->setError( - Api::EventOnSendingFailed::NO_NETWORKING - ); - break; - - case EMF_ERROR_SMTP_SEND_FAILURE: - case EMF_ERROR_NO_SUCH_HOST: - case EMF_ERROR_CONNECTION_FAILURE: - case EMF_ERROR_CONNECTION_BROKEN: - case EMF_ERROR_INVALID_SERVER: - case EMF_ERROR_NO_RESPONSE: - event->setError( - Api::EventOnSendingFailed::NO_CONNECTION - ); - break; - - default: - event->setError(Api::EventOnSendingFailed::UNKNOWN); - } - emitter->emit(event); - } - else if (requestReceiver) - { - Api::EventSendMessagePtr event = mail->getSendMessageEvent(); - event->addRecipientsSendResult( - mail->getToRecipientsPtr()->getRecipientsRef(), - false); - event->addRecipientsSendResult( - mail->getCcRecipientsPtr()->getRecipientsRef(), - false); - event->addRecipientsSendResult( - mail->getBccRecipientsPtr()->getRecipientsRef(), - false); - event->setExceptionCode( - Commons::ExceptionCodes::UnknownException - ); - requestReceiver->ManualAnswer(event); - } - LogInfo("Sending e-mail: " << mailId << - " failed with error: " << msg->getErrorCode()); - m_requests.erase(mailId); - break; - } - } - } -} - -MailSender::MailSender() : - m_dbusThread(new DPL::Thread()), - m_dbus(new DBus::Connection()) -{ - m_dbusThread->Run(); - - m_dbus->setWorkerThread(m_dbusThread.Get()); - m_dbus->AddListener(this); - m_dbus->SwitchAllListenersToThread( - Commons::ThreadPool::getInstance().getThreadRef(Commons::ThreadEnum::MESSAGING_THREAD) - ); - m_dbus->addFilter(DBUS_FILTER_NETWORK_STATUS); - m_dbus->open(DBUS_BUS_SYSTEM); -} - -MailSender::~MailSender() -{ - m_dbus->RemoveListener(this); - m_dbus->close(); - - m_dbusThread->Quit(); -} - -void MailSender::sendInternal(const Api::IEmailPtr& mail) -{ - int mailId = mail->convertId(mail->getIdRef()); - - emf_mailbox_t mailbox; - memset(&mailbox, 0, sizeof(emf_mailbox_t)); - mailbox.account_id = - Messaging::getInstance().getEmailAccountId(mail->getFromRef()); - // TODO remove ugly casting. - mailbox.name = (char*)EMF_SENTBOX_NAME; - - emf_option_t options; - memset(&options, 0, sizeof(emf_option_t)); - options.keep_local_copy = 1; - - m_requests.insert(std::make_pair(mailId, SendRequestData(mail))); - - int error = email_send_mail(&mailbox, - mailId, - &options, - &m_requests.at(mailId).handle); - if (EMF_ERROR_NONE != error) { - m_requests.erase(mailId); - ThrowMsg(Commons::PlatformException, - "Failed to initialize send request. [" << error << "]"); - } -} - -void MailSender::cancelInternal(const SendRequestData& data) -{ - int mailId = data.mail->convertId(data.mail->getIdRef()); - - int error = email_cancel_job(data.mail->getAccountId(), data.handle); - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't cancel sending for email: " << - data.mail->getIdRef()); - } - - m_requests.erase(mailId); -} -} -} diff --git a/src/modules/tizen/Messaging/MailSender.h b/src/modules/tizen/Messaging/MailSender.h deleted file mode 100644 index 69ca1ff..0000000 --- a/src/modules/tizen/Messaging/MailSender.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef MAILSENDER_H_ -#define MAILSENDER_H_ - -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -// TODO Not thread-safe, make it. -class MailSender : private DPL::Event::EventListener -{ - public: - static MailSender& getInstance(); - - public: - void send(const Api::IEmailPtr& mail); - void cancel(int mailId); - - protected: - void OnEventReceived(const DBus::MessageEvent& event); - - private: - struct SendRequestData - { - unsigned int handle; - Api::IEmailPtr mail; - - explicit SendRequestData(const Api::IEmailPtr& mail) : - handle(0), - mail(mail) - { - } - }; - - typedef std::map SendRequests; - typedef SendRequests::iterator SendRequestsIterator; - - private: - MailSender(); - ~MailSender(); - - void sendInternal(const Api::IEmailPtr& data); - void cancelInternal(const SendRequestData& data); - - private: - DPL::ScopedPtr m_dbusThread; - DBus::ConnectionPtr m_dbus; - SendRequests m_requests; -}; -} -} - -#endif // MAILSENDER_H_ diff --git a/src/modules/tizen/Messaging/Messaging.cpp b/src/modules/tizen/Messaging/Messaging.cpp deleted file mode 100644 index e8aea8b..0000000 --- a/src/modules/tizen/Messaging/Messaging.cpp +++ /dev/null @@ -1,1140 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Messaging.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include -#include - -#include -#include -#include -#include -#include "Messaging.h" -#include "Sms.h" -#include "Mms.h" -#include "BinarySms.h" -#include "Email.h" -#include "EmailConverter.h" -#include "EmailService.h" -#include "NetworkStatus.h" - -extern "C" { -#include -#include -#include -#include -#include -} - -#include - -#define LOG_ENTER LogDebug("---> ENTER"); -#define LOG_EXIT LogDebug("---> EXIT"); - -using namespace WrtDeviceApis::Messaging; -using namespace WrtDeviceApis::Messaging::Api; -using namespace std; - -namespace { -const int MESSAGE_FIND_LIMIT = 100; -} - -namespace WrtDeviceApis { -namespace Messaging { - -int Messaging::m_currentEmailAccountId = 0; -DPL::Atomic Messaging::m_objCounter; - -Messaging& Messaging::getInstance() -{ - static Messaging instance; - return instance; -} - -Messaging::Messaging() : - m_onMessageReceivedHandleMgr(NULL), - m_mailNotifier(new MailNotifier()) -{ - Try - { - const vector accounts = getEmailAccounts(); - LogDebug("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"); - } - } - - Catch(Commons::PlatformException) { - LogError("No email accounts available"); - } - - Catch(Commons::InvalidArgumentException) { - LogError("No email accounts available"); - //current email not configured, skipped - } - - Catch(Commons::UnknownException) { - LogError("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 (EMF_ERROR_NONE != error) { - LogError("email_service_begin() returned error " << error); - } else { - LogInfo("email_service_begin() executed without error"); - } - } - ++m_objCounter; - - m_mailNotifier->AddListener(this); -} - -Messaging::~Messaging() -{ - m_mailNotifier->RemoveListener(this); - - if (!--m_objCounter) { - int error = email_service_end(); - if (EMF_ERROR_NONE != error) { - LogError("email_service_end() returned error " << error); - } else { - LogDebug("email_service_end() executed without error"); - } - } -} - -void Messaging::getNumberOfMessages(MessageType msgType, - FolderType folder, - int* readed, - int* unReaded) -{ - if (NULL == readed || - NULL == unReaded) { - LogError("output pointers are NULL"); - Throw(Commons::InvalidArgumentException); - } - *readed = 0; - *unReaded = 0; - if (Api::SMS == msgType) { - getNumberOfSms(folder, readed, unReaded); - } else if (Api::MMS == msgType) { - getNumberOfMms(folder, readed, unReaded); - } else if (Api::EMAIL == msgType) { - getNumberOfEmails(folder, readed, unReaded); - } else { - LogError("wrong message type"); - Throw(Commons::PlatformException); - } -} - -vector Messaging::findMessages(const vector& msgTypes, - const string &folder, - const MessageFilterPtr& filter) -{ - LogDebug("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); - vector result; - - switch (*it) { - case SMS: - { - FolderType folderEnum = Sms::toFolder(folder); - result = findSms(folderEnum, filter); - break; - } - case MMS: - { - FolderType folderEnum = Mms::toFolder(folder); - result = findMms(folderEnum, filter); - break; - } - case EMAIL: - { - result = findEmail(folder, filter); - break; - } - default: - LogError("message type unknown"); - Throw(Commons::PlatformException); - } - LogDebug("Found: " << result.size()); - copy(result.begin(), result.end(), biit); - } - - return retVal; -} - -vector Messaging::findMessages(const vector& msgTypes, - FolderType folder, - const Api::MessageFilterPtr& filter) -{ - LogDebug("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); - vector(Messaging::*findFnPtr)(Api::FolderType folder, - const Api::MessageFilterPtr - & filter) = NULL; - - switch (*it) { - case SMS: - { - findFnPtr = &Messaging::findSms; - break; - } - case MMS: - { - findFnPtr = &Messaging::findMms; - break; - } - case EMAIL: - { - findFnPtr = &Messaging::findEmail; - break; - } - default: - LogError("message type unknown"); - Throw(Commons::PlatformException); - } - vector result = (this->*findFnPtr)(folder, filter); - LogDebug("Found: " << result.size()); - copy(result.begin(), result.end(), biit); - } - - return retVal; -} - -vector Messaging::getMessageIds(MessageType msgType, - FolderType folder) -{ - switch (msgType) { - case SMS: - return getSmsIds(folder); - case MMS: - return getMmsIds(folder); - case EMAIL: - return getEmailIds(folder); - default: - LogError("not supported message type"); - Throw(Commons::InvalidArgumentException); - } -} - -vector Messaging::getSmsIds(FolderType folder) -{ - vector retVal; - msg_message_t msg = msg_new_message(); - MSG_LIST_S folder_list_view = { 0, NULL }; - - Try - { - const MSG_SORT_RULE_S sort_rules = { MSG_SORT_BY_DISPLAY_TIME, true }; - MSG_ERROR_T res = MSG_ERR_UNKNOWN; - const MSG_FOLDER_ID_T platformFolder = convertFolderToPlatform(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); - Throw(Commons::PlatformException); - } - - for (int i = 0; i < folder_list_view.nCount; i++) { - if (MSG_TYPE_SMS == - msg_get_message_type(folder_list_view.msgInfo[i])) { - int l_msgId = msg_get_message_id(folder_list_view.msgInfo[i]); - ostringstream stream; - stream << l_msgId; - retVal.push_back(stream.str()); - } - } - - msg_release_message_list(&folder_list_view); - } - - Catch(Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); - if (folder_list_view.nCount) { - msg_release_message_list(&folder_list_view); - } - if (msg) { - msg_release_message(&msg); - } - throw; - } - - return retVal; -} - -vector Messaging::getMmsIds(FolderType folder) -{ - vector retVal; - msg_message_t msg = msg_new_message(); - MSG_LIST_S folder_list_view = { 0, NULL }; - - Try - { - const MSG_SORT_RULE_S sort_rules = { MSG_SORT_BY_DISPLAY_TIME, true }; - MSG_ERROR_T res = MSG_ERR_UNKNOWN; - const MSG_FOLDER_ID_T platformFolder = convertFolderToPlatform(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); - Throw(Commons::PlatformException); - } - - for (int i = 0; i < folder_list_view.nCount; i++) { - if (MSG_TYPE_MMS == - msg_get_message_type(folder_list_view.msgInfo[i])) { - int l_msgId = msg_get_message_id(folder_list_view.msgInfo[i]); - ostringstream stream; - stream << l_msgId; - retVal.push_back(stream.str()); - } - } - - msg_release_message_list(&folder_list_view); - } - - Catch(Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); - if (folder_list_view.nCount) { - msg_release_message_list(&folder_list_view); - } - if (msg) { - msg_release_message(&msg); - } - throw; - } - - return retVal; -} - -vector Messaging::getEmailIds(FolderType /*folder*/) -{ - vector retVal; - - //TODO - LogError("TODO"); - Throw(Commons::UnknownException); - - return retVal; -} - -vector Messaging::getEmailAccounts() const -{ - emf_account_t* accounts = NULL; - int count = 0; - Try { - if (!email_get_account_list(&accounts, &count)) { - ThrowMsg(Commons::PlatformException, - "Couldn't get e-mail accounts."); - } - - if (0 == count) { - ThrowMsg(Commons::PlatformException, "No e-mail account found."); - } - - vector result; - for (int i = 0; i < count; ++i) { - Api::EmailAccountInfo account(accounts[i].account_id, - accounts[i].user_name, - accounts[i].email_addr); - result.push_back(account); - } - - if (accounts != NULL) { - email_free_account(&accounts, count); - } - - return result; - } - Catch(Commons::PlatformException) { - if (accounts != NULL) { - email_free_account(&accounts, count); - } - throw; - } -} - -int Messaging::getEmailAccountId(const std::string& account) -{ - int retVal = 0; - string tmpAccount = account; - emf_account_t *pAccountArray = NULL; - int iCount = 0; - - Try - { - if (account.empty()) { - tmpAccount = getCurrentEmailAccount().getAddress(); - if (tmpAccount.empty()) { - LogError( - "current email account is not set, possible that no account created"); - Throw(Commons::PlatformException); - } - } - - if (!email_get_account_list(&pAccountArray, &iCount)) { - LogError("email_get_account_list error"); - Throw(Commons::PlatformException); - } - - if (0 == iCount) { - LogError("no email account exist"); - Throw(Commons::PlatformException); - } - - for (int i = 0; i < iCount; i++) { - string tmp = pAccountArray[i].email_addr; - if (tmp == tmpAccount) { - m_currentEmailAccountId = pAccountArray[i].account_id; - retVal = m_currentEmailAccountId; - break; - } - } - - if (0 == m_currentEmailAccountId) { - LogError("wrong email account ID"); - Throw(Commons::PlatformException); - } - - if (pAccountArray != NULL) { - LogDebug("free account, ptr=" << pAccountArray); - email_free_account(&pAccountArray, iCount); - } - - if (0 == retVal) { - LogError("no email account created"); - Throw(Commons::PlatformException); - } - } - - Catch(Commons::PlatformException) { - LogError("exception catch, platform exception"); - if (pAccountArray != NULL) { - email_free_account(&pAccountArray, iCount); - } - throw; - } - - return retVal; -} - -void Messaging::fetchEmailHeaders() -{ - emf_mailbox_t *mailbox = NULL; - unsigned handle = 0; - mailbox = static_cast(calloc(sizeof (emf_mailbox_t), 1)); - if (!mailbox) { - LogError("calloc failed"); - return; - } - mailbox->account_id = m_currentEmailAccountId; - mailbox->name = strdup(EMF_INBOX_NAME); - if (EMF_ERROR_NONE != email_sync_header(mailbox, &handle)) { - LogError("email_sync_header failed"); - } - email_free_mailbox(&mailbox, 1); -} - -int Messaging::convertFolderToPlatform(const FolderType folder) -{ - MSG_FOLDER_ID_T platfromFolderId; - switch (folder) { - case INBOX: - platfromFolderId = MSG_INBOX_ID; - break; - case DRAFTBOX: - platfromFolderId = MSG_DRAFT_ID; - break; - case OUTBOX: - platfromFolderId = MSG_OUTBOX_ID; - break; - case SENTBOX: - platfromFolderId = MSG_SENTBOX_ID; - break; - case SPAMBOX: - - default: - LogError("Invalid folder: " << folder); - Throw(Commons::PlatformException); - } - - return platfromFolderId; -} - -int Messaging::convertFolderToPlatform(const std::string &folder) -{ - MSG_FOLDER_LIST_S folderList = { 0, NULL }; - int result = 0; - Try - { - if (MSG_SUCCESS != - msg_get_folder_list(MsgGetCommonHandle(), &folderList)) { - LogError("msg_get_folder_list error"); - Throw(Commons::PlatformException); - } - for (int i = 0; i < folderList.nCount; ++i) { - if (MSG_FOLDER_TYPE_USER_DEF == - folderList.folderInfo[i].folderType && - NULL != folderList.folderInfo[i].folderName && - folder == folderList.folderInfo[i].folderName) { - result = folderList.folderInfo[i].folderId; - break; - } - } - } - Catch(Commons::PlatformException) { - if (folderList.nCount) { - msg_release_folder_list(&folderList); - } - throw; - } - if (folderList.nCount) { - msg_release_folder_list(&folderList); - } - return result; -} - -void Messaging::addOnMessageReceived( - const Api::EmitterMessageReceivedPtr& emitter) -{ - LogDebug("ENTER"); - m_onMessageReceived.attach(emitter); - EmittersMessageReceived::LockType lock = m_onMessageReceived.getLock(); - if (m_onMessageReceived.size() == 1) { - m_onMessageReceivedHandleMgr = MsgServiceHandleMgrPtr( - new MsgServiceHandleMgr()); - int err; - - err = msg_reg_sms_message_callback( - m_onMessageReceivedHandleMgr->getHandle(), - onSmsReceived, - 0, - this); - if (err != MSG_SUCCESS) { - LogError("Couldn't register on SMS received callback, err=" << err); - } - err = msg_reg_mms_conf_message_callback( - m_onMessageReceivedHandleMgr->getHandle(), - onMmsReceived, - NULL, - this); - if (err != MSG_SUCCESS) { - LogError("Couldn't register on MMS received callback, err=" << err); - } - } -} - -void Messaging::removeOnMessageReceived(Api::EmitterMessageReceived::IdType id) -{ - LogDebug("ENTER"); - m_onMessageReceived.detach(id); - EmittersMessageReceived::LockType lock = m_onMessageReceived.getLock(); - if (m_onMessageReceived.size() == 0) { - m_onMessageReceivedHandleMgr = MsgServiceHandleMgrPtr(NULL); - } -} - -void Messaging::OnEventReceived(const EmailReceivedEvent& event) -{ - LogDebug("Received email: " << event.GetArg0()); - EventMessageReceivedPtr jsEvent(new EventMessageReceived()); - IMessagePtr msg = MessageFactory::createMessage(EMAIL, event.GetArg0()); - - IEmailPtr email = MessageFactory::convertToEmail(msg); - jsEvent->setMessage(msg); - m_onMessageReceived.emitIf(jsEvent, - MessageFilterMatcher(email)); -} - -void Messaging::onSmsReceived(MSG_HANDLE_T /*handle*/, - msg_message_t msg, - void* data) -{ - LogDebug("ENTER"); - Messaging* this_ = static_cast(data); - if (this_) { - Try { - IMessagePtr message = MessageFactory::createMessage( - SMS, - msg_get_message_id( - msg)); - ISmsPtr sms = MessageFactory::convertToSms(message); - EventMessageReceivedPtr event(new EventMessageReceived()); - event->setMessage(message); - this_->m_onMessageReceived.emitIf(event, - MessageFilterMatcher( - sms)); - } - Catch(Commons::ConversionException) { - LogError("Couldn't convert message to sms."); - } - } -} - -void Messaging::onMmsReceived(MSG_HANDLE_T /*handle*/, - msg_message_t msg, - void* data) -{ - LogDebug("ENTER"); - Messaging* this_ = static_cast(data); - if (this_) { - Try { - IMessagePtr message = MessageFactory::createMessage( - MMS, - msg_get_message_id( - msg)); - IMmsPtr mms = MessageFactory::convertToMms(message); - EventMessageReceivedPtr event(new EventMessageReceived()); - event->setMessage(message); - this_->m_onMessageReceived.emitIf(event, - MessageFilterMatcher( - mms)); - } - Catch(Commons::ConversionException) { - LogError("Couldn't convert message to mms."); - } - } -} - -void Messaging::getNumberOfEmails(Api::FolderType folder, - int* read, - int* unread) -{ - LOG_ENTER - - emf_mailbox_t mailbox; - memset(&mailbox, 0, sizeof(emf_mailbox_t)); - mailbox.account_id = 0; // means for all accounts - mailbox.name = Commons::String::strdup( - EmailConverter::toMailboxName(folder) - ); - - int error = email_count_message(&mailbox, read, unread); - free(mailbox.name); - - if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't get number of emails. [" << error << "]"); - } - - LOG_EXIT -} - -void Messaging::getNumberOfSms(Api::FolderType folder, - int* read, - int* unread) -{ - getNumberOfSmsMms(folder, read, unread, SMS); -} - -void Messaging::getNumberOfMms(Api::FolderType folder, - int* read, - int* unread) -{ - getNumberOfSmsMms(folder, read, unread, MMS); -} - -void Messaging::getNumberOfSmsMms(Api::FolderType folder, - int* read, - int* unread, - Api::MessageType msgType) -{ - MSG_LIST_S folderListView = { 0, NULL }; - - *read = 0; - *unread = 0; - - Try - { - MSG_MESSAGE_TYPE_T msgTypePlatform; - if (SMS == msgType) { - msgTypePlatform = MSG_TYPE_SMS; - } else if (MMS == msgType) { - msgTypePlatform = MSG_TYPE_MMS; - } else { - LogError("no supported message type in this method"); - Throw(Commons::PlatformException); - } - - MSG_FOLDER_ID_T msgFolderId; - switch (folder) { - case INBOX: - msgFolderId = MSG_INBOX_ID; - break; - case OUTBOX: - msgFolderId = MSG_OUTBOX_ID; - break; - case SPAMBOX: - msgFolderId = MSG_SPAMBOX_ID; - break; - case SENTBOX: - msgFolderId = MSG_SENTBOX_ID; - break; - case DRAFTBOX: - msgFolderId = MSG_DRAFT_ID; - break; - default: - LogError("wrong folder type"); - Throw(Commons::PlatformException); - break; - } - - const MSG_SORT_RULE_S sort_rules = { MSG_SORT_BY_DISPLAY_TIME, true }; - if (msg_get_folder_view_list(MsgGetCommonHandle(), msgFolderId, - &sort_rules, - &folderListView) != MSG_SUCCESS) { - LogDebug("msg_get_folder_view_list empty or failed, msgFolderId=" << - (int) msgFolderId); - Throw(Commons::PlatformException); - } - // go thtough all message to check type of message - LogDebug("msgCount=" << (int) folderListView.nCount); - for (int msg_cnt = 0; msg_cnt < folderListView.nCount; msg_cnt++) { - LogDebug("msgMainType=" << - msg_get_message_type(folderListView.msgInfo[msg_cnt]) << - ", searching for = " << (int) msgTypePlatform); - if (msgTypePlatform == msg_get_message_type( - folderListView.msgInfo[msg_cnt])) { - if (msg_is_read(folderListView.msgInfo[msg_cnt])) { - (*read)++; - } else { - (*unread)++; - } - } - } - msg_release_message_list(&folderListView); - - LogDebug("readed=" << *read << ", unReaded=" << *unread); - } - - Catch(Commons::PlatformException) { - if (folderListView.nCount) { - msg_release_message_list(&folderListView); - } - throw; - } -} - -vector Messaging::findSms(Api::FolderType folder, - const Api::MessageFilterPtr& filter) -{ - vector retVal; - msg_message_t msg = msg_new_message(); - MSG_LIST_S folder_list_view = { 0, NULL }; - - Try - { - const MSG_SORT_RULE_S sort_rules = { MSG_SORT_BY_DISPLAY_TIME, true }; - MSG_ERROR_T res = MSG_ERR_UNKNOWN; - const MSG_FOLDER_ID_T platformFolder = convertFolderToPlatform(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); - Throw(Commons::PlatformException); - } - - for (int i = 0; i < folder_list_view.nCount; i++) { - if (MSG_TYPE_SMS == - msg_get_message_type(folder_list_view.msgInfo[i])) { - int l_msgId = msg_get_message_id(folder_list_view.msgInfo[i]); - Api::IMessagePtr msg = MessageFactory::createMessage(SMS, - l_msgId); - // invalid or null filter = empty filter - if (!filter || !filter->isValid() || - filter->compare(MessageFactory::convertToSms(msg))) { - retVal.push_back(msg); - } - } - } - - msg_release_message_list(&folder_list_view); - } - - Catch(Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); - if (folder_list_view.nCount) { - msg_release_message_list(&folder_list_view); - } - if (msg) { - msg_release_message(&msg); - } - throw; - } - - return retVal; -} - -vector Messaging::findMms(Api::FolderType folder, - const Api::MessageFilterPtr& filter) -{ - vector retVal; - msg_message_t msg = msg_new_message(); - MSG_LIST_S folder_list_view = { 0, NULL }; - - Try - { - const MSG_SORT_RULE_S sort_rules = { MSG_SORT_BY_DISPLAY_TIME, true }; - MSG_ERROR_T res = MSG_ERR_UNKNOWN; - const MSG_FOLDER_ID_T platformFolder = convertFolderToPlatform(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); - Throw(Commons::PlatformException); - } - - for (int i = 0; i < folder_list_view.nCount; i++) { - if (MSG_TYPE_MMS == - msg_get_message_type(folder_list_view.msgInfo[i])) { - int l_msgId = msg_get_message_id(folder_list_view.msgInfo[i]); - Api::IMessagePtr msg = - MessageFactory::createMessage(MMS, l_msgId); - // invalid or null filter = empty filter - if (!filter || !filter->isValid() || - filter->compare(MessageFactory::convertToMms(msg))) { - retVal.push_back(msg); - } - } - } - - msg_release_message_list(&folder_list_view); - } - - Catch(Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); - if (folder_list_view.nCount) { - msg_release_message_list(&folder_list_view); - } - if (msg) { - msg_release_message(&msg); - } - throw; - } - - return retVal; -} - -void Messaging::createFolder(MessageType msgType, - const string& userFolder) -{ - switch (msgType) { - case Api::SMS: - case Api::MMS: - createMsgServiceFolder(userFolder); - break; - case Api::EMAIL: - createEmailFolder(userFolder); - break; - default: - LogError("msg not supported"); - Throw(Commons::UnknownException); - } -} - -void Messaging::createMsgServiceFolder(const std::string& userFolder) -{ - if (userFolder.length() > MAX_FOLDER_NAME_SIZE) { - LogError("folder name to long"); - Throw(Commons::PlatformException); - } - - MSG_FOLDER_INFO_S folderInfo; - - folderInfo.folderId = 0; - strncpy(folderInfo.folderName, userFolder.c_str(), userFolder.length()); - - folderInfo.folderType = MSG_FOLDER_TYPE_USER_DEF; - - if (msg_add_folder(MsgGetCommonHandle(), &folderInfo) != MSG_SUCCESS) { - LogError("msg_add_folder failed"); - Throw(Commons::PlatformException); - } -} - -void Messaging::createEmailFolder(const std::string& /*userFolder*/) -{ - //TODO - LogError("TODO"); - Throw(Commons::UnknownException); -} - -void Messaging::deleteFolder(MessageType msgType, - const string& userFolder) -{ - switch (msgType) { - case Api::SMS: - case Api::MMS: - deleteMsgServiceFolder(userFolder); - break; - case Api::EMAIL: - deleteEmailFolder(userFolder); - break; - default: - LogError("msg not supported"); - Throw(Commons::UnknownException); - } -} - -void Messaging::deleteMsgServiceFolder(const string& userFolder) -{ - Try - { - int platformFolderId = convertFolderToPlatform(userFolder); - if (MSG_SUCCESS != - msg_delete_folder(MsgGetCommonHandle(), platformFolderId)) { - LogError("msg_get_folder_list failed"); - Throw(Commons::PlatformException); - } - } - Catch(Commons::PlatformException) { - throw; - } -} - -void Messaging::deleteEmailFolder(const string& /*userFolder*/) -{ - //TODO - LogError("TODO"); - Throw(Commons::UnknownException); -} - -vector Messaging::getFolderNames(MessageType msgType) -{ - switch (msgType) { - case Api::SMS: - case Api::MMS: - return getFolderNamesMsgService(); - case Api::EMAIL: - return getFolderNamesEmail(); - default: - LogError("msg not supported"); - Throw(Commons::UnknownException); - } -} - -vector Messaging::getFolderNamesMsgService() -{ - vector retVal; - MSG_FOLDER_LIST_S msgFolderList = { 0, NULL }; // output data - - Try - { - if (msg_get_folder_list(MsgGetCommonHandle(), - &msgFolderList) != MSG_SUCCESS) { - LogError("msg_get_folder_list failed"); - Throw(Commons::PlatformException); - } - - LogDebug("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( - "folderType=" << - (int) msgFolderList.folderInfo[i].folderType); - retVal.push_back(msgFolderList.folderInfo[i].folderName); - } - (void) msg_release_folder_list(&msgFolderList); - } - - Catch(Commons::PlatformException) { - if (msgFolderList.nCount) { - (void) msg_release_folder_list(&msgFolderList); - } - throw; - } - return retVal; -} - -vector Messaging::getFolderNamesEmail() -{ - vector retVal; - - string tmpStr; - emf_mailbox_t* mailboxes = NULL; - int mailboxesCount; - string emailAccountName; - Api::EmailAccountInfo account = getCurrentEmailAccount(); - - Try - { - if (!email_get_mailbox_list(account.getIntId(), -1, &mailboxes, - &mailboxesCount) || !mailboxes) { - LogError("error during get mailboxes"); - } - for (int i = 0; i < mailboxesCount; i++) { - retVal.push_back(mailboxes->name); - LogDebug("mailbox found, name=" << mailboxes->name); - mailboxes++; - } - } - - Catch(Commons::PlatformException) { - // nothing to clean, re-throw exception - throw; - } - - return retVal; -} - -vector Messaging::findEmail(const std::string &folder, - const Api::MessageFilterPtr& filter) -{ - vector retVal; - - Api::EmailAccountInfo account = getCurrentEmailAccount(); - if (account.getId().empty()) { - LogWarning("No valid email accounts. Skipping"); - return retVal; - } - - int accountId = account.getIntId(); - - // number of found emails - int count = 0; - // start index - int startIndex = 0; - - do { - emf_mail_list_item_t* results = NULL; - int err = email_get_mail_list_ex(accountId, - folder.c_str(), - EMF_LIST_TYPE_NORMAL, - startIndex, - MESSAGE_FIND_LIMIT, - EMF_SORT_DATETIME_HIGH, - &results, - &count); - DPL::ScopedFree autoFree(results); - (void)autoFree; - if (EMF_ERROR_MAIL_NOT_FOUND == err || results == NULL) { - LogWarning("No emails found in mailbox: " << folder); - break; - } else if (EMF_ERROR_NONE != err) { - LogError( - "Unable to get mail list for mailbox: " << folder << - ", Error: " << err); - Throw(Commons::PlatformException); - } - - // apply filter - for (int i = 0; i < count; ++i) { - Api::IMessagePtr msg = MessageFactory::createMessage( - EMAIL, - results[i]. - mail_id); - if (!filter || - filter->compare(MessageFactory::convertToEmail(msg))) { - retVal.push_back(msg); - } - } - - startIndex += count; - } - while (count >= MESSAGE_FIND_LIMIT); - - return retVal; -} - -vector Messaging::findEmail(Api::FolderType folder, - const Api::MessageFilterPtr& filter) -{ - vector result; - - Api::EmailAccountInfo account = getCurrentEmailAccount(); - if (account.getId().empty()) { - LogWarning("No valid email accounts."); - return result; - } - - string name; - try { - name = EmailConverter::toMailboxName(folder); - } - catch (const Commons::PlatformException& ex) { - LogWarning(ex.DumpToString()); - return result; - } - - int accountId = account.getIntId(); - int startIndex = 0; - int count = 0; - do { - emf_mail_list_item_t* messages = NULL; - int error = email_get_mail_list_ex(accountId, - name.c_str(), - EMF_LIST_TYPE_NORMAL, - startIndex, - MESSAGE_FIND_LIMIT, - EMF_SORT_DATETIME_HIGH, - &messages, - &count); - DPL::ScopedFree freeGuard(messages); - if ((EMF_ERROR_MAIL_NOT_FOUND == error) || (NULL == messages)) { - LogWarning("No emails found in mailbox: " << name); - break; - } else if (EMF_ERROR_NONE != error) { - ThrowMsg(Commons::PlatformException, - "Couldn't get mail list from mailbox: " << name << - ". [" << error << "]"); - } - - for (int i = 0; i < count; ++i) { - Api::IMessagePtr msg = - MessageFactory::createMessage(EMAIL, messages[i].mail_id); - if (!filter || - filter->compare(MessageFactory::convertToEmail(msg))) { - result.push_back(msg); - } - } - - startIndex += count; - } - while (count >= MESSAGE_FIND_LIMIT); - - return result; -} -} -} diff --git a/src/modules/tizen/Messaging/Messaging.h b/src/modules/tizen/Messaging/Messaging.h deleted file mode 100644 index 0bfc3aa..0000000 --- a/src/modules/tizen/Messaging/Messaging.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Messaging.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MESSAGING_H -#define MESSAGING_H - -#include -#include -#include -#include -#include -extern "C" { -#include -} -#include -#include -#include -#include -#include -#include -#include -#include "MsgServiceHandleMgr.h" -#include "MailNotifier.h" - -namespace WrtDeviceApis { -namespace Messaging { -class Messaging : public Api::IMessaging, - private DPL::Event::EventListener -{ - public: - static Messaging& getInstance(); - - public: - virtual ~Messaging(); - - virtual void getNumberOfMessages(Api::MessageType msgType, - Api::FolderType folder, - int* readed, - int* unReaded); - - virtual std::vector findMessages( - const std::vector& msgTypes, - Api::FolderType folder, - const Api::MessageFilterPtr& filter); - - virtual std::vector findMessages( - const std::vector& msgTypes, - const std::string &folder, - const Api::MessageFilterPtr& filter); - - virtual std::vector getMessageIds(Api::MessageType msgType, - Api::FolderType folder); - - virtual void createFolder(Api::MessageType msgType, - const std::string& userFolder); - - virtual void deleteFolder(Api::MessageType msgType, - const std::string& userFolder); - - virtual std::vector getFolderNames(Api::MessageType msgType); - - virtual std::vector getEmailAccounts() const; - - int getEmailAccountId(const std::string& account); - - void fetchEmailHeaders(); - - static int convertFolderToPlatform(const Api::FolderType folder); - - /** - * Gets folder id by given folder name. - * @return Folder id or 0 if not found - * @throw PlatformException on platform error. - */ - static int convertFolderToPlatform(const std::string &folder); - - void addOnMessageReceived(const Api::EmitterMessageReceivedPtr& emitter); - - void removeOnMessageReceived(Api::EmitterMessageReceived::IdType id); - - public: - static int m_currentEmailAccountId; - - static DPL::Atomic m_objCounter; - - protected: - void OnEventReceived(const EmailReceivedEvent& event); - - private: - typedef Commons::Emitters EmittersMessageReceived; - - template - struct MessageFilterMatcher - { - public: - MessageFilterMatcher(const MessageType& message) : m_message(message) - { - } - - bool operator()(const EmittersMessageReceived::EmitterPtrType& emitter) - const - { - if (!m_message) { - return false; - } - if (!emitter->getFilter()) { - return true; - } - return emitter->getFilter()->compare(m_message); - } - - private: - MessageType m_message; - }; - - private: - Messaging(); - - static void onSmsReceived(MSG_HANDLE_T handle, - msg_message_t msg, - void* data); - static void onMmsReceived(MSG_HANDLE_T handle, - msg_message_t msg, - void* data); - - private: - - void getNumberOfEmails(Api::FolderType folder, - int* read, - int* unread); - - void getNumberOfSms(Api::FolderType folder, - int* read, - int* unread); - - void getNumberOfMms(Api::FolderType folder, - int* read, - int* unread); - - void getNumberOfSmsMms(Api::FolderType folder, - int* read, - int* unread, - Api::MessageType msgType); - - virtual std::vector findSms(Api::FolderType folder, - const Api::MessageFilterPtr& filter); - - virtual std::vector findMms(Api::FolderType folder, - const Api::MessageFilterPtr& filter); - - virtual std::vector findEmail(Api::FolderType folder, - const Api::MessageFilterPtr& filter); - - virtual std::vector findEmail(const std::string &folder, - const Api::MessageFilterPtr& filter); - - std::vector getSmsIds(Api::FolderType folder); - - std::vector getMmsIds(Api::FolderType folder); - - std::vector getEmailIds(Api::FolderType folder); - - void createMsgServiceFolder(const std::string& userFolder); - - void createEmailFolder(const std::string& userFolder); - - void deleteMsgServiceFolder(const std::string& userFolder); - - void deleteEmailFolder(const std::string& userFolder); - - std::vector getFolderNamesMsgService(); - - std::vector getFolderNamesEmail(); - - private: - EmittersMessageReceived m_onMessageReceived; - MsgServiceHandleMgrPtr m_onMessageReceivedHandleMgr; - std::unique_ptr m_mailNotifier; -}; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/Mms.cpp b/src/modules/tizen/Messaging/Mms.cpp deleted file mode 100644 index 2cdb15f..0000000 --- a/src/modules/tizen/Messaging/Mms.cpp +++ /dev/null @@ -1,880 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Mms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "Mms.h" - -#include -#include -#include -#include -#include "Messaging.h" -#include "CallbackMgr.h" -#include "MsgServiceHandleMgr.h" - -extern "C" { -#include -#include -#include -} - -namespace { -const char* TEXT_AREA = "Text"; -const char* TEXT_FILE_EXTENSION = ".txt"; -const int WHITE_COLOR = 0xffffff; -const int BLACK_COLOR = 0x000000; -const int ROOT_LAYOUT_WIDTH = 100; -const int ROOT_LAYOUT_HEIGHT = 100; -const char* EMPTY_ID = "0"; -} - -using namespace std; -using namespace WrtDeviceApis::Messaging; -using namespace WrtDeviceApis::Messaging::Api; - -namespace WrtDeviceApis { -namespace Messaging { -Mms::Mms(const string& id) : - IMessage(MMS, id), - m_bodyFilePath(string(tmpnam(NULL)) + TEXT_FILE_EXTENSION), - m_messageData(NULL) -{ - LogDebug("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); - if (getIdRef().empty()) { - createNewMessage(); - } else { - readExistingMessage(); - } -} - -Mms::~Mms() -{ - LogDebug("enter"); - - if (m_messageData) { - // release platform message structure - msg_release_message(&m_messageData); - } - - //remove tmp file - //trying to remove file, return value is skipped - if (!m_bodyFilePath.empty()) { - LogDebug("remove tmp file=" << m_bodyFilePath); - (void) ::remove(m_bodyFilePath.c_str()); - } -} - -void Mms::createNewMessage() -{ - if (m_messageData) { - msg_release_message(&m_messageData); - m_messageData = NULL; - } - m_messageData = msg_new_message(); - - MSG_SENDINGOPT_S sendOpt; - memset(&sendOpt, 0, sizeof(MSG_SENDINGOPT_S)); - - sendOpt.bSetting = false; - - // initialize platform message structure - msg_set_message_id(m_messageData, 0); // It should be set 0 - msg_set_folder_id(m_messageData, MSG_DRAFT_ID); - msg_set_message_type(m_messageData, MSG_TYPE_MMS); - msg_set_storage_id(m_messageData, MSG_STORAGE_PHONE); - msg_set_subject(m_messageData, ""); - msg_set_read_status(m_messageData, false); - msg_set_network_status(m_messageData, MSG_NETWORK_NOT_SEND); - msg_set_direction_info(m_messageData, MSG_DIRECTION_TYPE_MO); - msg_set_priority_info(m_messageData, MSG_MESSAGE_PRIORITY_NORMAL); - - tm dateT = getDateTime(); - msg_set_time(m_messageData, mktime(&dateT)); - - setMmsType(MULTIPART_MIXED); - setReadStatus(false); - - LogDebug("Message created successfully, Id: " << getIdRef()); -} - -void Mms::readExistingMessage() -{ - LogDebug("entered"); - - if (getIdRef().empty() || (EMPTY_ID == getIdRef())) { - ThrowMsg(Commons::PlatformException, "Empty id."); - } - - Try { - MSG_SENDINGOPT_S option; - option.bSetting = false; - - // release old data - msg_release_message(&m_messageData); - m_messageData = NULL; - // crate new structure - m_messageData = msg_new_message(); - - // trying to get message from platform - if (MSG_SUCCESS != msg_get_message( - MsgGetCommonHandle(), convertId(getIdRef()), m_messageData, - &option)) { - LogError("get message error"); - Throw(Commons::PlatformException); - } - LogDebug("message found with msgId=" << getIdRef()); - - // read all mms dat to abstraction layer - readRecipientList(m_messageData); - readPriority(m_messageData); - readSubject(m_messageData); - readBodyAndAttachments(m_messageData); - readFolder(m_messageData); - readDateTime(m_messageData); - readReadStatus(m_messageData); - } - Catch(Commons::Exception) { - // nothing to do - } -} - -void Mms::readDateTime(msg_message_t& messageData) -{ - tm* time = localtime(msg_get_time(messageData)); - if (!time) { - LogError("localtime failed"); - Throw(Commons::PlatformException); - } - setDateTime(*time); -} - -void Mms::readReadStatus(msg_message_t& messageData) -{ - setReadStatus(msg_is_read(messageData)); -} - -void Mms::readFolder(msg_message_t& messageData) -{ - switch (msg_get_folder_id(messageData)) { - case MSG_INBOX_ID: - setFolderType(Api::INBOX); - break; - case MSG_OUTBOX_ID: - setFolderType(Api::OUTBOX); - break; - case MSG_SENTBOX_ID: - setFolderType(Api::SENTBOX); - break; - case MSG_DRAFT_ID: - setFolderType(Api::DRAFTBOX); - break; - case MSG_SPAMBOX_ID: - setFolderType(Api::SPAMBOX); - break; - default: - ThrowMsg(Commons::PlatformException, "Unsupported folder id."); - } -} - -void Mms::readPriority(msg_message_t& messageData) -{ - switch (msg_get_priority_info(messageData)) { - case MSG_MESSAGE_PRIORITY_LOW: - setPriority(MessagePriority::LOW); - break; - case MSG_MESSAGE_PRIORITY_NORMAL: - setPriority(MessagePriority::NORMAL); - break; - case MSG_MESSAGE_PRIORITY_HIGH: - setPriority(MessagePriority::HIGH); - break; - default: - LogError("Wrong priority type"); - ThrowMsg(Commons::PlatformException, "Wrong priority type"); - } -} - -void Mms::readRecipientList(msg_message_t& messageData) -{ - std::string phoneNumber; - int recipientCount = msg_get_address_count(messageData); - LogDebug("Recipient count " << recipientCount); - for (int i = 0; i < recipientCount; ++i) { - int type = msg_get_direction_info(messageData); - - if (MSG_DIRECTION_TYPE_MT == type) { - phoneNumber = msg_get_ith_address(messageData, i); - if (validatePhoneNumber(phoneNumber)) { - setSourceAddress(phoneNumber); - setFrom(phoneNumber); - } - LogDebug("phone number: " << phoneNumber); - } else if (MSG_DIRECTION_TYPE_MO == type) { - switch (msg_get_ith_recipient_type(messageData, i)) { - case MSG_RECIPIENTS_TYPE_TO: - appendToRecipients(msg_get_ith_address(messageData, i)); - break; - case MSG_RECIPIENTS_TYPE_CC: - appendCcRecipients(msg_get_ith_address(messageData, i)); - break; - case MSG_RECIPIENTS_TYPE_BCC: - appendBccRecipients(msg_get_ith_address(messageData, i)); - break; - default: - LogError("Wrong type of recipient"); - ThrowMsg(Commons::PlatformException, "Wrong type of recipient"); - } - } else { - LogError("Wrong type of recipient"); - ThrowMsg(Commons::PlatformException, "Wrong type of recipient"); - } - } -} - -void Mms::readSubject(msg_message_t& messageData) -{ - setSubject(msg_get_subject(messageData)); -} - -void Mms::readBodyAndAttachments(msg_message_t& messageData) -{ - //TODO - MMS_MESSAGE_DATA_S msgBody; - memset(&msgBody, 0, sizeof(MMS_MESSAGE_DATA_S)); - msg_mms_get_message_body(messageData, &msgBody); - - //if any page then multipart is related type - if (msgBody.pageCnt > 0) { - setMmsType(MULTIPART_RELATED); - } else { - setMmsType(MULTIPART_MIXED); - } - - LogDebug("page count: " << msgBody.pageCnt); - - for (int p = 0; p < msgBody.pageCnt; ++p) { - LogDebug("page " << p); - MMS_PAGE_S *page = msg_mms_get_page(p); - if (!page) { - LogError("returned page is null, continue"); - continue; - } - for (int m = 0; m < page->mediaCnt; ++m) { - LogDebug("media file " << m); - MMS_MEDIA_S* media = msg_mms_get_media(page, m); - if (!media) { - LogError("returned media is null, continue"); - continue; - } - if (0 == p && MMS_SMIL_MEDIA_TEXT == media->mediatype) { - //text value on first page goes to body attribute - LogDebug("setting body from " << media->szFilePath); - FILE* f = NULL; - f = fopen(media->szFilePath, "r"); - if (!f) { - LogError("cannot read file with body" << media->szFilePath); - ThrowMsg(Commons::PlatformException, - "Cannot read file with body"); - } - fseek(f, 0, SEEK_END); - long int size = ftell(f); - fseek(f, 0, SEEK_SET); - char* data = new (nothrow) char[size + 1]; - if (data) { - memset(data, 0, size + 1); - fread(data, 1, size, f); - setBody(data); - delete[] data; - } else { - LogError("body is not set"); - } - LogDebug("message body: '" << getBody() << "'"); - fclose(f); - } else { - LogDebug("adding attachment " << media->szFilePath); - IAttachmentPtr attachment = appendAttachment(media->szFilePath, - false); - if (NULL != media->szFileName && - strnlen(media->szFileName, MSG_FILENAME_LEN_MAX) > 0) { - LogDebug("renaming to " << media->szFileName); - attachment->rename(media->szFileName); - } else if (MMS_SMIL_MEDIA_TEXT == media->mediatype) { - std::stringstream newName; - newName << "body_page_" << p + 1 << ".txt"; - LogDebug("renaming to " << newName.str()); - attachment->rename(newName.str()); - } - } - } - } - - LogDebug("attachment count: " << msgBody.attachCnt); - for (int a = 0; a < msgBody.attachCnt; ++a) { - MMS_ATTACH_S* attachment = msg_mms_get_attachment(a); - if (!attachment) { - LogError("attachment is null, continue"); - continue; - } - IAttachmentPtr att = appendAttachment(attachment->szFilePath, false); - if (NULL != attachment->szFileName && - strnlen(attachment->szFileName, MSG_FILENAME_LEN_MAX) > 0) { - LogDebug("renaming to " << attachment->szFileName); - att->rename(attachment->szFileName); - } - } -} - -void Mms::update(bool draftsOnly) -{ - LogDebug("updating m_id=" << getIdRef()); - - if (!m_messageData) { - //error if platform message not exists - LogError("message can not be updated"); - Throw(Commons::PlatformException); - } - - //update mms data from abstraction - if (!draftsOnly || getCurrentFolder() == Api::DRAFTBOX) { - updateSubject(); - updateBodyAndAttachments(); - updateRecipientList(); - updatePriority(); - } - updateReadStatus(); -} - -void Mms::updatePriority() -{ - if (isPriorityValid()) { - return; - } - int priority = -1; - LogInfo("MMS updating priority"); - - //set priority in platform - switch (getPriority()) { - case MessagePriority::LOW: - priority = MSG_MESSAGE_PRIORITY_LOW; - break; - case MessagePriority::NORMAL: - priority = MSG_MESSAGE_PRIORITY_NORMAL; - break; - case MessagePriority::HIGH: - priority = MSG_MESSAGE_PRIORITY_HIGH; - break; - default: - LogError("Wrong priority"); - Throw(Commons::PlatformException); - } - if (MSG_SUCCESS != - msg_set_priority_info(m_messageData, MSG_MESSAGE_PRIORITY_LOW)) { - LogError("Error during setting priority"); - Throw(Commons::PlatformException); - } -} - -void Mms::updateRecipientList() -{ - // check if abstraction recipient value has been changed - if (getToRecipients().isValid() && - getBccRecipients().isValid() && - getCcRecipients().isValid()) { - return; - } - - LogInfo("MMS updating platform recipients"); - - // reset addresses in platform structure - msg_reset_address(m_messageData); - - vector to = getToRecipients().getRecipients(); - vector cc = getCcRecipients().getRecipients(); - vector bcc = getBccRecipients().getRecipients(); - - // update addresses in platform structure - if (to.size()) { - LogInfo("updating to"); - for (size_t i = 0; i < to.size(); i++) { - if (msg_get_address_count(m_messageData) >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); - break; - } - LogDebug("adding to[" << i << "]=" << to[i]); - if (msg_add_address(m_messageData, to[i].c_str(), - MSG_RECIPIENTS_TYPE_TO) != MSG_SUCCESS) { - LogError("problem with adding to address"); - ThrowMsg(Commons::PlatformException, - "Problem with adding to address"); - } - } - } - - if (cc.size()) { - LogInfo("updating cc"); - for (size_t i = 0; i < cc.size(); i++) { - if (msg_get_address_count(m_messageData) >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); - break; - } - LogDebug("adding cc[" << i << "]=" << cc[i]); - if (msg_add_address(m_messageData, cc[i].c_str(), - MSG_RECIPIENTS_TYPE_CC) != MSG_SUCCESS) { - LogError("problem with adding cc address"); - ThrowMsg(Commons::PlatformException, - "Problem with adding cc address"); - } - } - } - - if (bcc.size()) { - LogInfo("updating bcc"); - for (size_t i = 0; i < bcc.size(); i++) { - if (msg_get_address_count(m_messageData) >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); - break; - } - LogDebug("adding bcc[" << i << "]=" << bcc[i]); - if (msg_add_address(m_messageData, bcc[i].c_str(), - MSG_RECIPIENTS_TYPE_BCC) != MSG_SUCCESS) { - LogError("problem with adding bcc address"); - ThrowMsg(Commons::PlatformException, - "Problem with adding bcc address"); - } - } - } - - setToValidity(true); - setCcValidity(true); - setBccValidity(true); -} - -void Mms::updateSubject() -{ - // check if abstraction subject value has been changed - if (isSubjectValid()) { - return; - } - LogInfo("updating platform subject: " << getSubjectRef()); - if (MSG_SUCCESS != - msg_set_subject(m_messageData, getSubjectRef().c_str())) { - LogError("problem with setting subject"); - ThrowMsg(Commons::PlatformException, "Problem with setting subject"); - } - setSubjectValidity(true); -} - -void Mms::updateBodyAndAttachments() -{ - // check if attachment or body source address value has been changed - if (isAttachmentsValid() && isBodyValid()) { - return; - } - MMS_MESSAGE_DATA_S *mmsData = NULL; - LogInfo("updating platform body and attachment"); - - Try - { - if (getMessageType() != MMS) { - LogError("Wrong msg type"); - ThrowMsg(Commons::PlatformException, "Wrong msg type"); - } - mmsData = msg_mms_create_message(); - if (!mmsData) { - LogError("create message body failed"); - ThrowMsg(Commons::PlatformException, "create message body failed"); - } - - //body - if (!getBodyRef().empty()) { - FILE* f = NULL; - f = fopen(m_bodyFilePath.c_str(), "w"); - if (!f) { - LogError("cannot create file with body" << m_bodyFilePath); - ThrowMsg(Commons::PlatformException, - "cannot create file with body"); - } - LogDebug("body file: " << m_bodyFilePath); - fprintf(f, getBodyRef().c_str()); - fclose(f); - if (!msg_mms_set_rootlayout(mmsData, ROOT_LAYOUT_WIDTH, - ROOT_LAYOUT_HEIGHT, WHITE_COLOR)) { - LogError("cannot create root layout"); - ThrowMsg(Commons::PlatformException, - "cannot create root layout"); - } - if (!msg_mms_add_region(mmsData, TEXT_AREA, 0, 0, ROOT_LAYOUT_WIDTH, - ROOT_LAYOUT_HEIGHT, WHITE_COLOR)) { - LogError("cannot create region"); - ThrowMsg(Commons::PlatformException, "cannot create region"); - } - MMS_PAGE_S* page = msg_mms_add_page(mmsData, 0); - if (!page) { - LogError("cannot create page"); - ThrowMsg(Commons::PlatformException, "cannot create page"); - } - MMS_MEDIA_S* media = msg_mms_add_media(page, - MMS_SMIL_MEDIA_TEXT, - TEXT_AREA, - const_cast( - m_bodyFilePath.c_str())); - if (!media) { - LogError("cannot create media"); - ThrowMsg(Commons::PlatformException, "cannot create media"); - } - media->sMedia.sText.nColor = BLACK_COLOR; - media->sMedia.sText.nSize = MMS_SMIL_FONT_SIZE_NORMAL; - } - - //attachments - struct stat buffer; - int errnum = 0; - for (size_t i = 0; i < getAttachmentsRef().size(); ++i) { - Api::IAttachmentPtr att = getAttachment(i); - if (!att) { - continue; - } - - LogDebug("Add attachment=" << att->getFullPath()); - //checking file - errnum = stat(att->getFullPath().c_str(), &buffer); - if (errnum) { - LogError("Opening file: " << - att->getFullPath().c_str() << - " " << strerror(errnum)); - ThrowMsg(Commons::PlatformException, - "cannot open attachment file"); - } - - //this function should return valid pointer - if (!msg_mms_add_attachment(mmsData, - const_cast(att->getFullPath(). - c_str()))) { - LogError("add attachment failed"); - ThrowMsg(Commons::PlatformException, "add attachment failed"); - } - LogDebug("Attachment added"); - - //reset errno - errnum = 0; - } - - if (MSG_SUCCESS != msg_mms_set_message_body(m_messageData, mmsData)) { - LogError("set message body error"); - ThrowMsg(Commons::PlatformException, "set message body error"); - } - - msg_mms_destroy_message(mmsData); - setAttachmentsValidity(true); - setBodyValidity(true); - } - - Catch(Commons::PlatformException) { - LogError("Platform error"); - if (mmsData) { - msg_mms_destroy_message(mmsData); - } - throw; - } -} - -void Mms::updateReadStatus() -{ - if (isReadStatusValid()) { - return; - } - - LogInfo("updating platform read status: " << isRead()); - if (MSG_SUCCESS != msg_set_read_status(m_messageData, isRead())) { - LogError("problem with setting subject"); - ThrowMsg(Commons::PlatformException, "Problem with setting subject"); - } - - setReadStatusValidity(true); -} - -void Mms::readAllData() -{ - readExistingMessage(); -} - -void Mms::moveToFolder(const FolderType newFolder) -{ - update(); - - Try - { - MSG_FOLDER_ID_T platfromFolderId = Messaging::convertFolderToPlatform( - newFolder); - - if (msg_move_msg_to_folder(MsgGetCommonHandle(), convertId(getId()), - platfromFolderId) != MSG_SUCCESS) { - ThrowMsg(Commons::PlatformException, "Error during movinf message"); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - throw; - } -} - -void Mms::moveToFolder(const string& newFolder) -{ - update(); - - Try - { - MSG_FOLDER_ID_T platfromFolderId = Messaging::convertFolderToPlatform( - newFolder); - - if (msg_move_msg_to_folder(MsgGetCommonHandle(), convertId(getId()), - platfromFolderId) != MSG_SUCCESS) { - LogError("msg_move_msg_to_folder error"); - ThrowMsg(Commons::PlatformException, "msg_move_msg_to_folder error"); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - throw; - } -} - -void Mms::copyToFolder(const FolderType newFolder) -{ - update(); - - msg_message_t msg = msg_new_message(); - - Try - { - MSG_SENDINGOPT_S option; - memset(&option, 0, sizeof(MSG_SENDINGOPT_S)); - option.option.smsSendOpt.bReplyPath = true; - if (MSG_SUCCESS == - msg_get_message(MsgGetCommonHandle(), convertId(getIdRef()), msg, - &option)) { - const MSG_FOLDER_ID_T platfromFolderId = - Messaging::convertFolderToPlatform(newFolder); - msg_set_message_id(msg, 0); - msg_set_folder_id(msg, platfromFolderId); - - int error = msg_add_message(MsgGetCommonHandle(), msg, &option); - if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); - ThrowMsg(Commons::PlatformException, "msg_add_message failed"); - } - } - if (msg) { - msg_release_message(&msg); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - if (msg) { - msg_release_message(&msg); - } - throw; - } -} - -void Mms::copyToFolder(const string& newFolder) -{ - update(); - - msg_message_t msg = msg_new_message(); - - Try - { - MSG_SENDINGOPT_S option; - memset(&option, 0, sizeof(MSG_SENDINGOPT_S)); - option.option.smsSendOpt.bReplyPath = true; - if (MSG_SUCCESS == - msg_get_message(MsgGetCommonHandle(), convertId(getIdRef()), msg, - &option)) { - const MSG_FOLDER_ID_T platfromFolderId = - Messaging::convertFolderToPlatform(newFolder); - msg_set_message_id(msg, 0); - msg_set_folder_id(msg, platfromFolderId); - - int error = msg_add_message(MsgGetCommonHandle(), msg, &option); - if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); - ThrowMsg(Commons::PlatformException, "msg_add_message failed"); - } - } - if (msg) { - msg_release_message(&msg); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - if (msg) { - msg_release_message(&msg); - } - throw; - } -} - -void Mms::remove() -{ - LogDebug("delete m_id=" << getIdRef()); - - Try - { - if (this->getIdRef().empty()) { - LogError("existing msgId is zero, remove msg not done"); - ThrowMsg(Commons::PlatformException, - "existing msgId is zero, remove msg not done"); - } - - if (MSG_SUCCESS != - msg_delete_message(MsgGetCommonHandle(), - convertId(getIdRef()))) { - LogError("Failed to delete Message"); - ThrowMsg(Commons::PlatformException, "Failed to delete Message"); - } - } - - Catch(Commons::PlatformException) { - LogError("platform error occurs"); - } -} - -void Mms::send() -{ - LogDebug("sending message, id=" << getIdRef()); - Try - { - //prepare for sending sms/mms - update(); - - LogDebug("Start Sending Message..."); - LogDebug("msgId=" << msg_get_message_id(m_messageData)); - LogDebug("subject: " << msg_get_subject(m_messageData)); - LogDebug("recipient count: " << msg_get_address_count(m_messageData)); - for (int i = 0; i < msg_get_address_count(m_messageData); ++i) { - LogDebug("recipient[" << i << "]: " << - msg_get_ith_address(m_messageData, i)); - } - - LogDebug("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); - setSendingStatusFailed(); - return; - } - - LogDebug("Sending Message request is submitted!"); - } - Catch(Commons::PlatformException) { - LogError("message is not send, manually run callback"); - setSendingStatusFailed(); - } -} - -void Mms::sendingCallback(MSG_SENT_STATUS_S *sent_status) -{ - LogInfo( - "sendingCallback callback received. Req id = " << - sent_status->reqId << " Status = " << (int)sent_status->status); - if (MSG_NETWORK_SEND_SUCCESS == sent_status->status) { - LogDebug("sending ok"); - setSendingStatusOk(); - } else { - LogError("sending failed: " << - static_cast(sent_status->status)); - setSendingStatusFailed(); - } -} - -void Mms::sendCancel() -{ - LogDebug("sending message, id=" << getIdRef()); - //#warning "TODO" -} - -void Mms::setSendingStatusOk() -{ - ReqReceiverMessage *requestReceiver = getRequestReceiver(); - if (requestReceiver) - { - LogInfo("calling JS success callback"); - EventSendMessagePtr event = getSendMessageEvent(); - event->addRecipientsSendResult(getToRecipientsPtr()->getRecipientsRef(), - true); - event->setExceptionCode(Commons::ExceptionCodes::None); - requestReceiver->Commons::EventRequestReceiver:: - ManualAnswer(event); - } -} - -void Mms::setSendingStatusFailed() -{ - EventOnSendingFailedEmitterPtr emitter = getEmitter(); - if (emitter) - { - EventOnSendingFailedPtr event(new EventOnSendingFailed); - event->setError(EventOnSendingFailed::UNKNOWN); // TODO error codes - emitter->emit(event); - } - else - { - ReqReceiverMessage *requestReceiver = getRequestReceiver(); - if (requestReceiver) - { - LogError("calling JS error callback"); - EventSendMessagePtr event = getSendMessageEvent(); - event->addRecipientsSendResult( - getToRecipientsPtr()->getRecipientsRef(), - false); - event->setExceptionCode(Commons::ExceptionCodes::UnknownException); - requestReceiver->Commons::EventRequestReceiver - ::ManualAnswer(event); - } - } -} - -Api::FolderType Mms::toFolder(const std::string &folder) -{ - if (folder == "INBOX") { - return INBOX; - } else if (folder == "OUTBOX") { - return OUTBOX; - } else if (folder == "SENTBOX") { - return SENTBOX; - } else if (folder == "DRAFTBOX") { - return DRAFTBOX; - } - ThrowMsg(Commons::PlatformException, "Invalid folder"); -} -} -} diff --git a/src/modules/tizen/Messaging/Mms.h b/src/modules/tizen/Messaging/Mms.h deleted file mode 100644 index 4493c71..0000000 --- a/src/modules/tizen/Messaging/Mms.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Mms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef MMS_H -#define MMS_H - -#include -#include -#include "MmsSlide.h" -#include "ISendingObserver.h" - -extern "C" { -#include -#include -} - -namespace WrtDeviceApis { -namespace Messaging { -class Mms : public Api::IMms, - public ISendingObserver, - public Api::MmsSlides -{ - public: - explicit Mms(const std::string& id = ""); - - ~Mms(); - - // implementation of interface of IMessage class - virtual void update(bool draftsOnly = false); - - virtual void readAllData(); - - virtual void moveToFolder(const Api::FolderType newFolder); - - virtual void moveToFolder(const std::string& newFolder); - - virtual void copyToFolder(const Api::FolderType newFolder); - - virtual void copyToFolder(const std::string& newFolder); - - virtual void remove(); - - virtual void send(); - - virtual void sendingCallback(MSG_SENT_STATUS_S *sent_status); - - virtual void sendCancel(); - - void setSendingStatusOk(); - - void setSendingStatusFailed(); - - static Api::FolderType toFolder(const std::string &folder); - - private: - - void updatePriority(); - - void updateRecipientList(); - - void updateSubject(); - - void updateBodyAndAttachments(); - - void updateReadStatus(); - - void readPriority(msg_message_t& messageData); - - void readRecipientList(msg_message_t& messageData); - - void readSubject(msg_message_t& messageData); - - void readBodyAndAttachments(msg_message_t& messageData); - - void readFolder(msg_message_t& messageData); - - void readDateTime(msg_message_t& messageData); - - void readReadStatus(msg_message_t& messageData); - - void createNewMessage(); - - void readExistingMessage(); - - private: - - std::string m_bodyFilePath; - - msg_message_t m_messageData; -}; - -typedef DPL::SharedPtr MmsPtr; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/MmsSlide.cpp b/src/modules/tizen/Messaging/MmsSlide.cpp deleted file mode 100644 index da127ca..0000000 --- a/src/modules/tizen/Messaging/MmsSlide.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MmsSlide.cpp - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ diff --git a/src/modules/tizen/Messaging/MmsSlide.h b/src/modules/tizen/Messaging/MmsSlide.h deleted file mode 100644 index 7939be9..0000000 --- a/src/modules/tizen/Messaging/MmsSlide.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file MmsSlide.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WAC_MMS_SLIDE_H -#define WAC_MMS_SLIDE_H - -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -class MmsSlide : - public virtual Api::IMmsSlide, - public Api::MmsSlide -{ -}; -} -} -#endif - diff --git a/src/modules/tizen/Messaging/MsgServiceHandleMgr.cpp b/src/modules/tizen/Messaging/MsgServiceHandleMgr.cpp deleted file mode 100644 index 7621393..0000000 --- a/src/modules/tizen/Messaging/MsgServiceHandleMgr.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * @file MsgServiceHandleMgr.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 0.1 - * @brief - */ - -#include "MsgServiceHandleMgr.h" -#include - -IMPLEMENT_SINGLETON(WrtDeviceApis::Messaging::MsgServiceHandle) diff --git a/src/modules/tizen/Messaging/MsgServiceHandleMgr.h b/src/modules/tizen/Messaging/MsgServiceHandleMgr.h deleted file mode 100644 index 27d03bf..0000000 --- a/src/modules/tizen/Messaging/MsgServiceHandleMgr.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file CallbackMgr.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef MSGSERVICEHANDLEMGR_H -#define MSGSERVICEHANDLEMGR_H - -#include -#include -#include -#include -#include - -extern "C" { -#include -} - -namespace WrtDeviceApis { -namespace Messaging { -/* - * Class used for msg service handle manager - */ -class MsgServiceHandleMgr -{ - public: - MsgServiceHandleMgr() : m_msgHandle(NULL) - { - LogInfo("enter"); - // open one handle per all messaging - if (MSG_SUCCESS != msg_open_msg_handle(&m_msgHandle)) { - LogError("Unable to open handle"); - Throw(Commons::PlatformException); - } - } - - public: - ~MsgServiceHandleMgr() - { - LogInfo("enter"); - if (!!m_msgHandle) { - msg_close_msg_handle(&m_msgHandle); - } - } - - MSG_HANDLE_T getHandle() const - { - if (!m_msgHandle) { - LogError("Messaging handle not initialized"); - Throw(Commons::PlatformException); - } - return m_msgHandle; - } - - private: - MSG_HANDLE_T m_msgHandle; -}; - -typedef DPL::SharedPtr MsgServiceHandleMgrPtr; -typedef DPL::ThreadLocalVariable TlvMsgServiceHandleMgr; - -class MsgServiceHandle -{ - protected: - MsgServiceHandle() - { - } - - public: - ~MsgServiceHandle() - { - } - - MSG_HANDLE_T getHandle() - { - if (m_tlvHandleMgr.IsNull()) { - m_tlvHandleMgr = MsgServiceHandleMgrPtr(new MsgServiceHandleMgr()); - } - return (*m_tlvHandleMgr)->getHandle(); - } - - private: - TlvMsgServiceHandleMgr m_tlvHandleMgr; -}; - -typedef DPL::Singleton MsgServiceHandleSingleton; - -#define MsgGetCommonHandle() MsgServiceHandleSingleton::Instance().getHandle() -} -} - -#endif /* MSGSERVICEHANDLEMGR_H */ - diff --git a/src/modules/tizen/Messaging/NetworkStatus.cpp b/src/modules/tizen/Messaging/NetworkStatus.cpp deleted file mode 100644 index ad16674..0000000 --- a/src/modules/tizen/Messaging/NetworkStatus.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include -#include -#include "NetworkStatus.h" - -namespace { -const char* DBUS_INTERFACE_NETWORK_STATUS = "User.Email.NetworkStatus"; -const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5; -} - -namespace WrtDeviceApis { -namespace Messaging { -NetworkStatus::NetworkStatus(const DBus::MessagePtr& message) -{ - Assert(message->getInterface() == DBUS_INTERFACE_NETWORK_STATUS); - initialize(message); -} - -int NetworkStatus::getStatus() const -{ - return m_status; -} - -int NetworkStatus::getAccountId() const -{ - return m_accountId; -} - -std::string NetworkStatus::getSource() const -{ - return m_source; -} - -int NetworkStatus::getMailId() const -{ - return m_mailId; -} - -int NetworkStatus::getErrorCode() const -{ - return m_errorCode; -} - -void NetworkStatus::initialize(const DBus::MessagePtr& message) -{ - DBus::Message::ReadIterator it = message->getReadIterator(); - for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) { - if (!it->isValid()) { - ThrowMsg(Commons::PlatformException, "Missing some properties."); - } - - switch (i) { - case 0: m_status = it->getInt(); - break; - case 1: m_accountId = it->getInt(); - break; - case 2: m_source = it->getString(); - break; - case 3: m_mailId = it->getInt(); - break; - case 4: m_errorCode = it->getInt(); - break; - } - } -} -} -} diff --git a/src/modules/tizen/Messaging/NetworkStatus.h b/src/modules/tizen/Messaging/NetworkStatus.h deleted file mode 100644 index fbfc34f..0000000 --- a/src/modules/tizen/Messaging/NetworkStatus.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef NETWORKSTATUS_H_ -#define NETWORKSTATUS_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -class NetworkStatus : private DPL::Noncopyable -{ - public: - explicit NetworkStatus(const DBus::MessagePtr& message); - - int getStatus() const; - int getAccountId() const; - std::string getSource() const; - int getMailId() const; - int getErrorCode() const; - - private: - void initialize(const DBus::MessagePtr& message); - - private: - int m_status; - int m_accountId; - /* - * Not sure what it stores. According to source code of Email application - * it can contain string "ACTIVESYNC" or name of the file which stores body. - */ - std::string m_source; - int m_mailId; - int m_errorCode; -}; - -typedef DPL::SharedPtr NetworkStatusPtr; -} -} - -#endif // NETWORKSTATUS_H_ diff --git a/src/modules/tizen/Messaging/ScopedMail.h b/src/modules/tizen/Messaging/ScopedMail.h deleted file mode 100644 index ed7a1c5..0000000 --- a/src/modules/tizen/Messaging/ScopedMail.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WAC_MESSAGING_SCOPEDMAIL_H_ -#define WAC_MESSAGING_SCOPEDMAIL_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -struct ScopedMailPolicy -{ - typedef emf_mail_t* Type; - - static Type NullValue() - { - return NULL; - } - - static void Destroy(Type mail) - { - if (NullValue() != mail) { - int error = email_free_mail(&mail, 1); - if (EMF_ERROR_NONE != error) { - LogError("Failed to destroy mail: " << error); - } - } - } -}; - -typedef DPL::ScopedPtr ScopedMail; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/ScopedMailbox.h b/src/modules/tizen/Messaging/ScopedMailbox.h deleted file mode 100644 index 17dd6a4..0000000 --- a/src/modules/tizen/Messaging/ScopedMailbox.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WAC_MESSAGING_SCOPEDMAILBOX_H_ -#define WAC_MESSAGING_SCOPEDMAILBOX_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { -struct ScopedMailboxPolicy -{ - typedef emf_mailbox_t* Type; - - static Type NullValue() - { - return NULL; - } - - static void Destroy(Type mailbox) - { - if (NullValue() != mailbox) { - int error = email_free_mailbox(&mailbox, 1); - if (EMF_ERROR_NONE != error) { - LogError("Failed to destroy mailbox: " << error); - } - } - } -}; - -typedef DPL::ScopedPtr ScopedMailbox; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/Sms.cpp b/src/modules/tizen/Messaging/Sms.cpp deleted file mode 100644 index a297056..0000000 --- a/src/modules/tizen/Messaging/Sms.cpp +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Sms.cpp - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#include "Sms.h" -#include -#include -#include -#include "Messaging.h" -#include "CallbackMgr.h" -#include "MsgServiceHandleMgr.h" - -extern "C" { -#include -#include -} - -using namespace std; -using namespace WrtDeviceApis::Messaging; -using namespace WrtDeviceApis::Messaging::Api; - -namespace { -const char* EMPTY_ID = "0"; -} - -namespace WrtDeviceApis { -namespace Messaging { -Sms::Sms(const string& id) : - IMessage(SMS, id), - m_messageData(NULL) -{ - LogDebug("enter"); - LogDebug("m_id=" << getIdRef()); - LogDebug("m_msgType=" << getMessageType()); - - if (getIdRef().empty()) { - createNewMessage(); - } else { - readExistingMessage(); - } - - Touch(); -} - -Sms::~Sms() -{ - LogDebug("enter"); - - if (m_messageData) { - // release platform message structure - msg_release_message(&m_messageData); - } -} - -void Sms::update(bool draftsOnly) -{ - LogDebug("updating m_id=" << getIdRef()); - - if (!m_messageData) { - //error if platform message not exists - LogError("message can not be updated"); - Throw(Commons::PlatformException); - } - - //update all sms data - if (!draftsOnly || getCurrentFolder() == Api::DRAFTBOX) { - updateBody(); - updateFrom(); - updateTo(); - updateSourceAddress(); - } - updateReadStatus(); -} - -void Sms::readAllData() -{ - readExistingMessage(); -} - -void Sms::moveToFolder(const FolderType newFolder) -{ - update(); - - Try - { - const MSG_FOLDER_ID_T platfromFolderId = - Messaging::convertFolderToPlatform(newFolder); - - //call platform api to move message to other folder - if (msg_move_msg_to_folder(MsgGetCommonHandle(), convertId(getId()), - platfromFolderId) != MSG_SUCCESS) { - Throw(Commons::PlatformException); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - throw; - } -} - -void Sms::moveToFolder(const std::string& /*newFolder*/) -{ - update(); - //TODO -} - -void Sms::copyToFolder(const FolderType newFolder) -{ - update(); - - msg_message_t msg = msg_new_message(); - - Try - { - MSG_SENDINGOPT_S option; - memset(&option, 0, sizeof(MSG_SENDINGOPT_S)); - option.option.smsSendOpt.bReplyPath = true; - // trying to get message from platform - if (MSG_SUCCESS == - msg_get_message(MsgGetCommonHandle(), convertId(getIdRef()), msg, - &option)) - { - const MSG_FOLDER_ID_T platfromFolderId = - Messaging::convertFolderToPlatform(newFolder); - // new id will me set (initialize to 0) - msg_set_message_id(msg, 0); - msg_set_folder_id(msg, platfromFolderId); - - // trying to add message - int error = msg_add_message(MsgGetCommonHandle(), msg, &option); - if (error != MSG_SUCCESS) { - LogError("msg_add_message failed, error code=" << error); - Throw(Commons::PlatformException); - } - - //releasing platform message structure - msg_release_message(&msg); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - if (msg) { - //releasing platform message structure - msg_release_message(&msg); - } - throw; - } -} - -void Sms::copyToFolder(const std::string& /*newFolder*/) -{ - update(); - //TODO -} - -void Sms::send() -{ - LogDebug("sending message, id=" << getIdRef()); - - //prepare for sending sms - update(); - - // split the message - LogDebug("Start Sending Message..."); - LogDebug("msgId=" << msg_get_message_id(m_messageData)); - LogDebug("subject: " << msg_get_subject(m_messageData)); - LogDebug("recipient count: " << msg_get_address_count(m_messageData)); - - SendRequest req; - - for (int i = 0; i < msg_get_address_count(m_messageData); ++i) { - if (MSG_RECIPIENTS_TYPE_TO != - msg_get_ith_recipient_type(m_messageData, i)) - { - continue; - } - msg_message_t msg = createNewCopyOfPLatformMsg(m_messageData); - - // remove all addresses except ith - msg_reset_address(msg); - const char* to = msg_get_ith_address(m_messageData, i); - msg_add_address(msg, to, MSG_RECIPIENTS_TYPE_TO); - - LogDebug("recipient: " << msg_get_ith_address(msg, 0)); - LogDebug("body: " << msg_sms_get_message_body(msg)); - - req.queue.push(msg); - } - - DPL::Mutex::ScopedLock lock(&m_mutex); - m_sendRequests.push(req); - - // schedule sending - PostEvent(0); - - LogDebug("sending method finished"); -} - -void Sms::sendingCallback(MSG_SENT_STATUS_S *sent_status) -{ - LogInfo( - "sendingCallback callback received. Req id = " << - sent_status->reqId << " Status = " << (int)sent_status->status << - ", Recipient=" << getRecipient()); - - DPL::Mutex::ScopedLock lock(&m_mutex); - if (sent_status->status != MSG_NETWORK_SEND_SUCCESS) - { - m_sendRequests.front().failed = true; // TODO mutex - //send callback, error for recipient - setSendingStatusFailed(); - } - else - { - setSendingStatusOk(); - } - msg_release_message(¤tQueue().front()); - currentQueue().pop(); - - //schedule another sub message send - PostEvent(0); -} - -void Sms::OnEventReceived(const int&) -{ - LogDebug("enter"); - // send another one - sendSubMessage(); -} - -Api::FolderType Sms::toFolder(const std::string &folder) -{ - if (folder == "INBOX") { - return INBOX; - } else if (folder == "OUTBOX") { - return OUTBOX; - } else if (folder == "SENTBOX") { - return SENTBOX; - } else if (folder == "DRAFTBOX") { - return DRAFTBOX; - } - ThrowMsg(Commons::PlatformException, "Invalid folder"); -} - -void Sms::sendSubMessage() -{ - LogDebug("enter"); - - DPL::Mutex::ScopedLock lock(&m_mutex); - - // if current request queue gets empty, try next one - while (!m_sendRequests.empty()) { - // send as long as the sending fails until there are no more messages - for (MSG_ERROR_T err = MSG_ERR_UNKNOWN; - err != MSG_SUCCESS && !currentQueue().empty();) - { - err = CallbackMgrSingleton::Instance().registerAndSend( - msg_sms_send_message, - currentQueue().front(), - this); - LogInfo("Sending Message (submit request) result:" << err); - if (err != MSG_SUCCESS) { - LogError( - "Sending Message (submit request) failed!!! err=" << err); - msg_release_message(¤tQueue().front()); - currentQueue().pop(); - m_sendRequests.front().failed = true; - //send callback, error for recipient - setSendingStatusFailed(); - } - } - - // empty queue -> notify about results - if (currentQueue().empty()) { - auto event = getSendMessageEvent(); - if (m_sendRequests.front().failed) - { - event->setExceptionCode( - Commons::ExceptionCodes::UnknownException); - } - - ReqReceiverMessage *requestReceiver = getRequestReceiver(); - if (requestReceiver) - { - requestReceiver-> - Commons::EventRequestReceiver:: - ManualAnswer(event); - } - - // this request is finished, try next one - m_sendRequests.pop(); - continue; - } - break; - } -} - -void Sms::setSendingStatusOk() -{ - LogDebug("enter"); - //success callback should be executed here - ReqReceiverMessage *requestReceiver = getRequestReceiver(); - if (requestReceiver) { - LogInfo("calling JS success callback"); - EventSendMessagePtr event = getSendMessageEvent(); - event->addRecipientSendResult(getRecipient(), true); - } -} - -void Sms::setSendingStatusFailed() -{ - LogDebug("enter"); - //error callback should be executed here - EventOnSendingFailedEmitterPtr emitter = getEmitter(); - if (emitter) { - EventOnSendingFailedPtr event(new EventOnSendingFailed); - event->setError(EventOnSendingFailed::UNKNOWN); // TODO error codes - emitter->emit(event); - } else { - ReqReceiverMessage *requestReceiver = getRequestReceiver(); - if (requestReceiver) { - LogError("calling JS error callback"); - EventSendMessagePtr event = getSendMessageEvent(); - event->addRecipientSendResult(getRecipient(), false); - } - } -} - -void Sms::remove() -{ - Try - { - // delete message from platform - if (msg_delete_message(MsgGetCommonHandle(), - convertId(getId())) != MSG_SUCCESS) - { - LogError("delete message failed"); - Throw(Commons::PlatformException); - } else { - LogDebug("message deleted succesfully"); - } - } - - Catch(Commons::PlatformException) { - LogError("remove message error"); - throw; - } -} - -void Sms::createNewMessage() -{ - if (m_messageData) { - // release platform message if it was created previously - msg_release_message(&m_messageData); - m_messageData = NULL; - } - // create new platform message - m_messageData = msg_new_message(); - Try - { - MSG_SENDINGOPT_S option; - memset(&option, 0, sizeof(MSG_SENDINGOPT_S)); - option.option.smsSendOpt.bReplyPath = true; - - //default message initialization - msg_set_message_id(m_messageData, 0); // It should be set 0 - msg_set_folder_id(m_messageData, MSG_DRAFT_ID); - msg_set_message_type(m_messageData, MSG_TYPE_SMS); - msg_set_storage_id(m_messageData, MSG_STORAGE_PHONE); - msg_set_network_status(m_messageData, MSG_NETWORK_NOT_SEND); - - // update sms data - updateBody(); - updateTo(); - - tm dateT = getDateTime(); - msg_set_time(m_messageData, mktime(&dateT)); - - LogDebug("Message created successfully, msgId=" << getId()); - } - - Catch(Commons::PlatformException) { - LogError("Problem with message creation, cleaning"); - } -} - -void Sms::readExistingMessage() -{ - if (getIdRef().empty() || (EMPTY_ID == getIdRef())) { - ThrowMsg(Commons::PlatformException, "Empty id."); - } - - Try { - MSG_SENDINGOPT_S option; - memset(&option, 0, sizeof(MSG_SENDINGOPT_S)); - option.option.smsSendOpt.bReplyPath = true; - - // release old data - msg_release_message(&m_messageData); - m_messageData = NULL; - // create new platform structure - m_messageData = msg_new_message(); - - MSG_MESSAGE_ID_T l_id = convertId(getIdRef()); - LogDebug("reading message id=" << l_id); - // trying to get message from platform - if (MSG_SUCCESS == - msg_get_message(MsgGetCommonHandle(), l_id, m_messageData, - &option)) - { - LogDebug("message found with msgId=" << getIdRef()); - - // read all mms dat to abstraction layer - readRecipientList(m_messageData); - readBody(m_messageData); - readFolder(m_messageData); - readDateTime(m_messageData); - readReadStatus(m_messageData); - readSize(m_messageData); - } else { - LogError("message not found with msgId=" << getIdRef()); - setId(""); - } - } - Catch(Commons::PlatformException) { - // nothing to do - } -} - -void Sms::updateBody() -{ - // check if abstraction body value has been changed - if (isBodyValid()) { - return; - } - LogInfo("updating platfoprm body"); - - // change body value in platform structure - msg_sms_set_message_body(m_messageData, getBodyRef().c_str(), - getBodyRef().length()); - - // set flag as true - platform synchronized with abstraction - setBodyValidity(true); -} - -void Sms::updateTo() -{ - // check if abstraction recipient (to) value has been changed - if (getToRecipients().isValid()) { - return; - } - LogInfo("updating platform to"); - - // change recipient value in platform structure - msg_reset_address(m_messageData); - vector to = getToRecipients().getRecipients(); - LogInfo("updating to"); - for (size_t i = 0; i < to.size(); i++) { - if (i >= MAX_TO_ADDRESS_CNT) { - LogError("max number of recipient exceeded"); - break; - } - LogDebug("adding to[" << i << "]=" << to[i]); - string tmpAddr = to[i]; - // function for validating phone number - if (validatePhoneNumber(tmpAddr)) { - // add phone number to platform message struncture - if (msg_add_address(m_messageData, tmpAddr.c_str(), - MSG_RECIPIENTS_TYPE_TO) != MSG_SUCCESS) - { - LogError("problem witgh add address"); - Throw(Commons::PlatformException); - } - } else { - //nothing to do if wrong format - LogError("wrong phone number format"); - } - } - - // set flag as true - platform synchronized with abstraction - setToValidity(true); -} - -void Sms::updateFrom() -{ - // check if abstraction from field value has been changed - if (getFromValidity()) { - // do not update if not changed - return; - } - LogInfo("updating platform from"); - - //TODO - - // set flag as true - platform synchronized with abstraction - setFromValidity(true); -} - -void Sms::updateSourceAddress() -{ - // check if abstraction source address value has been changed - if (getSourceAddressValidity()) { - // do not update if not changed - return; - } - LogInfo("updating platform source address"); - - //TODO - - // set flag as true - platform synchronized with abstraction - setSourceAddressValidity(true); -} - -void Sms::updateReadStatus() -{ - LogInfo("updating platform read status: " << isRead()); - if (isReadStatusValid()) { - // do not update if not changed - return; - } - - if (MSG_SUCCESS != msg_set_read_status(m_messageData, isRead())) { - LogError("problem with setting subject"); - ThrowMsg(Commons::PlatformException, "Problem with setting subject"); - } - setReadStatusValidity(true); -} - -void Sms::readRecipientList(msg_message_t& messageData) -{ - LogDebug("Adding recipients to message, count=" << - msg_get_address_count(messageData)); - // iterate for all address and store in abstraction - for (int i = 0; i < msg_get_address_count(messageData); i++) { - string tmp = msg_get_ith_address(messageData, i); - int type = msg_get_direction_info(messageData); - - if (MSG_DIRECTION_TYPE_MT == type) { - if (validatePhoneNumber(tmp)) { - setSourceAddress(tmp); - setFrom(tmp); - } - } else if (MSG_DIRECTION_TYPE_MO == type) { - appendToRecipients(tmp); - } else { - ThrowMsg(Commons::PlatformException, "Wrong type of recipient."); - } - } -} - -void Sms::readBody(msg_message_t& messageData) -{ - //set abstraction body value - const char* body = msg_sms_get_message_body(messageData); - if (NULL == body) { - ThrowMsg(Commons::PlatformException, - "Body is NULL. Probably message is invalid."); - } - setBody(body); -} - -void Sms::readFolder(msg_message_t& messageData) -{ - switch (msg_get_folder_id(messageData)) { - case MSG_INBOX_ID: - setFolderType(Api::INBOX); - break; - case MSG_OUTBOX_ID: - setFolderType(Api::OUTBOX); - break; - case MSG_SENTBOX_ID: - setFolderType(Api::SENTBOX); - break; - case MSG_DRAFT_ID: - setFolderType(Api::DRAFTBOX); - break; - case MSG_SPAMBOX_ID: - setFolderType(Api::SPAMBOX); - break; - default: - LogError("Wrong folder id"); - ThrowMsg(Commons::PlatformException, "Unsupported folder id."); - } -} - -void Sms::readDateTime(msg_message_t& messageData) -{ - tm* time = localtime(msg_get_time(messageData)); - if (!time) { - LogError("localtime failed"); - Throw(Commons::PlatformException); - } - setDateTime(*time); -} - -void Sms::readReadStatus(msg_message_t& messageData) -{ - // get read status - setReadStatus(msg_is_read(messageData)); -} - -void Sms::readSize(msg_message_t& messageData) -{ - setSize(msg_get_message_body_size(messageData)); -} - -msg_message_t Sms::createNewCopyOfPLatformMsg(const msg_message_t src) const -{ - msg_message_t msg = msg_new_message(); - - msg_set_message_id(msg, 0); - msg_set_storage_id(msg, msg_get_storage_id(src)); - msg_set_message_type(msg, msg_get_message_type(src)); - msg_set_folder_id(msg, msg_get_folder_id(src)); - for (int i = 0; i < msg_get_address_count(src); i++) { - msg_add_address(msg, msg_get_ith_address(src, - i), - msg_get_ith_recipient_type(src, i)); - } - msg_sms_set_message_body(msg, msg_sms_get_message_body( - src), msg_get_message_body_size(src)); - msg_set_subject(msg, msg_get_subject(src)); - msg_set_time(msg, *msg_get_time(src)); - msg_set_network_status(msg, msg_get_network_status(src)); - msg_set_encode_type(msg, msg_get_encode_type(src)); - msg_set_read_status(msg, msg_is_read(src)); - msg_set_protect_status(msg, msg_is_protected(src)); - msg_set_priority_info(msg, msg_get_priority_info(src)); - msg_set_direction_info(msg, msg_get_direction_info(src)); - msg_set_port(msg, msg_get_dest_port(src), msg_get_src_port(src)); - msg_set_scheduled_time(msg, *msg_get_scheduled_time(src)); - - return msg; -} -} -} diff --git a/src/modules/tizen/Messaging/Sms.h b/src/modules/tizen/Messaging/Sms.h deleted file mode 100644 index f3b86bc..0000000 --- a/src/modules/tizen/Messaging/Sms.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - * - * @file Sms.h - * @author Pawel Misiak (p.misiak@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef SMS_H -#define SMS_H - -#include -#include "ISendingObserver.h" -#include - -extern "C" { -#include -#include -} - -namespace WrtDeviceApis { -namespace Messaging { -class Sms : public Api::ISms, - public ISendingObserver, - public DPL::Event::Controller::Type > -{ - public: - explicit Sms(const std::string& id = ""); - - virtual ~Sms(); - - // implementation of interface of IMessage class - virtual void update(bool draftsOnly = false); - - virtual void readAllData(); - - virtual void moveToFolder(const Api::FolderType newFolder); - - virtual void moveToFolder(const std::string& newFolder); - - virtual void copyToFolder(const Api::FolderType newFolder); - - virtual void copyToFolder(const std::string& newFolder); - - virtual void remove(); - - virtual void send(); - - virtual void sendCancel() - { - } - - virtual void sendingCallback(MSG_SENT_STATUS_S *sent_status); - - virtual void OnEventReceived(const int& /*event*/); - - static Api::FolderType toFolder(const std::string &folder); - - private: - void sendSubMessage(); - - void setSendingStatusOk(); - - void setSendingStatusFailed(); - - void createNewMessage(); - - void readExistingMessage(); - - void updateBody(); - - void updateTo(); - - void updateFrom(); - - void updateSourceAddress(); - - void updateReadStatus(); - - void readRecipientList(msg_message_t& messageData); - - void readBody(msg_message_t& messageData); - - void readFolder(msg_message_t& messageData); - - void readDateTime(msg_message_t& messageData); - - void readReadStatus(msg_message_t& messageData); - - void readSize(msg_message_t& messageData); - - std::queue& currentQueue() - { - return m_sendRequests.front().queue; - } - - msg_message_t createNewCopyOfPLatformMsg(const msg_message_t src) const; - - private: - msg_message_t m_messageData; - bool m_sendingFailed; - DPL::Mutex m_mutex; - - struct SendRequest - { - // queue of sub messages for each recipient - std::queue queue; - bool failed; - - SendRequest() : failed(false) - { - } - }; - // queue of send requests - std::queue m_sendRequests; -}; -} -} - -#endif diff --git a/src/modules/tizen/Messaging/StorageChangeMessage.cpp b/src/modules/tizen/Messaging/StorageChangeMessage.cpp deleted file mode 100644 index 7e3bf15..0000000 --- a/src/modules/tizen/Messaging/StorageChangeMessage.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file StorageChangeMessage.cpp - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#include -#include "StorageChangeMessage.h" - -namespace { -const char* DBUS_INTERFACE_STORAGE_CHANGE = "User.Email.StorageChange"; -const int DBUS_MESSAGE_PARAMETERS_NUMBER = 5; -} - -namespace WrtDeviceApis { -namespace Messaging { - -StorageChangeMessage::StorageChangeMessage() - : m_accountId(0), - m_mailId(0), - m_extra(0) -{ } - -StorageChangeMessage StorageChangeMessage::parse(const DBus::MessagePtr& message) -{ - Assert(message.Get() != NULL && "Empty message."); - Assert(message->getInterface() == DBUS_INTERFACE_STORAGE_CHANGE); - - StorageChangeMessage result; - - DBus::Message::ReadIterator it = message->getReadIterator(); - for (int i = 0; i < DBUS_MESSAGE_PARAMETERS_NUMBER; it->next(), ++i) - { - if (!it->isValid()) - { - ThrowMsg(Commons::PlatformException, "Missing some properties."); - } - - switch (i) - { - case 0: - result.m_type = it->getInt(); - break; - case 1: - result.m_accountId = it->getInt(); - break; - case 2: - result.m_mailId = it->getInt(); - break; - case 3: - result.m_folderName = it->getString(); - break; - case 4: - result.m_extra = it->getInt(); - break; - } - } - - return result; -} - -int StorageChangeMessage::getType() const -{ - return m_type; -} - -int StorageChangeMessage::getAccountId() const -{ - return m_accountId; -} - -int StorageChangeMessage::getMailId() const -{ - return m_mailId; -} - -std::string StorageChangeMessage::getFolderName() const -{ - return m_folderName; -} - -int StorageChangeMessage::getExtra() const -{ - return m_extra; -} - -} -} diff --git a/src/modules/tizen/Messaging/StorageChangeMessage.h b/src/modules/tizen/Messaging/StorageChangeMessage.h deleted file mode 100644 index 5051ff9..0000000 --- a/src/modules/tizen/Messaging/StorageChangeMessage.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file StorageChangeMessage.h - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef SRC_MODULES_TIZEN_MESSAGING_STORAGECHANGEMESSAGE_H_ -#define SRC_MODULES_TIZEN_MESSAGING_STORAGECHANGEMESSAGE_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Messaging { - -class StorageChangeMessage -{ -public: - static StorageChangeMessage parse(const DBus::MessagePtr& message); - - int getType() const; - int getAccountId() const; - int getMailId() const; - std::string getFolderName() const; - - /** - * Depends on the type: - * - NOTI_MAIL_ADD: id of a thread - * - NOTI_MAIL_UPDATE: type of the change @see emf_mail_change_type_t - * @return Extra information. - */ - int getExtra() const; - -private: - StorageChangeMessage(); - -private: - int m_type; - int m_accountId; - int m_mailId; - std::string m_folderName; - int m_extra; -}; - -} -} - -#endif diff --git a/src/modules/tizen/Messaging/config.cmake b/src/modules/tizen/Messaging/config.cmake deleted file mode 100644 index a2497d2..0000000 --- a/src/modules/tizen/Messaging/config.cmake +++ /dev/null @@ -1,38 +0,0 @@ -get_current_path() - -pkg_search_module(msg-service-module REQUIRED msg-service) -pkg_search_module(email-service-module REQUIRED email-service) - -set(INCLUDES_MESSAGING_DIRECTORIES - ${msg-service-module_INCLUDE_DIRS} - ${email-service-module_INCLUDE_DIRS} - ${INCLUDES_IMPLEMENTATION_DBUS} - PARENT_SCOPE -) - -set(LIBS_IMPLEMENTATION_MESSAGING - ${msg-service-module_LIBRARIES} - ${email-service-module_LIBRARIES} - ${LIBS_IMPLEMENTATION_DBUS} - PARENT_SCOPE -) - -set(SRCS_IMPLEMENTATION_MESSAGING - ${CURRENT_PATH}/Attachment.cpp - ${CURRENT_PATH}/BinarySms.cpp - ${CURRENT_PATH}/Email.cpp - ${CURRENT_PATH}/Messaging.cpp - ${CURRENT_PATH}/Mms.cpp - ${CURRENT_PATH}/Sms.cpp - ${CURRENT_PATH}/CallbackMgr.cpp - ${CURRENT_PATH}/NetworkStatus.cpp - ${CURRENT_PATH}/MailSender.cpp - ${CURRENT_PATH}/EmailService.cpp - ${CURRENT_PATH}/EmailUtils.cpp - ${CURRENT_PATH}/EmailConverter.cpp - ${CURRENT_PATH}/MsgServiceHandleMgr.cpp - ${CURRENT_PATH}/StorageChangeMessage.cpp - ${CURRENT_PATH}/MailNotifier.cpp - ${SRCS_IMPLEMENTATION_DBUS} - PARENT_SCOPE -) diff --git a/src/modules/tizen/Orientation/Orientation.cpp b/src/modules/tizen/Orientation/Orientation.cpp deleted file mode 100644 index bb6d79a..0000000 --- a/src/modules/tizen/Orientation/Orientation.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file Orientation.cpp - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#include -#include -#include -#include "Orientation.h" - -using namespace DPL; - -namespace WrtDeviceApis { -namespace Orientation { - -using namespace Api; - -namespace { -/** - * Callback method called by platform as interval time. - * @param event_type Platform orientation evet type - * @param event Platform sensor event data - * @param this_ User data pointer. - */ -static void OrientationChangedCallback(unsigned int event_type, - sensor_event_data_t *event, - void *watcher_ptr) -{ - LogDebug("Callback OrientationChangedCallback."); - if (watcher_ptr) { - if (event_type == GEOMAGNETIC_EVENT_ATTITUDE_DATA_REPORT_ON_TIME && - event != NULL) { - ((Orientation::Watcher*)watcher_ptr)->orientationHasChanged(event); - } - } else { - LogError("Callback private data is NULL."); - } -} -} //private namespace - -Orientation::Orientation() : - m_handle(-1), - m_initialized(false), - m_isWatch(false) -{ - LogDebug("Platform::Orientation Enter"); -} - -Orientation::~Orientation() -{ - LogDebug("Enter"); - - if (m_initialized == true) { - stop(m_handle); - } - - LogDebug("All watchers : (" << m_watchers.size() << ")"); - std::vector::iterator it; - for (it = m_watchers.begin(); it != m_watchers.end(); ++it) { - stop((*it)->getHandle(), true); - } - m_watchers.clear(); - LogDebug("All watchers were cleared. (" << m_watchers.size() << ")"); -} - -void Orientation::getCurrentOrientation( - const EventGetCurrentOrientationPtr& event) -{ - LogDebug("Entered"); - - if (m_initialized == false) { - m_handle = initialize(); - start(m_handle); - m_initialized = true; - } - EventRequestReceiver::PostRequest(event); -} - -void Orientation::OnRequestReceived(const EventGetCurrentOrientationPtr& event) -{ - LogDebug("Entered"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - /** - * Invoke platform API sf_get_data gets raw data from a sensor with connecting the sensor-server. - * The type of sensor is supplied and return data is stored in the output parameter values []. - */ - if ((sf_get_data(m_handle, GEOMAGNETIC_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - LogError("Can't get current Orientation. "); - Throw(Commons::PlatformException); - } - - event->setAlpha(static_cast(data.values[0])); - event->setBeta(static_cast(data.values[1])); - event->setGamma(static_cast(data.values[2])); -} - -long Orientation::watchOrientation( - const EventOrientationChangedEmitterPtr& emitter, - long minNotificationInterval) -{ - LogDebug("Entered"); - int new_handle = initialize(); - int sensor_state = 0; - event_condition_t condition; - condition.cond_op = CONDITION_EQUAL; - condition.cond_value1 = minNotificationInterval; - /** - * Invoke platform API sf_register_event registers a user defined callback function with a connected sensor for a particular event. - **This callback function will be called when there is a change in the state of respective sensor. - **cb_data will be the parameter used during the callback call. - **Callback interval can be adjusted using even_contion_t argument. - */ - WatcherPtr watcher(new Watcher(new_handle, emitter)); - - sensor_state = sf_register_event( - watcher->getHandle(), - GEOMAGNETIC_EVENT_ATTITUDE_DATA_REPORT_ON_TIME, &condition, - OrientationChangedCallback, watcher.Get()); - if (sensor_state < 0) { - stop(watcher->getHandle()); - Throw(Commons::PlatformException); - } - m_isWatch = true; - start(watcher->getHandle()); - m_watchers.push_back(watcher); - watcher->getCurrentOrientationForWatch(); - return static_cast(emitter->getId()); -} - -void Orientation::clearWatch(EventOrientationChangedEmitter::IdType id) -{ - LogDebug("Entered"); - - std::vector::iterator it; - for (it = m_watchers.begin(); it != m_watchers.end(); ++it) { - if (id == (*it)->getEmitter()->getId()) { - stop((*it)->getHandle(), true); - - m_watchers.erase(it); - LogDebug("Watcher is removed. (" << m_watchers.size() << ")"); - - if (m_watchers.size() == 0) { - m_isWatch = false; - } - break; - } - } -} - -void Orientation::OrientationHasChanged(sensor_event_data_t *sensorEvent) -{ - LogDebug("Entered"); - - sensor_data_t *sensor_data = NULL; - sensor_data = (sensor_data_t *)sensorEvent->event_data; - if (sensor_data == NULL || - (sensor_data->values_num < 3)) { - LogError("Can't get current Acceleration. "); - Throw(Commons::PlatformException); - return; - } - - EventOrientationChangedPtr event(new EventOrientationChanged()); - OrientationProperties props; - props.alpha = static_cast(sensor_data->values[0]); - props.beta = static_cast(-(sensor_data->values[1])); - props.gamma = static_cast(-(sensor_data->values[2])); - - LogDebug( - "alpha" << props.alpha << ",beta" << props.beta << ",gamma" << - props.gamma); - - event->setOrientationProperties(props); - - m_OrientationEmitters.emit(event); -} - -void Orientation::getCurrentOrientationForWatch(void) -{ - LogDebug("Entered"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, GEOMAGNETIC_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - Throw(Commons::PlatformException); - } - - EventOrientationChangedPtr event(new EventOrientationChanged()); - OrientationProperties props; - props.alpha = static_cast(data.values[0]); - props.beta = static_cast(-(data.values[1])); - props.gamma = static_cast(-(data.values[2])); - - event->setOrientationProperties(props); - - m_OrientationEmitters.emit(event); -} - -int Orientation::initialize() -{ - LogDebug("Entered"); - DPL::Mutex::ScopedLock lock(&m_initializationMutex); - int handle = sf_connect(GEOMAGNETIC_SENSOR); - if (handle < 0) { - LogError("Could not connect with orientation sensor."); - Throw(Commons::UnsupportedException); - } - return handle; -} - -void Orientation::restart(int& handle) -{ - stop(handle); - start(handle); -} - -void Orientation::start(int handle) -{ - LogDebug("Entered"); - if (sf_start(handle, 0) < 0) { - LogError("Could not start communication with sensor."); - if (handle >= 0) { - sf_disconnect(handle); - Throw(Commons::UnsupportedException); - } - } else { - // TODO: find the way to fix this - usleep(100000); - } -} - -void Orientation::stop(int& handle, - bool isWatcherHandle) -{ - LogDebug("Entered"); - - if (handle >= 0) { - if (isWatcherHandle == true) { - sf_unregister_event(handle, - GEOMAGNETIC_EVENT_ATTITUDE_DATA_REPORT_ON_TIME); - } - sf_stop(handle); - sf_disconnect(handle); - handle = -1; - } -} - -//Watcher's -void Orientation::Watcher::getCurrentOrientationForWatch() -{ - LogDebug("Enter"); - sensor_data_t data; - memset(&data, 0, sizeof(sensor_data_t)); - if ((sf_get_data(m_handle, GEOMAGNETIC_BASE_DATA_SET, &data) < 0) || - (data.values_num < 3)) { - Throw(Commons::PlatformException); - } - - EventOrientationChangedPtr event(new EventOrientationChanged()); - OrientationProperties props; - props.alpha = static_cast(data.values[0]); - props.beta = static_cast(data.values[1]); - props.gamma = static_cast(data.values[2]); - - event->setOrientationProperties(props); - - emit(event); -} - -//Watcher's -void Orientation::Watcher::orientationHasChanged( - sensor_event_data_t *sensorEvent) -{ - LogDebug("Enter"); - sensor_data_t *sensor_data = NULL; - sensor_data = (sensor_data_t *)sensorEvent->event_data; - if (sensor_data == NULL || - (sensor_data->values_num < 3)) { - LogError("Can't get current Orientation. "); - Throw(Commons::PlatformException); - return; - } - - EventOrientationChangedPtr event(new EventOrientationChanged()); - OrientationProperties props; - props.alpha = static_cast(sensor_data->values[0]); - props.beta = static_cast(sensor_data->values[1]); - props.gamma = static_cast(sensor_data->values[2]); - LogDebug( - "alpha:" << sensor_data->values[0] << ",beta:" << - sensor_data->values[1] << ",gamma:" << sensor_data->values[2]); - - event->setOrientationProperties(props); - - emit(event); -} - -} -} diff --git a/src/modules/tizen/Orientation/Orientation.h b/src/modules/tizen/Orientation/Orientation.h deleted file mode 100644 index 0406772..0000000 --- a/src/modules/tizen/Orientation/Orientation.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file Orientation.h - * @author Qi Xiangguo (xiangguo.qi@samsung.com) - * @version 0.1 - * @brief - */ - -#ifndef WRTDEVICEAPIS_ORIENTATION_ORIENTATION_H_ -#define WRTDEVICEAPIS_ORIENTATION_ORIENTATION_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Orientation { - -class Orientation : public Api::IOrientation -{ - int m_handle; - gulong m_signalId; - /** - * @See: Api::Orientation. - */ - friend class Api::OrientationFactory; - - public: - class Watcher - { - private: - int m_handle; - Api::EventOrientationChangedEmitterPtr m_emitter; - - public: - Watcher( - int handle, - const Api::EventOrientationChangedEmitterPtr& - emitter) : - m_handle(handle), - m_emitter(emitter) - { - } - - int& getHandle() - { - return m_handle; - } - - Api::EventOrientationChangedEmitterPtr getEmitter() - { - return m_emitter; - } - - void emit(const Api::EventOrientationChangedPtr& event) - { - m_emitter->emit(event); - } - void getCurrentOrientationForWatch(); - void orientationHasChanged(sensor_event_data_t *sensorEvent); - }; - typedef DPL::SharedPtr WatcherPtr; - - public: - virtual ~Orientation(); - - /** - * @See: IOrientation::getCurrentOrientation - */ - virtual void getCurrentOrientation( - const Api::EventGetCurrentOrientationPtr& event); - - /** - * @See: IOrientation::watchOrientation - */ - virtual long watchOrientation( - const Api::EventOrientationChangedEmitterPtr& - emitter, - long minNotificationInterval); - - /** - * @See: IOrientation::clearWatch - */ - virtual void clearWatch( - Api::EventOrientationChangedEmitter::IdType id); - - /** - * Method to run from platform's callback function - */ - void OrientationHasChanged(sensor_event_data_t *sensorEvent); - - /** - * Method to get current orientation for watch function - */ - void getCurrentOrientationForWatch(); - - protected: - Orientation(); - virtual void OnRequestReceived( - const Api::EventGetCurrentOrientationPtr& event); - - private: - typedef Commons::Emitters - OrientationChangedEmitters; - - /** - * Initialize orientation sensor. This method returns when platform error occurs. - */ - int initialize(); - - /** - * Start orientation sensor. This method sends a start command to sensor server. - */ - void start(int handle); - - /** - * Stop orientation sensor. This method sends a stop command to sensor server. - */ - void stop(int& handle, - bool isWatcherHandle = false); - - /** - * Method to restart orientation sensor server. - */ - void restart(int& handle); - - OrientationChangedEmitters m_OrientationEmitters; - DPL::Mutex m_initializationMutex; - bool m_initialized; - bool m_isWatch; - std::vector m_watchers; -}; - -} -} - -#endif // WRTDEVICEAPIS_ORIENTATION_ORIENTATION_H_ diff --git a/src/modules/tizen/Orientation/config.cmake b/src/modules/tizen/Orientation/config.cmake deleted file mode 100644 index bacdc2d..0000000 --- a/src/modules/tizen/Orientation/config.cmake +++ /dev/null @@ -1,18 +0,0 @@ -get_current_path() - -pkg_search_module(sensor REQUIRED sensor) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_ORIENTATION - ${sensor_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_ORIENTATION - ${sensor_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_ORIENTATION - ${CURRENT_PATH}/Orientation.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/PluginManager/PluginManager.cpp b/src/modules/tizen/PluginManager/PluginManager.cpp index 53dae94..27af1fe 100644 --- a/src/modules/tizen/PluginManager/PluginManager.cpp +++ b/src/modules/tizen/PluginManager/PluginManager.cpp @@ -46,13 +46,16 @@ namespace PluginManager { PluginManager::PluginManager(int widgetHandle, const string &objectUri, + JSObjectRef object, JSContextRef context) : m_widgetHandle(widgetHandle), m_objectUri(GLOBAL_OBJECT_NAME), + m_shortUri(objectUri), + m_objectInstance(object), m_context(context) { m_objectUri.append(SEPARATOR).append(objectUri); - WrtDB::WrtDatabase::attachToThread(); + WrtDB::WrtDatabase::attachToThreadRO(); } PluginManager::~PluginManager() @@ -84,7 +87,6 @@ bool PluginManager::loadChild(const string &name) const return false; } - // Create dao WrtDB::DbWidgetFeatureSet features; Try { @@ -99,10 +101,22 @@ bool PluginManager::loadChild(const string &name) const return false; } - FOREACH (it, features) { - if (it->pluginId == handle) { - PluginLogicSingleton::Instance().addSpecialFeatureToSession(*it); - return true; + //check does plugin with feature was requested + FOREACH (it, features) + { + if (it->pluginId == handle) + { + if(it->rejected) + { + LogWarning("Feature rejected by ACE"); + continue; + } + + PluginLogic::JavaScriptObject jsObject = {m_objectInstance, + m_shortUri}; + + return PluginLogicSingleton::Instance().loadPluginOnDemand( + handle, jsObject); } } LogError("Plugin not loaded"); diff --git a/src/modules/tizen/PluginManager/PluginManager.h b/src/modules/tizen/PluginManager/PluginManager.h index 8cabff7..b6564e1 100644 --- a/src/modules/tizen/PluginManager/PluginManager.h +++ b/src/modules/tizen/PluginManager/PluginManager.h @@ -36,6 +36,7 @@ class PluginManager : public Api::IPluginManager public: PluginManager(int widgetHandle, const std::string &objectUri, + JSObjectRef object, JSContextRef context); ~PluginManager(); bool hasChild(const std::string &name) const; @@ -53,7 +54,9 @@ private: typedef std::map ObjectList; int m_widgetHandle; + JSObjectRef m_objectInstance; std::string m_objectUri; + std::string m_shortUri; mutable DPL::Optional m_propertyCache; ObjectList m_objectList; JSContextRef m_context; diff --git a/src/modules/tizen/Power/Backlight.cpp b/src/modules/tizen/Power/Backlight.cpp deleted file mode 100644 index c2547d0..0000000 --- a/src/modules/tizen/Power/Backlight.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Backlight.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include -#include -#include "Backlight.h" - -using namespace WrtDeviceApis; -using namespace WrtDeviceApis::Commons; - -namespace WrtDeviceApis { -namespace Power { - -Backlight::Backlight() : - EventLightOffTimerReqReceiver(ThreadEnum::POWER_THREAD), - EventLightReqReceiver(ThreadEnum::POWER_THREAD) -{ - // empty -} - -Backlight::~Backlight() -{ - // empty -} - -int Backlight::changeState(Power::Api::BacklightStatus state, - unsigned int timeout) -{ - LogInfo("Entered!!"); - int result = -1; - - LogDebug("state: " << state << ", timeout: " << timeout); - result = pm_change_state(toLCDState(state)); - if (state == Power::Api::BACKLIGHT_NORMAL) { - EventLightOffTimerPtr lightOffTimerEvent = - EventLightOffTimerPtr( - new EventLightOffTimer()); - lightOffTimerEvent->setForAsynchronousCall(NULL); - EventLightOffTimerReqReceiver::PostRequest( - lightOffTimerEvent, - timeout / 1000.0); - } - - if (result < 0) { - LogDebug("[ERROR] return value result =" << result); - } else { - LogDebug("[SUCCESS]return value result =" << result); - } - - return result; -} - -void Backlight::changeState(const Power::Api::EventLightPtr& event) -{ - EventLightReqReceiver::PostRequest(event); -} - -int Backlight::toLCDState(Power::Api::BacklightStatus state) const -{ - LogDebug("enter"); - switch (state) { - case Power::Api::BACKLIGHT_DIM: - return LCD_DIM; - break; - case Power::Api::BACKLIGHT_NORMAL: - return LCD_NORMAL; - break; - case Power::Api::BACKLIGHT_OFF: - return LCD_OFF; - break; - default: - LogDebug("error status"); - break; - } - - return 0; -} - -void Backlight::OnRequestReceived(const EventLightOffTimerPtr& /*event*/) -{ - LogInfo("LightOffTimer event is received!!"); - pm_change_state(LCD_DIM); -} - -void Backlight::OnRequestReceived(const Power::Api::EventLightPtr& event) -{ - LogInfo("Backlight event is received!!"); - try - { - if (event == NULL) { - LogError("event is NULL!"); - ThrowMsg(Commons::PlatformException, "Event is NULL!!"); - } - LogDebug( - "Status: " << event->getStatus() << ", Duratin: " << - event->getDuration()); - if (changeState(event->getStatus(), event->getDuration()) < 0) { - LogError("changeState returned error!!"); - ThrowMsg(Commons::PlatformException, "Play Beep is Failed!"); - } - } - catch (Commons::PlatformException) { - LogError("platform exception"); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } -} -} // Power -} // WrtDeviceApis - diff --git a/src/modules/tizen/Power/Backlight.h b/src/modules/tizen/Power/Backlight.h deleted file mode 100644 index 0b322ae..0000000 --- a/src/modules/tizen/Power/Backlight.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Backlight.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_POWER_BACK_LIGHT_H_ -#define WRTDEVICEAPIS_POWER_BACK_LIGHT_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { - -// Dummy event for asynchronous light on schedule -class EventLightOffTimer : public Commons::IEvent -{ -}; - -typedef DPL::SharedPtr EventLightOffTimerPtr; -typedef Commons::EventRequestReceiver - EventLightOffTimerReqReceiver; -typedef Commons::EventRequestReceiver EventLightReqReceiver; - -class Backlight : public Api::IBacklight, - public EventLightOffTimerReqReceiver, - public EventLightReqReceiver -{ - private: - friend class Manager; - - public: - - explicit Backlight(); - ~Backlight(); - - /** - * @see Api::IBacklight::changeState() - */ - int changeState(Api::BacklightStatus state, - unsigned int timeout); - - /** - * @see Api::IBacklight::changeState() - */ - void changeState(const Api::EventLightPtr& event); - - protected: - void OnRequestReceived(const EventLightOffTimerPtr& event); - void OnRequestReceived(const Api::EventLightPtr& event); - - private: - int toLCDState(Api::BacklightStatus state) const; -}; -typedef DPL::SharedPtr BacklightPtr; - -} // Power -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_POWER_BATTERY_H_ */ - diff --git a/src/modules/tizen/Power/Battery.cpp b/src/modules/tizen/Power/Battery.cpp deleted file mode 100644 index 27963f5..0000000 --- a/src/modules/tizen/Power/Battery.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include "Battery.h" - -namespace WrtDeviceApis { -namespace Power { - -Battery::Battery(std::size_t index) : - m_index(index), - m_onChargingKey(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW), - m_onRemainingKey(VCONFKEY_SYSMAN_BATTERY_LEVEL), - m_onLowKey(VCONFKEY_TELEPHONY_LOW_BATTERY) -{ -} - -Battery::~Battery() -{ -} - -bool Battery::isCharging() const -{ - Try { - return m_onChargingKey.getBool(); - } - Catch(Commons::ConversionException) { - ReThrowMsg(Commons::PlatformException, - "Could not discover battery state."); - } -} - -unsigned int Battery::getRemaining() const -{ - Try { - int level = m_onRemainingKey.getInt(); - double ratio = - (level / static_cast(VCONFKEY_SYSMAN_BAT_LEVEL_MAX)); - return static_cast(ratio * 100); - } - Catch(Commons::ConversionException) { - ReThrowMsg(Commons::PlatformException, - "Could not discover battery level."); - } -} - -void Battery::addOnCharging(const Power::Api::EventChargingEmitterPtr& emitter) -{ - DPL::Mutex::ScopedLock lock(&m_onChargingMtx); - ChargingEventEmitters::iterator it = m_onCharging.find(emitter->getId()); - if (it == m_onCharging.end()) { - if (m_onCharging.size() == 0) { - if (!m_onChargingKey.attachCallback(Battery::onCharging, this)) { - ThrowMsg(Commons::PlatformException, - "Could not set platform listener."); - } - } - m_onCharging.insert(ChargingEventEmitters::value_type(emitter->getId(), - emitter)); - } -} - -void Battery::removeOnCharging(Power::Api::EventChargingEmitter::IdType id) -{ - DPL::Mutex::ScopedLock lock(&m_onChargingMtx); - ChargingEventEmitters::iterator it = m_onCharging.find(id); - if (it != m_onCharging.end()) { - m_onCharging.erase(it); - if (m_onCharging.size() == 0) { - m_onChargingKey.detachCallback(); - } - } -} - -void Battery::addOnRemaining( - const Api::EventRemainingEmitterPtr& emitter) -{ - DPL::Mutex::ScopedLock lock(&m_onRemainingMtx); - RemainingEventEmitters::iterator it = m_onRemaining.find(emitter->getId()); - if (it == m_onRemaining.end()) { - if (m_onRemaining.size() == 0) { - if (!m_onRemainingKey.attachCallback(Battery::onRemaining, this)) { - ThrowMsg(Commons::PlatformException, - "Could not set platform listener."); - } - } - m_onRemaining.insert(RemainingEventEmitters::value_type(emitter->getId(), - emitter)); - } -} - -void Battery::removeOnRemaining(Api::EventRemainingEmitter::IdType id) -{ - DPL::Mutex::ScopedLock lock(&m_onRemainingMtx); - RemainingEventEmitters::iterator it = m_onRemaining.find(id); - if (it != m_onRemaining.end()) { - m_onRemaining.erase(it); - if (m_onRemaining.size() == 0) { - m_onRemainingKey.detachCallback(); - } - } -} - -void Battery::addOnLow(const Api::EventLowEmitterPtr& emitter) -{ - DPL::Mutex::ScopedLock lock(&m_onLowMtx); - LowEventEmitters::iterator it = m_onLow.find(emitter->getId()); - if (it == m_onLow.end()) { - if (m_onLow.size() == 0) { - if (!m_onLowKey.attachCallback(Battery::onLow, this)) { - ThrowMsg(Commons::PlatformException, - "Could not set platform listener."); - } - } - m_onLow.insert(LowEventEmitters::value_type(emitter->getId(), emitter)); - } -} - -void Battery::removeOnLow(Api::EventLowEmitter::IdType id) -{ - DPL::Mutex::ScopedLock lock(&m_onLowMtx); - LowEventEmitters::iterator it = m_onLow.find(id); - if (it != m_onLow.end()) { - m_onLow.erase(it); - if (m_onLow.size() == 0) { - m_onLowKey.detachCallback(); - } - } -} - -void Battery::onCharging(const VConf::Node* /* node */, - void* data) -{ - Battery* this_ = static_cast(data); - if (this_) { - Api::EventChargingPtr event(new Api::EventCharging()); - - DPL::Mutex::ScopedLock lock(&this_->m_onChargingMtx); - ChargingEventEmitters::iterator it = this_->m_onCharging.begin(); - for (; it != this_->m_onCharging.end(); ++it) { - if (!!it->second) { - it->second->emit(event); - } - } - } -} - -void Battery::onRemaining(const VConf::Node* /* node */, - void* data) -{ - Battery* this_ = static_cast(data); - if (this_) { - Api::EventRemainingPtr event(new Api::EventRemaining()); - Try { - event->setResult(this_->getRemaining()); - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - - DPL::Mutex::ScopedLock lock(&this_->m_onRemainingMtx); - RemainingEventEmitters::iterator it = this_->m_onRemaining.begin(); - for (; it != this_->m_onRemaining.end(); ++it) { - if (!!it->second) { - it->second->emit(event); - } - } - } -} - -void Battery::onLow(const VConf::Node* /* node */, - void* data) -{ - Battery* this_ = static_cast(data); - if (this_) { - Api::EventLowPtr event(new Api::EventLow()); - Try { - event->setResult(this_->getRemaining()); - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - - DPL::Mutex::ScopedLock lock(&this_->m_onLowMtx); - LowEventEmitters::iterator it = this_->m_onLow.begin(); - for (; it != this_->m_onLow.end(); ++it) { - if (!!it->second) { - it->second->emit(event); - } - } - } -} -} // Power -} // WrtDeviceApis diff --git a/src/modules/tizen/Power/Battery.h b/src/modules/tizen/Power/Battery.h deleted file mode 100644 index 35730a1..0000000 --- a/src/modules/tizen/Power/Battery.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_BATTERY_H_ -#define WRTDEVICEAPIS_POWER_BATTERY_H_ - -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Power { - -class Battery : public Api::IBattery -{ - private: - friend class Manager; - - public: - ~Battery(); - - /** - * @see Api::Power::IBattery::isCharging() - */ - bool isCharging() const; - - /** - * @see Api::Power::IBattery::getRemaining() - */ - unsigned int getRemaining() const; - - /** - * @see Api::Power::IBattery::addOnCharging() - */ - void addOnCharging(const Api::EventChargingEmitterPtr& emitter); - - /** - * @see Api::Power::IBattery::removeOnCharing() - */ - void removeOnCharging(Api::EventChargingEmitter::IdType id); - - /** - * @see Api::Power::IBattery::addOnRemaining() - */ - void addOnRemaining(const Api::EventRemainingEmitterPtr& emitter); - - /** - * @see Api::Power::IBattery::removeOnRemaining() - */ - void removeOnRemaining(Api::EventRemainingEmitter::IdType id); - - /** - * @see Api::Power::IBattery::addOnLow() - */ - void addOnLow(const Api::EventLowEmitterPtr& emitter); - - /** - * @see Api::Power::IBattery::removeOnRemaining() - */ - void removeOnLow(Api::EventLowEmitter::IdType id); - - private: - typedef std::map ChargingEventEmitters; - - typedef std::map - RemainingEventEmitters; - - typedef std::map LowEventEmitters; - private: - explicit Battery(std::size_t index); - - /** - * Callback method called by platform when battery charging state changes. - * @param key Vconf key object. - * @param data User data. - */ - static void onCharging(const VConf::Node* node, - void* data); - - /** - * Callback method called by platform when battery power level changes. - * @param key Vconf key object. - * @param data User data. - */ - static void onRemaining(const VConf::Node* key, - void* data); - - /** - * Callback method called by platform when battery power level gets low. - * @param key Vconf key object. - * @param data User data. - */ - static void onLow(const VConf::Node* key, - void* data); - - private: - std::size_t m_index; ///< Index of battery this interface represents. - VConf::Key m_onChargingKey; ///< Wrapper for vconf on battery charging key. - VConf::Key m_onRemainingKey; ///< Wrapper for vconf on battery level key. - VConf::Key m_onLowKey; ///< Wrapper for vconf on battery low level state key. - ChargingEventEmitters m_onCharging; ///< Charging event emitters. - RemainingEventEmitters m_onRemaining; ///< Remaining event emitters. - LowEventEmitters m_onLow; ///< Low level event emitters. - DPL::Mutex m_onChargingMtx; ///< Mutex synchronizing operations on m_onCharging object. - DPL::Mutex m_onRemainingMtx; ///< Mutex synchronizing operations on m_onRemaining object. - DPL::Mutex m_onLowMtx; ///< Mutex synchronizing operations on m_onLow object. -}; - -} // Power -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_POWER_BATTERY_H_ */ diff --git a/src/modules/tizen/Power/Manager.cpp b/src/modules/tizen/Power/Manager.cpp deleted file mode 100644 index 92d1f25..0000000 --- a/src/modules/tizen/Power/Manager.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Manager.h" -#include -#include - -namespace { -const std::size_t NUMBER_OF_AVAILABLE_BATTERIES = 1; -const std::size_t NUMBER_OF_AVAILABLE_BACKLIGHT = 1; -} - -namespace WrtDeviceApis { -namespace Power { - -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Manager::Manager() -{ - //m_backlight = new Backlight(); -} - -Manager::~Manager() -{ -} - -void Manager::Release() -{ - LogDebug("entered"); - Batteries::iterator it = m_batteries.begin(); - for (; it != m_batteries.end(); ++it) { - //delete it->second; - } - if (m_batteries.size() > 0) { - m_batteries.clear(); - } - - if (NULL != m_backlight) { - //delete m_backlight; - //m_backlight = NULL; - } -} - -Battery* Manager::getBattery(std::size_t index) const -{ - if (index > NUMBER_OF_AVAILABLE_BATTERIES) { - ThrowMsg(Commons::OutOfRangeException, "Battery not available."); - } - - Batteries::iterator it = m_batteries.find(index); - if (it == m_batteries.end()) { - Battery* battery = new Battery(index); - m_batteries.insert(Batteries::value_type(index, battery)); - return battery; - } - return it->second; -} - -std::size_t Manager::getBatteriesCount() const -{ - return NUMBER_OF_AVAILABLE_BATTERIES; -} - -Api::IBacklightPtr Manager::getBacklight(void) -{ - if (NULL == m_backlight) { - m_backlight = Api::IBacklightPtr(new Backlight()); - } - return m_backlight; -} - -std::size_t Manager::getBacklightCount() const -{ - return NUMBER_OF_AVAILABLE_BACKLIGHT; -} -} // Power -} // WrtDeviceApis diff --git a/src/modules/tizen/Power/Manager.h b/src/modules/tizen/Power/Manager.h deleted file mode 100644 index d73426e..0000000 --- a/src/modules/tizen/Power/Manager.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_POWER_MANAGER_H_ -#define WRTDEVICEAPIS_POWER_MANAGER_H_ - -#include -#include -#include -#include "Battery.h" -#include "Backlight.h" - -namespace WrtDeviceApis { -namespace Power { - -class Manager : public Api::IManager -{ - public: - static Manager& getInstance(); - - public: - ~Manager(); - - /** - * @see Api::Power::IManager::getBattery() - */ - Battery* getBattery(std::size_t index) const; - - /** - * @see Api::Power::IManager::getBatteriesCount() - */ - std::size_t getBatteriesCount() const; - - /** - * @see Api::Power::IManager::getBacklight() - */ - - Api::IBacklightPtr getBacklight(void); - - /** - * @see Api::Power::IManager::getBacklightCount() - */ - - std::size_t getBacklightCount() const; - - /** - * @ release singleton resource while singleton deconstructor is not invoked. - */ - void Release(); - protected: - typedef std::map Batteries; - - protected: - Manager(); - - private: - mutable Batteries m_batteries; - Api::IBacklightPtr m_backlight; -}; - -} // Power -} // WrtDeviceApis - -#endif /* WRTDEVICEAPIS_POWER_MANAGER_H_ */ diff --git a/src/modules/tizen/Power/config.cmake b/src/modules/tizen/Power/config.cmake deleted file mode 100644 index 60ae7e3..0000000 --- a/src/modules/tizen/Power/config.cmake +++ /dev/null @@ -1,23 +0,0 @@ -get_current_path() - -pkg_search_module(pmapi REQUIRED pmapi) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_POWER - ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF} - ${pmapi_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_POWER - ${LIBS_PLATFORM_IMPLEMENTATION_VCONF} - ${pmapi_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_POWER - ${CURRENT_PATH}/Manager.cpp - ${CURRENT_PATH}/Battery.cpp - ${CURRENT_PATH}/Backlight.cpp - ${SRCS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) diff --git a/src/modules/tizen/Profile/Desktop.cpp b/src/modules/tizen/Profile/Desktop.cpp deleted file mode 100644 index 73ebf59..0000000 --- a/src/modules/tizen/Profile/Desktop.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Desktop.h" -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Profile { - -Filesystem::Api::IPathPtr Desktop::getWallpaper() const -{ - // TODO: conversion...? - return Filesystem::Api::IPath::create(m_wallpaperKey.getString()); -} - -void Desktop::setWallpaper(const Filesystem::Api::IPathPtr& path) -{ - // TODO: probably we shouldn't expose full path - std::string p = path->getFullPath(); - if (!Filesystem::Manager::fileExists(p)) { - LogError("Wallpaper not found. Path: " << p); - Throw(Commons::PlatformException); - } - m_wallpaperKey.setValue(p); -} - -void Desktop::setWallpaper(const Api::EventSetWallpaperPtr& event) -{ - EventSetWallpaperReqReceiver::PostRequest(event); -} - -void Desktop::OnRequestReceived(const Api::EventSetWallpaperPtr& event) -{ - Try - { - if (Api::IManager::getInstance().getDesktopCount() == 0) { - Throw(Commons::UnsupportedException); - } - Api::IDesktopPtr desktop = Api::IManager::getInstance().getDesktop( - IDesktop::DEFAULT); - if (!desktop) { - LogError("No default desktop."); - Throw(Commons::UnsupportedException); - } - - desktop->setWallpaper(Filesystem::Api::IPath::create(event->getPathRef())); - } - Catch(Commons::PlatformException) { - LogError("platform exception"); - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - Catch(Commons::UnsupportedException) { - LogError("unsupported exception"); - event->setExceptionCode(Commons::ExceptionCodes::UnsupportedException); - } - Catch(Commons::InvalidArgumentException) { - LogError("invalid argument exception"); - event->setExceptionCode( - Commons::ExceptionCodes::InvalidArgumentException); - } -} - -Desktop::Desktop() : EventSetWallpaperReqReceiver(Commons::ThreadEnum::PROFILE_THREAD), - m_wallpaperKey(VCONFKEY_BGSET) -{ -} -} // Profile -} // WrtDeviceApis diff --git a/src/modules/tizen/Profile/Desktop.h b/src/modules/tizen/Profile/Desktop.h deleted file mode 100644 index bd4f684..0000000 --- a/src/modules/tizen/Profile/Desktop.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_DESKTOP_H_ -#define WRTDEVICEAPIS_PROFILE_DESKTOP_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Profile { -typedef Commons::EventRequestReceiver< Profile::Api::EventSetWallpaper > -EventSetWallpaperReqReceiver; - -class Manager; - -class Desktop : public Profile::Api::IDesktop, - public EventSetWallpaperReqReceiver -{ - friend class Manager; - - public: - /** - * @see WrtPlugins::Profile::Api::IDesktop::getWallpaper() - */ - Filesystem::Api::IPathPtr getWallpaper() const; - - /** - * @see WrtPlugins::Profile::Api::IDesktop::setWallpaper() - */ - void setWallpaper(const Filesystem::Api::IPathPtr& path); - - /** - * @see WrtPlugins::Profile::Api::IDesktop::setWallpaper() - */ - void setWallpaper(const Profile::Api::EventSetWallpaperPtr& event); - - protected: - void OnRequestReceived(const Profile::Api::EventSetWallpaperPtr& event); - - private: - Desktop(); - - private: - VConf::Key m_wallpaperKey; -}; -typedef DPL::SharedPtr DesktopPtr; -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_DESKTOP_H_ diff --git a/src/modules/tizen/Profile/Manager.cpp b/src/modules/tizen/Profile/Manager.cpp deleted file mode 100644 index c075d54..0000000 --- a/src/modules/tizen/Profile/Manager.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Manager.h" -#include -#include -#include "Ringtone.h" -#include "Desktop.h" - -#define __TEMP_OPTION_FOR_GET_CURRENT_VOLUME__ // We can't get current volume by VCONF. This option is temporary till VCONF is woring correctly. -#if defined (__TEMP_OPTION_FOR_GET_CURRENT_VOLUME__) -#include -#include -#include -#include -#endif - -namespace { -const std::size_t NUMBER_OF_AVAILABLE_DESKTOPS = 1; -const std::size_t DEFAULT_DESKTOP_INDEX = 1; - -const WrtDeviceApis::Profile::Api::IManager::ProfileType profileMap[] = { - WrtDeviceApis::Profile::Api::IManager::NORMAL, - WrtDeviceApis::Profile::Api::IManager::SILENT, - WrtDeviceApis::Profile::Api::IManager::DRIVING, - WrtDeviceApis::Profile::Api::IManager::MEETING, - WrtDeviceApis::Profile::Api::IManager::OUTDOOR, - WrtDeviceApis::Profile::Api::IManager::FLIGHT -}; -const size_t PROFILE_MAP_SIZE = sizeof(profileMap) / sizeof(profileMap[0]); -} // anonymous - -namespace WrtDeviceApis { -namespace Profile { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Manager::~Manager() -{ -} - -void Manager::Release() const -{ - LogDebug("Entered."); - Ringtones::iterator it1 = m_ringtones.begin(); - for (; it1 != m_ringtones.end(); ++it1) { - delete it1->second; - } - if (m_ringtones.size() > 0) { - m_ringtones.clear(); - } - - Desktops::iterator it2 = m_desktops.begin(); - for (; it2 != m_desktops.end(); ++it2) { - if (it2->second) { - //delete it2->second; - } - } - if (m_desktops.size() > 0) { - m_desktops.clear(); - } -} - -Profile::Api::IDesktopPtr Manager::getDesktop(std::size_t index) const -{ - if (index == Profile::Api::IDesktop::DEFAULT) { - index = DEFAULT_DESKTOP_INDEX; - } - - if (index > NUMBER_OF_AVAILABLE_DESKTOPS) { - Throw(Commons::OutOfRangeException); - } - - Desktops::const_iterator it = m_desktops.find(index); - if (it != m_desktops.end()) { - return it->second; - } - return (m_desktops[index] = Profile::Api::IDesktopPtr(new Desktop())); -} - -std::size_t Manager::getDesktopCount() const -{ - return NUMBER_OF_AVAILABLE_DESKTOPS; -} - -Profile::Api::IRingtone* Manager::getRingtone(Profile::Api::RingtoneScope scope) -const -{ - switch (scope) { - case Profile::Api::RS_CALL: - return getRingtone_(Profile::Api::RS_CALL); - case Profile::Api::RS_SMS: - case Profile::Api::RS_MMS: - case Profile::Api::RS_EMAIL: - return getRingtone_(Profile::Api::RS_SMS); - default: - Throw(Commons::UnsupportedException); - } -} - -Manager::Manager() : - m_profileKey(VCONFKEY_SETAPPL_CUR_PROFILE_INT), - m_volumeKey(VCONFKEY_SETAPPL_PROFILE_CURRENT_CALL_VOLUME_INT), - m_vibrationKey(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL) -{ -} - -Profile::Api::IRingtone* Manager::getRingtone_( - Profile::Api::RingtoneScope scope) const -{ - Ringtones::const_iterator it = m_ringtones.find(scope); - if (it != m_ringtones.end()) { - return it->second; - } - return (m_ringtones[scope] = new Ringtone(scope)); -} - -Profile::Api::IManager::ProfileType Manager::getProfileType() const -{ - int profile = m_profileKey.getInt(); - if (profile < 0 || profile >= static_cast(PROFILE_MAP_SIZE)) { - Throw(Commons::OutOfRangeException); - } - - return profileMap[profile]; -} - -int Manager::getSystemVolume() const -{ -#if defined (__TEMP_OPTION_FOR_GET_CURRENT_VOLUME__) - unsigned int volume = 0; - int err = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &volume); - if (MM_ERROR_NONE != err) { - LogError("Can't get volume level. Error code: " << std::hex << err); - volume = 0; - } - return volume; -#else - return m_volumeKey.getInt(); -#endif -} - -int Manager::getVibrateType() const -{ - return m_vibrationKey.getBool(); -} -} // Profile -} // WrtDeviceApis diff --git a/src/modules/tizen/Profile/Manager.h b/src/modules/tizen/Profile/Manager.h deleted file mode 100644 index 2a2d304..0000000 --- a/src/modules/tizen/Profile/Manager.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_MANAGER_H_ -#define WRTDEVICEAPIS_PROFILE_MANAGER_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Profile { -class Manager : public Profile::Api::IManager -{ - public: - static Manager& getInstance(); - - public: - ~Manager(); - - /** - * @ release singleton resource while singleton deconstructor is not invoked. - */ - void Release() const; - - /** - * @see WrtPlugins::Profile::Api::IManager::getDesktop() - */ - Profile::Api::IDesktopPtr getDesktop(std::size_t index) const; - - /** - * @see WrtPlugins::Profile::Api::IManager::getDesktopsCount() - */ - std::size_t getDesktopCount() const; - - /** - * @see WrtPlugins::Profile::Api::IManager::getRingtone() - */ - Profile::Api::IRingtone* getRingtone(Profile::Api::RingtoneScope scope) - const; - - /** - * @see WrtPlugins::Profile::Api::IManager::getProfileType() - */ - Profile::Api::IManager::ProfileType getProfileType() const; - - /** - * @see WrtPlugins::Profile::Api::IManager::getSystemVolume() - */ - int getSystemVolume() const; - - int getVibrateType() const; - - // int getMsgAlertType() const; - - private: - typedef std::map Ringtones; - typedef std::map Desktops; - - private: - Manager(); - Profile::Api::IRingtone* getRingtone_(Profile::Api::RingtoneScope scope) - const; - - private: - mutable Ringtones m_ringtones; - mutable Desktops m_desktops; - VConf::Key m_profileKey; - VConf::Key m_volumeKey; - VConf::Key m_vibrationKey; -}; -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_MANAGER_H_ diff --git a/src/modules/tizen/Profile/Ringtone.cpp b/src/modules/tizen/Profile/Ringtone.cpp deleted file mode 100644 index d7cc549..0000000 --- a/src/modules/tizen/Profile/Ringtone.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Ringtone.h" -#include -#include - -namespace { -enum -{ - PLATFORM_VOLUME_LEVEL0 = 0, - PLATFORM_VOLUME_LEVEL1, - PLATFORM_VOLUME_LEVEL2, - PLATFORM_VOLUME_LEVEL3, - PLATFORM_VOLUME_LEVEL4, - PLATFORM_VOLUME_LEVEL5, - PLATFORM_VOLUME_LEVEL6, - PLATFORM_VOLUME_LEVEL7 -}; -} // anonymous - -namespace WrtDeviceApis { -namespace Profile { -Profile::Api::Volume Ringtone::getVolume() const -{ - double step = Profile::Api::VOLUME_MAX / - static_cast(PLATFORM_VOLUME_LEVEL7); - Haptics::Api::Feedback level = Profile::Api::NO_VOLUME + - (step * m_volumeKey.getInt()); - if (level > Profile::Api::VOLUME_MAX) { - level = Profile::Api::VOLUME_MAX; - } - return level; -} - -void Ringtone::setVolume(Profile::Api::Volume level) -{ - if (level > Profile::Api::VOLUME_MAX) { - level = Profile::Api::VOLUME_MAX; - } - - double step = Profile::Api::VOLUME_MAX / - static_cast(PLATFORM_VOLUME_LEVEL7); - for (int i = PLATFORM_VOLUME_LEVEL0; i <= PLATFORM_VOLUME_LEVEL7; ++i) { - if (level <= (i * step)) { - m_volumeKey.setValue(i); - break; - } - } -} - -Filesystem::Api::IPathPtr Ringtone::getAudio() const -{ - // TODO: probably not a full should be returned (maybe restricted to /mnt/ums) - return Filesystem::Api::IPath::create(m_audioKey.getString()); -} - -void Ringtone::setAudio(const Filesystem::Api::IPathPtr& path) -{ - // TODO: it should probably be converted some way - m_audioKey.setValue(path->getFullPath()); -} - -Haptics::Api::Feedback Ringtone::getHaptics() const -{ - double step = Haptics::Api::FEEDBACK_MAX / - static_cast(SETTING_VIB_FEEDBACK_LEVEL5); - Haptics::Api::Feedback level = Haptics::Api::NO_FEEDBACK + - (step * m_hapticsKey.getInt()); - if (level > Haptics::Api::FEEDBACK_MAX) { - level = Haptics::Api::FEEDBACK_MAX; - } - return level; -} - -void Ringtone::setHaptics(Haptics::Api::Feedback level) -{ - if (level > Haptics::Api::FEEDBACK_MAX) { - level = Haptics::Api::FEEDBACK_MAX; - } - - double step = Haptics::Api::FEEDBACK_MAX / - static_cast(SETTING_VIB_FEEDBACK_LEVEL5); - for (int i = SETTING_VIB_FEEDBACK_LEVEL0; - i <= SETTING_VIB_FEEDBACK_LEVEL5; - ++i) { - if (level <= (i * step)) { - m_hapticsKey.setValue(i); - break; - } - } -} - -Ringtone::Ringtone(Profile::Api::RingtoneScope scope) : - m_scope(scope) -{ - if (Profile::Api::RS_CALL == m_scope) { - m_volumeKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_CALL_VOLUME_INT); - m_hapticsKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_CALL_ALERT_VIB_INT); - m_audioKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_CALL_TONE_PATH_STR); - } else { - m_volumeKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_MSG_VOLUME_INT); - m_hapticsKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_MSG_ALERT_VIB_INT); - m_audioKey.reset(VCONFKEY_SETAPPL_PROFILE_CURRENT_MSG_TONE_PATH_STR); - } -} -} // Profile -} // WrtDeviceApis diff --git a/src/modules/tizen/Profile/Ringtone.h b/src/modules/tizen/Profile/Ringtone.h deleted file mode 100644 index ec2c185..0000000 --- a/src/modules/tizen/Profile/Ringtone.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) - */ - -#ifndef WRTDEVICEAPIS_PROFILE_RINGTONE_H_ -#define WRTDEVICEAPIS_PROFILE_RINGTONE_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Profile { -class Manager; - -class Ringtone : public Profile::Api::IRingtone -{ - friend class Manager; - - public: - /** - * @see WrtPlugins::IRingtone::Api::getVolume() - */ - Profile::Api::Volume getVolume() const; - - /** - * @see WrtPlugins::IRingtone::Api::setVolume() - */ - void setVolume(Profile::Api::Volume level); - - /** - * @see WrtPlugins::IRingtone::Api::getAudio() - */ - Filesystem::Api::IPathPtr getAudio() const; - - /** - * @see WrtPlugins::IRingtone::Api::setAudio() - */ - void setAudio(const Filesystem::Api::IPathPtr& path); - - /** - * @see WrtPlugins::IRingtone::Api::getHaptics() - */ - Haptics::Api::Feedback getHaptics() const; - - /** - * @see WrtPlugins::IRingtone::Api::setHaptics() - */ - void setHaptics(Haptics::Api::Feedback level); - - private: - explicit Ringtone(Profile::Api::RingtoneScope scope); - - private: - Profile::Api::RingtoneScope m_scope; - VConf::Key m_volumeKey; - VConf::Key m_hapticsKey; - VConf::Key m_audioKey; -}; -} // Profile -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_PROFILE_RINGTONE_H_ diff --git a/src/modules/tizen/Profile/config.cmake b/src/modules/tizen/Profile/config.cmake deleted file mode 100644 index 72557d6..0000000 --- a/src/modules/tizen/Profile/config.cmake +++ /dev/null @@ -1,32 +0,0 @@ -get_current_path() - -pkg_search_module(mmsound REQUIRED mm-sound) -pkg_search_module(mmplayer REQUIRED mm-player) -#pkg_search_module(mmtypes REQUIRED mm-types) -#pkg_search_module(mmerror REQUIRED mm-error) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_PROFILE - ${mmplayer_INCLUDE_DIRS} - ${mmsound_INCLUDE_DIRS} -# ${mmerror_INCLUDE_DIRS} -# ${mmtypes_INCLUDE_DIRS} - ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_PROFILE - ${mmplayer_LIBRARIES} - ${mmsound_LIBRARIES} -# ${mmtypes_LIBRARIES} -# ${mmerror_LIBRARIES} - ${LIBS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_PROFILE - ${CURRENT_PATH}/Manager.cpp - ${CURRENT_PATH}/Desktop.cpp - ${CURRENT_PATH}/Ringtone.cpp - ${SRCS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) diff --git a/src/modules/tizen/Radio/Manager.cpp b/src/modules/tizen/Radio/Manager.cpp deleted file mode 100644 index 017cc83..0000000 --- a/src/modules/tizen/Radio/Manager.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#include "Manager.h" -#include -#include "Source.h" -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Radio { -Manager& Manager::getInstance() -{ - static Manager instance; - return instance; -} - -Manager::~Manager() -{ - delete m_source; -} - -bool Manager::isEnabled() const -{ - Try { - switch (m_serviceType.getInt()) { - case VCONFKEY_TELEPHONY_SVCTYPE_NONE: - case VCONFKEY_TELEPHONY_SVCTYPE_NOSVC: - case VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY: - case VCONFKEY_TELEPHONY_SVCTYPE_SEARCH: - return false; - case VCONFKEY_TELEPHONY_SVCTYPE_2G: - case VCONFKEY_TELEPHONY_SVCTYPE_2_5G: - case VCONFKEY_TELEPHONY_SVCTYPE_2_5G_EDGE: - case VCONFKEY_TELEPHONY_SVCTYPE_3G: - case VCONFKEY_TELEPHONY_SVCTYPE_HSDPA: - return true; - default: - return false; - } - } - Catch(Commons::ConversionException) { - ReThrow(Commons::PlatformException); - } -} - -bool Manager::isRoaming() const -{ - Try { - return (m_roam.getInt() == VCONFKEY_TELEPHONY_SVC_ROAM_ON); - } - Catch(Commons::ConversionException) { - ReThrow(Commons::PlatformException); - } -} - -Api::ISource* Manager::getSource() const -{ - return m_source; -} - -Api::Strength Manager::getSignalStrength() const -{ - if (VCONFKEY_TELEPHONY_RSSI_6 == 0) { - ThrowMsg(Commons::PlatformException, "Division by zero."); - } - Try { - return 100 * m_rssi.getInt() / - static_cast(VCONFKEY_TELEPHONY_RSSI_6); - } - Catch(Commons::ConversionException) { - ReThrow(Commons::PlatformException); - } -} - -std::string Manager::getMcc() const -{ - char* mcc = NULL; - - if (network_info_get_mcc(&mcc) == NETWORK_INFO_ERROR_NONE) { - LogDebug("Mobile Country Code : " << mcc); - - std::string strMcc(mcc); - free(mcc); - - return strMcc; - } - - return ""; -} - -std::string Manager::getMnc() const -{ - char* mnc = NULL; - - if (network_info_get_mnc(&mnc) == NETWORK_INFO_ERROR_NONE) { - LogDebug("Mobile Network Code : " << mnc); - - std::string strMnc(mnc); - free(mnc); - - return strMnc; - } - - return ""; -} - -bool Manager::isHardwareOn() const -{ - int status = false; - - if (tel_check_service_ready(&status) == TAPI_API_SUCCESS) - { - if(status) return true; - } - - return false; -} - -Manager::Manager() : - m_rssi(VCONFKEY_TELEPHONY_RSSI), - m_roam(VCONFKEY_TELEPHONY_SVC_ROAM), - m_serviceType(VCONFKEY_TELEPHONY_SVCTYPE), - m_source(new Source()) -{ -} -} // Radio -} // WrtDeviceApis diff --git a/src/modules/tizen/Radio/Manager.h b/src/modules/tizen/Radio/Manager.h deleted file mode 100644 index 0b61f5e..0000000 --- a/src/modules/tizen/Radio/Manager.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_MANAGER_H_ -#define WRTDEVICEAPIS_RADIO_MANAGER_H_ - -#include -#include - -namespace WrtDeviceApis { -namespace Radio { -class Manager : public Api::IManager -{ - public: - static Manager& getInstance(); - - public: - ~Manager(); - - /** - * @see Api::IManager::isEnabled() - */ - bool isEnabled() const; - - /** - * @see Api::IManager::isRoaming() - */ - bool isRoaming() const; - - /** - * @see Api::IManager::getSource() - */ - Api::ISource* getSource() const; - - /** - * @see Api::IManager::getSignalStrength() - */ - Api::Strength getSignalStrength() const; - - /** - * @see Api::IManager::getMcc() - */ - std::string getMcc() const; - - /** - * @see Api::IManager::getMnc() - */ - std::string getMnc() const; - - /** - * @see Api::IManager::isHardwareOn() - */ - bool isHardwareOn() const; - - protected: - Manager(); - - private: - VConf::Key m_rssi; - VConf::Key m_roam; - VConf::Key m_serviceType; - Api::ISource* m_source; -}; -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_RADIO_MANAGER_H_ diff --git a/src/modules/tizen/Radio/Source.cpp b/src/modules/tizen/Radio/Source.cpp deleted file mode 100644 index e171d18..0000000 --- a/src/modules/tizen/Radio/Source.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#include "Source.h" -#include - -namespace WrtDeviceApis { -namespace Radio { -bool Source::isConnected() const -{ - return (m_serviceType.getInt() > VCONFKEY_TELEPHONY_SVCTYPE_SEARCH); -} - -Api::SourceType Source::getType() const -{ - Try { - switch (m_serviceType.getInt()) { - case VCONFKEY_TELEPHONY_SVCTYPE_2G: - case VCONFKEY_TELEPHONY_SVCTYPE_2_5G: - case VCONFKEY_TELEPHONY_SVCTYPE_2_5G_EDGE: - return Api::ST_GSM; - case VCONFKEY_TELEPHONY_SVCTYPE_3G: - case VCONFKEY_TELEPHONY_SVCTYPE_HSDPA: - return Api::ST_WCDMA; - default: - return Api::ST_UNKNOWN; - } - } - Catch(Commons::ConversionException) { - ReThrow(Commons::PlatformException); - } -} - -void Source::addOnTypeChange( - const Api::EventSourceTypeChangeEmitterPtr& emitter) -{ - m_onSourceTypeChange.attach(emitter); - SourceTypeChangeEmitters::LockType lock = m_onSourceTypeChange.getLock(); - if (m_onSourceTypeChange.size() == 1) { - m_serviceType.attachCallback(onTypeChange, this); - } -} - -void Source::removeOnTypeChange( - Api::EventSourceTypeChangeEmitter::IdType id) -{ - m_onSourceTypeChange.detach(id); - SourceTypeChangeEmitters::LockType lock = m_onSourceTypeChange.getLock(); - if (m_onSourceTypeChange.size() == 0) { - m_serviceType.detachCallback(); - } -} - -Source::Source() : - m_serviceType(VCONFKEY_TELEPHONY_SVCTYPE) -{ -} - -void Source::onTypeChange(const VConf::Node* /* node */, - void* data) -{ - Source* this_ = static_cast(data); - if (this_) { - Api::EventSourceTypeChangePtr event( - new Api::EventSourceTypeChange()); - Try { - event->setType(this_->getType()); - } - Catch(Commons::PlatformException) { - event->setExceptionCode(Commons::ExceptionCodes::PlatformException); - } - this_->m_onSourceTypeChange.emit(event); - } -} -} // Radio -} // WrtDeviceApis diff --git a/src/modules/tizen/Radio/Source.h b/src/modules/tizen/Radio/Source.h deleted file mode 100644 index f4be9dd..0000000 --- a/src/modules/tizen/Radio/Source.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Zbigniew Kostrzewa - */ - -#ifndef WRTDEVICEAPIS_RADIO_SOURCE_H_ -#define WRTDEVICEAPIS_RADIO_SOURCE_H_ - -#include -#include -#include - -namespace WrtDeviceApis { -namespace Radio { -class Manager; - -class Source : public Api::ISource -{ - friend class Manager; - - public: - /** - * @see WrtDeviceApis::Radio::Api::ISource::isConnected() - */ - bool isConnected() const; - - /** - * @see WrtDeviceApis::Radio::Api::ISource::getType() - */ - Api::SourceType getType() const; - - /** - * @see WrtDeviceApis::Radio::Api::ISource::addOnTypeChange() - */ - void addOnTypeChange( - const Api::EventSourceTypeChangeEmitterPtr& emitter); - - /** - * @see WrtDeviceApis::Radio::Api::ISource::removeOnTypeChange() - */ - void removeOnTypeChange(Api::EventSourceTypeChangeEmitter::IdType id); - - protected: - typedef Commons::Emitters - SourceTypeChangeEmitters; - - protected: - Source(); - - private: - /** - * Callback method called by platform when service type changes. - * @param key Vconf key object. - * @param data User data. - */ - static void onTypeChange(const VConf::Node* node, - void* data); - - private: - VConf::Key m_serviceType; - SourceTypeChangeEmitters m_onSourceTypeChange; -}; -} // Radio -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_RADIO_SOURCE_H_ diff --git a/src/modules/tizen/Radio/config.cmake b/src/modules/tizen/Radio/config.cmake deleted file mode 100644 index 171bcb1..0000000 --- a/src/modules/tizen/Radio/config.cmake +++ /dev/null @@ -1,25 +0,0 @@ -get_current_path() - -pkg_search_module(capi-telephony-network-info REQUIRED capi-telephony-network-info) -pkg_search_module(tapi REQUIRED tapi) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_RADIO - ${INCLUDES_PLATFORM_IMPLEMENTATION_VCONF} - ${capi-telephony-network-info_INCLUDE_DIRS} - ${tapi_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_RADIO - ${LIBS_PLATFORM_IMPLEMENTATION_VCONF} - ${capi-telephony-network-info_LIBRARIES} - ${tapi_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_RADIO - ${CURRENT_PATH}/Manager.cpp - ${CURRENT_PATH}/Source.cpp - ${SRCS_PLATFORM_IMPLEMENTATION_VCONF} - PARENT_SCOPE -) diff --git a/src/modules/tizen/SystemInfo/SystemInfo.cpp b/src/modules/tizen/SystemInfo/SystemInfo.cpp deleted file mode 100755 index 7a811fe..0000000 --- a/src/modules/tizen/SystemInfo/SystemInfo.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Taejeong Lee - */ - -#include "SystemInfo.h" -#include -#include - -extern "C" { -#include -#include -} - -#define DEVICE_INFO_PATH "/etc/info.ini" - -namespace WrtDeviceApis { -namespace SystemInfo { -SystemInfo& SystemInfo::getInstance() -{ - static SystemInfo instance; - return instance; -} - -SystemInfo::~SystemInfo() -{ -} - -SystemInfo::SystemInfo() -{ -} - -string SystemInfo::getDeviceModelName() -{ - // copied from settings-beat package - char szBin[50]; - char szEmul[50]; - - const char* szBinVer = NULL; - - dictionary* dic = iniparser_load(DEVICE_INFO_PATH); - if (dic) { - szBinVer = (char*)iniparser_getstr(dic, "Version:Build"); - if (szBinVer) { - char* str = strdup(szBinVer); - if (str) { - char* pPos = str; - while (*pPos++) { - if ('_' == *pPos) - *pPos = ' '; - } - sscanf(str, "%s %s", szBin, szEmul); - } - free(str); - } - } - - if (dic) { - iniparser_freedict(dic); - dic = NULL; - } - - if (!strncmp(szEmul, "emul", 4)) { - return string("SDK"); - } else { - return string(string("GT-")+string(szBin)); - } -} - -string SystemInfo::getDeviceVersion() -{ - // copied from settings-beat package - string result; - - dictionary* dic = iniparser_load(DEVICE_INFO_PATH); - if (dic == NULL) { - result = gettext("IDS_ST_HEADER_UNAVAILABLE"); - } else { - char* szBinVer = - strdup((char*)iniparser_getstr(dic, "Version:Build")); - char* pPos = szBinVer; - while(*pPos++) { - if ('.' == *pPos) *pPos = '\0'; - } - - result = string("Tizen") + - string((char*)iniparser_getstr(dic, "Version:Major")) + - string(".") + - string((char*)iniparser_getstr(dic, "Version:Minor")) + - string(" (") + string(szBinVer) + string(")"); - - free(szBinVer); - } - - if (dic) { - iniparser_freedict(dic); - dic = NULL; - } - - return result; -} - -} // SystemInfo -} // WrtDeviceApis diff --git a/src/modules/tizen/SystemInfo/SystemInfo.h b/src/modules/tizen/SystemInfo/SystemInfo.h deleted file mode 100644 index 41bfd70..0000000 --- a/src/modules/tizen/SystemInfo/SystemInfo.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @author Taejeong Lee - */ - -#ifndef WRTDEVICEAPIS_SYSTEMINFO_H_ -#define WRTDEVICEAPIS_SYSTEMINFO_H_ - -#include -#include - -using namespace std; - -namespace WrtDeviceApis { -namespace SystemInfo { -class SystemInfo : public Api::ISystemInfo -{ - public: - static SystemInfo& getInstance(); - - public: - ~SystemInfo(); - string getDeviceModelName(); - string getDeviceVersion(); - - protected: - SystemInfo(); - - private: -}; -} // SystemInfo -} // WrtDeviceApis - -#endif // WRTDEVICEAPIS_SYSTEMINFO_H_ diff --git a/src/modules/tizen/SystemInfo/config.cmake b/src/modules/tizen/SystemInfo/config.cmake deleted file mode 100644 index 9c4fdbd..0000000 --- a/src/modules/tizen/SystemInfo/config.cmake +++ /dev/null @@ -1,21 +0,0 @@ -get_current_path() - -pkg_search_module(iniparser REQUIRED iniparser) -#pkg_search_module(appcore-efl REQUIRED appcore-efl) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_SYSTEMINFO - ${iniparser_INCLUDE_DIRS} - ${appcore-efl_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_SYSTEMINFO - ${iniparser_LIBRARIES} - ${appcore-efl_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_SYSTEMINFO - ${CURRENT_PATH}/SystemInfo.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/Task/Task.cpp b/src/modules/tizen/Task/Task.cpp deleted file mode 100644 index 68dd15f..0000000 --- a/src/modules/tizen/Task/Task.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Task.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include "Task.h" -#include -#include -#include -#include -#include "TaskManager.h" - -namespace WrtDeviceApis { -namespace Task { - -using namespace Api; - -Task::Task() -{ - LogDebug("entered"); -} - -Task::~Task() -{ - LogDebug("entered"); -} - -void Task::OnRequestReceived(const IEventAddTaskPtr &task) -{ - LogDebug("entered"); - Try - { - if (!task->getTask()) { - ThrowMsg(Commons::NullPointerException, "task parameter is NULL"); - } - if (task->getTask()->getId() != CalendarTask::UNDEFINED_TASK_ID) { - LogWarning("adding task that is already added"); - task->getTask()->setId(CalendarTask::UNDEFINED_TASK_ID); - } - TaskWrapperPtr taskWrapper(new TaskWrapper(task->getTask())); - taskWrapper->convertAbstractTaskToPlatformTask(); - if (task->checkCancelled()) { - task->setCancelAllowed(true); - task->setResult(true); - return; - } - taskWrapper->saveTask(); - task->setResult(true); - } - catch (const Commons::Exception &ex) - { - LogError("Error during adding task" << ex.DumpToString()); - task->setResult(false); - } - task->setCancelAllowed(false); -} - -void Task::OnRequestReceived(const IEventDeleteTaskPtr &task) -{ - LogDebug("entered"); - Try - { - if (!task->getTask()) { - ThrowMsg(Commons::NullPointerException, "task parameter is NULL"); - } - if (task->getTask()->getId() == CalendarTask::UNDEFINED_TASK_ID) { - ThrowMsg(Commons::InvalidArgumentException, - "Cannot delete non-existing task."); - } - DPL::ScopedPtr taskWrapper(new TaskWrapper(task->getTask())); - taskWrapper->convertAbstractTaskToPlatformTask(); - if (task->checkCancelled()) { - task->setCancelAllowed(true); - task->setResult(true); - return; - } - taskWrapper->deleteTask(); - task->setResult(true); - } - catch (const Commons::Exception &ex) - { - LogError("Error during deleting task " << ex.DumpToString()); - task->setResult(false); - } - task->setCancelAllowed(false); -} - -void Task::OnRequestReceived(const IEventUpdateTaskPtr &task) -{ - LogDebug("entered"); - Try - { - if (!task->getTask()) { - ThrowMsg(Commons::NullPointerException, "task parameter is NULL"); - } - if (task->getTask()->getId() == CalendarTask::UNDEFINED_TASK_ID) { - ThrowMsg( - Commons::InvalidArgumentException, - "Cannot update non-existing task. Task needs adding or ID is wrong"); - } - TaskWrapperPtr taskWrapper(new TaskWrapper(task->getTask())); - taskWrapper->convertAbstractTaskToPlatformTask(); - if (task->checkCancelled()) { - task->setCancelAllowed(true); - task->setResult(true); - return; - } - taskWrapper->saveTask(); - task->setResult(true); - } - catch (const Commons::Exception &ex) - { - LogError("Error during updating task " << ex.DumpToString()); - task->setResult(false); - } - task->setCancelAllowed(false); -} - -void Task::OnRequestReceived(const IEventFindTasksPtr &task) -{ - LogDebug("entered"); - const TaskFilterPtr &filter = task->getFilter(); - cal_struct *platformTask = NULL; - cal_iter *iter = NULL; - int foundCnt = 0; - task->setResult(true); - - try { - if (CAL_SUCCESS != - calendar_svc_get_all(0, 0, CAL_STRUCT_TODO, &iter)) { - ThrowMsg(Commons::PlatformException, "Can't get all records"); - } - //TODO: currently platform starts iteration with below function - // It's possible that current approach will change to be familiar with std iterators - - while (CAL_SUCCESS == calendar_svc_iter_next(iter)) { - task->tryCancelled(); - if (CAL_SUCCESS != - calendar_svc_iter_get_info(iter, &platformTask)) { - ThrowMsg(Commons::PlatformException, "Can't get task info."); - } - //getting ID - int eventId = calendar_svc_struct_get_int(platformTask, - CAL_VALUE_INT_INDEX); - if (CAL_SUCCESS != calendar_svc_struct_free(&platformTask)) { - LogError("Can't free calendar task struct."); - } - - TaskWrapperPtr taskWrapper(new TaskWrapper()); - taskWrapper->loadTask(eventId); - if (!filter || taskWrapper->matchFilters(filter)) { - if (foundCnt >= task->getFirstTask() && - (task->getLastTask() == -1 || foundCnt <= - task->getLastTask())) { - task->addTask(taskWrapper->getAbstractTask()); - } - foundCnt++; - } - } - } - catch (const Commons::Exception &ex) - { - LogError("Exception: " << ex.DumpToString()); - task->setResult(false); - } - //According to example in calendar-svc-provider.h it's not needed to pass here - //iter set on first element - calendar_svc_iter_remove(&iter); - task->setCancelAllowed(true); -} - -void Task::OnRequestReceived(const IEventCreateTaskPtr &task) -{ - LogDebug("entered"); - Try - { - CalendarTaskPtr result(new CalendarTask()); - task->setResult(result.Get() != NULL); - task->setTask(result); - } - catch (const Commons::Exception &ex) - { - LogError("Error during creating an task " << ex.DumpToString()); - task->setResult(false); - } -} -} -} - diff --git a/src/modules/tizen/Task/Task.h b/src/modules/tizen/Task/Task.h deleted file mode 100644 index f4d0c24..0000000 --- a/src/modules/tizen/Task/Task.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file Task.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_TASK_H_ -#define WRTDEVICEAPIS_TASK_TASK_H_ - -#include -#include "Task/ITask.h" -#include "TaskWrapper.h" - -namespace WrtDeviceApis { -namespace Task { - -class Task : public Api::ITask -{ - public: - Task(); - virtual ~Task(); - protected: - virtual void OnRequestReceived(const Api::IEventAddTaskPtr &task); - virtual void OnRequestReceived(const Api::IEventDeleteTaskPtr &task); - virtual void OnRequestReceived(const Api::IEventUpdateTaskPtr &task); - virtual void OnRequestReceived(const Api::IEventFindTasksPtr &task); - virtual void OnRequestReceived(const Api::IEventCreateTaskPtr &task); -}; -} -} - -#endif // WRTDEVICEAPIS_TASK_TASK_H_ diff --git a/src/modules/tizen/Task/TaskManager.cpp b/src/modules/tizen/Task/TaskManager.cpp deleted file mode 100644 index 3a92ccc..0000000 --- a/src/modules/tizen/Task/TaskManager.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskManager.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @author Wojciech Bielawski (w.bielawski@samsung.com) - * @version 0.1 - */ - -#include "TaskManager.h" - -#include -#include -#include -#include - -namespace { -const int ID_ALL_ACCOUNTS = 0; -const int TASK_ID = 1; -const char* SERVICE_PROVIDER_NAME = "phone"; -const char* TASK_NAME = "test"; -} - -namespace WrtDeviceApis { -namespace Task { - -using namespace Api; - -int TaskManager::m_instanceCount = 0; - -TaskManager::TaskManager() -{ - LogDebug("entered"); - /* wac platform doesn't support calendar manager. - * This implementation have to implement it on its own. - * One calendar have to be created and stored for further use. - */ - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - if (m_instanceCount == 0) { - LogDebug("opening calendar DB"); - if (CAL_SUCCESS != calendar_svc_connect()) { - ThrowMsg(Commons::PlatformException, - "Calendar DB initialization failed"); - } - } - m_instanceCount++; -} - -TaskManager::~TaskManager() -{ - LogDebug("entered"); - DPL::Mutex::ScopedLock mx(&m_constructorMutex); - m_instanceCount--; - if (m_instanceCount == 0) { - LogDebug("closing calendar DB"); - if (CAL_SUCCESS != calendar_svc_close()) { - LogError("Calendar database not clearly closed."); - } - } -} - -int TaskManager::getAccountId() -{ - return ID_ALL_ACCOUNTS; -} - -const char *TaskManager::getServiceProviderName() -{ - return SERVICE_PROVIDER_NAME; -} - -std::list TaskManager::getTasksInternal() -{ - LogDebug("entered"); - std::list result; - ITaskPtr defaultTask(new Task()); - defaultTask->setName(TASK_NAME); - defaultTask->setId(TASK_ID); - defaultTask->setAccountId(ID_ALL_ACCOUNTS); - defaultTask->setType(Task::DEVICE_TASK); - result.push_back(defaultTask); - return result; -} - -void TaskManager::OnRequestReceived(const IEventGetTasksPtr &task) -{ - Try - { - const std::list &result = getTasksInternal(); - task->tryCancelled(); - task->setResult(true); - std::list::const_iterator it = result.begin(), end = - result.end(); - for (; it != end; ++it) { - task->addTask(*it); - } - } - Catch(Commons::EventCancelledException) - { - //revert changes if any - } - task->setCancelAllowed(true); -} -} -} diff --git a/src/modules/tizen/Task/TaskManager.h b/src/modules/tizen/Task/TaskManager.h deleted file mode 100644 index 328d417..0000000 --- a/src/modules/tizen/Task/TaskManager.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskManager.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_TASKMANAGER_H_ -#define WRTDEVICEAPIS_TASK_TASKMANAGER_H_ - -#include -#include -#include -#include -#include "Task.h" - -namespace WrtDeviceApis { -namespace Task { - -class TaskManager : public Api::ITaskManager -{ - public: - TaskManager(); - virtual ~TaskManager(); - static int getAccountId(); - static const char* getServiceProviderName(); - protected: - std::list getTasksInternal(); - virtual void OnRequestReceived(const Api::IEventGetTasksPtr &task); - - private: - static int m_instanceCount; - DPL::Mutex m_constructorMutex; -}; - -} -} - -#endif // WRTDEVICEAPIS_TASK_TASKMANAGER_H_ diff --git a/src/modules/tizen/Task/TaskWrapper.cpp b/src/modules/tizen/Task/TaskWrapper.cpp deleted file mode 100644 index d20fb90..0000000 --- a/src/modules/tizen/Task/TaskWrapper.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskWrapper.cpp - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#include -#include -#include -#include -#include "TaskWrapper.h" -#include "Task.h" - -#define LOCAL_DEBUG_MODE 1 - -namespace WrtDeviceApis { -namespace Task { - -using namespace Api; - -TaskWrapper::TaskWrapper() : - m_platformTask(NULL), - m_abstractTask(NULL) -{ - LogDebug("entered"); - m_abstractTask = CalendarTaskPtr(new CalendarTask()); - if (!m_abstractTask) { - ThrowMsg(Commons::UnknownException, "abstract object is not created"); - } -} - -TaskWrapper::TaskWrapper(const CalendarTaskPtr &task) : - m_platformTask(NULL), - m_abstractTask(task) -{ - LogDebug("entered"); -} - -TaskWrapper::~TaskWrapper() -{ - LogDebug("entered"); - freePlatformTask(); -} - -int TaskWrapper::getIDFromPlatformTask() const -{ - LogDebug("Entered"); - if (m_platformTask == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformTask is not set"); - } - - return calendar_svc_struct_get_int(m_platformTask, CAL_VALUE_INT_INDEX); -} - -int TaskWrapper::getStatusFromPlatformTask() const -{ - LogDebug("Entered"); - if (m_platformTask == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformTask is not set"); - } - - return calendar_svc_struct_get_int(m_platformTask, - CAL_VALUE_INT_TASK_STATUS); -} - -int TaskWrapper::getPriorityFromPlatformTask() const -{ - LogDebug("Entered"); - if (m_platformTask == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformTask is not set"); - } - - return calendar_svc_struct_get_int(m_platformTask, CAL_VALUE_INT_PRIORITY); -} -void TaskWrapper::saveTask() -{ - LogDebug("entered"); - //Check if platform struct is set. - //It could be set here, but forcing user to do it manually can help to avoid problems. - if (m_platformTask == NULL) { - ThrowMsg(Commons::NullPointerException, "m_platformTask is not set"); - } - - int taskID = getIDFromPlatformTask(); - LogDebug("taskID: " << taskID); - bool newEvent = (taskID == CalendarTask::UNDEFINED_TASK_ID); - - displayPlatformTask(); - - //insert new record or update existing one - if (newEvent) { //insert new task - int returnValue = calendar_svc_insert(m_platformTask); - if (CAL_SUCCESS > returnValue) { - LogError("Can't insert new task, error code: " << returnValue); - ThrowMsg(Commons::PlatformException, "Can't insert new task."); - } - m_abstractTask->setId(returnValue); - LogInfo("New calendar task inserted"); - } else { //update - if (CAL_SUCCESS != calendar_svc_update(m_platformTask)) { - ThrowMsg(Commons::PlatformException, "Can't update new task."); - } - LogDebug("Calendar task updated"); - } -} - -void TaskWrapper::loadTask(int id) -{ - LogDebug("Entered. ID of task to load: " << id); - freePlatformTask(); - int errorCode = calendar_svc_get(CAL_STRUCT_TODO, id, NULL, &m_platformTask); - if (CAL_SUCCESS > errorCode) { - LogError( - "Can't get task with ID = " << id << ", error code: " << - errorCode); - ThrowMsg( - Commons::PlatformException, - "Can't get task with ID = " << id << ", error code: " << - errorCode); - } - convertPlatformTaskToAbstractTask(); - displayAbstractTask(); -} - -bool TaskWrapper::matchFilters(TaskFilterPtr filter) -{ - LogDebug("Entered"); - if (!filter) { - return true; - } - if (!m_abstractTask) { - ThrowMsg(Commons::NullPointerException, - "abstractEvent object is not set"); - } - - LogDebug("---new task to match---"); - m_abstractTask->display(); - - if (filter->getIdIsSet()) { - if (m_abstractTask->getId() != filter->getIdFilter()) { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by id " << filter->getIdFilter()); -#endif - return false; - } - } - if (filter->getTaskIdIsSet()) { - if (m_abstractTask->getTaskId() != filter->getTaskIdFilter()) { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by calendar id " << filter->getTaskIdFilter()); -#endif - return false; - } - } - if (filter->getDescriptionIsSet()) { - if (!pcrecpp::RE(filter->getDescriptionFilter()).FullMatch( - m_abstractTask->getDescription())) { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by description " << filter->getDescriptionFilter()); -#endif - return false; - } - } - if (filter->getSubjectIsSet()) { - if (!pcrecpp::RE(filter->getSubjectFilter()).FullMatch(m_abstractTask-> - getSubject())) - { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by subject " << filter->getSubjectFilter()); -#endif - return false; - } - } - if (filter->getDueDateIsSet()) { - if ((m_abstractTask->getDueDateIsSet() == false) || - (filter->getDueDateMinFilter() != -1 && - m_abstractTask->getDueDate() < filter->getDueDateMinFilter()) || - (filter->getDueDateMaxFilter() != -1 && - m_abstractTask->getDueDate() > filter->getDueDateMaxFilter())) { -#ifdef LOCAL_DEBUG_MODE - LogDebug( - "rejected by start time min " << filter->getDueDateMinFilter()); - LogDebug( - "rejected by start time max " << filter->getDueDateMaxFilter()); - LogDebug("due date " << m_abstractTask->getDueDate()); -#endif - return false; - } - } - - if (filter->getStatusIsSet()) { - StatusList statusList = *(filter->getStatusFilter()); - StatusList::const_iterator it = statusList.begin(), end = - statusList.end(); - for (; it != end; ++it) { - if (m_abstractTask->getStatus() == *it) { - break; - } - } - if (it == end) { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by status "); -#endif - return false; - } - } - - if (filter->getPriorityIsSet()) { - PriorityList priorityList = *(filter->getPriorityFilter()); - PriorityList::const_iterator it = priorityList.begin(), end = - priorityList.end(); - for (; it != end; ++it) { - if (m_abstractTask->getPriority() == *it) { - break; - } - } - if (it == end) { -#ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by priority "); -#endif - return false; - } - } - /* - if (filter->getPriorityIsSet()) { - if (m_abstractTask->getPriority() != filter->getPriorityFilter()) { - #ifdef LOCAL_DEBUG_MODE - LogDebug("rejected by priority " << filter->getPriorityFilter() ); - #endif - return false; - } - } - */ - return true; -} - -void TaskWrapper::deleteTask() -{ - LogDebug("entered"); - if (m_platformTask == NULL) { - ThrowMsg(Commons::NullPointerException, - "Failed to delete task in calendar (m_platformTask==NULL)"); - } - int taskID = getIDFromPlatformTask(); - LogDebug("taskID: " << taskID); - if (taskID == CalendarTask::UNDEFINED_TASK_ID) { - ThrowMsg( - Commons::InvalidArgumentException, - "Failed to delete task in calendar (task is not saved in calendar)"); - } - if (CAL_SUCCESS != calendar_svc_delete(CAL_STRUCT_TODO, taskID)) { - ThrowMsg(Commons::PlatformException, "Can't delete calendar task."); - } - - m_abstractTask->setId(CalendarTask::UNDEFINED_TASK_ID); - setIDToPlatformTask(); -} - -cal_struct *TaskWrapper::getPlatformTask() const -{ - return m_platformTask; -} - -CalendarTaskPtr TaskWrapper::getAbstractTask() const -{ - return m_abstractTask; -} - -void TaskWrapper::freePlatformTask() -{ - LogDebug("entered"); - if (m_platformTask != NULL) { - if (CAL_SUCCESS != calendar_svc_struct_free(&m_platformTask)) { - LogError("Can't free calendar task struct."); - } - m_platformTask = NULL; - } -} - -cal_struct *TaskWrapper::convertAbstractTaskToPlatformTask() -{ - LogDebug("entered"); - freePlatformTask(); - m_platformTask = calendar_svc_struct_new(CAL_STRUCT_TODO); - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "cannot create platform task"); - } - setDescriptionToPlatformTask(); - setSubjectToPlatformTask(); - setDueDateToPlatformTask(); - setStatusToPlatformTask(); - setPriorityToPlatformTask(); - setIDToPlatformTask(); - return getPlatformTask(); -} - -void TaskWrapper::setDescriptionToPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformTask, - CAL_VALUE_TXT_DESCRIPTION, - m_abstractTask-> - getDescription().c_str())) - { - ThrowMsg(Commons::PlatformException, "Can't set task description."); - } -} - -void TaskWrapper::setSubjectToPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_str(m_platformTask, - CAL_VALUE_TXT_SUMMARY, - m_abstractTask->getSubject() - .c_str())) { - ThrowMsg(Commons::PlatformException, "Can't set task subject."); - } -} - -void TaskWrapper::setDueDateToPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - if (m_abstractTask->getDueDateIsSet() == true) { - time_t time = m_abstractTask->getDueDate(); - - if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformTask, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT, - time)) { - ThrowMsg(Commons::PlatformException, "Can't set task due time."); - } - if (CAL_SUCCESS != calendar_svc_struct_set_time(m_platformTask, - CAL_VALUE_GMT_START_DATE_TIME, - CAL_TZ_FLAG_GMT, - time)) { - ThrowMsg(Commons::PlatformException, "Can't set task due time."); - } - } -} - -void TaskWrapper::setStatusToPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformTask, - CAL_VALUE_INT_TASK_STATUS, - m_abstractTask->getStatus())) - { - ThrowMsg(Commons::PlatformException, "Can't set task Status."); - } -} -void TaskWrapper::setPriorityToPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - - if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformTask, - CAL_VALUE_INT_PRIORITY, - m_abstractTask->getPriority())) - { - ThrowMsg(Commons::PlatformException, "Can't set task Priority."); - } -} - -void TaskWrapper::setIDToPlatformTask() -{ - if (m_abstractTask->getIdIsSet()) { - if (CAL_SUCCESS != calendar_svc_struct_set_int(m_platformTask, - CAL_VALUE_INT_INDEX, - m_abstractTask->getId())) - { - ThrowMsg(Commons::PlatformException, "Can't set task ID."); - } - } -} - -CalendarTaskPtr TaskWrapper::convertPlatformTaskToAbstractTask() -{ - LogDebug("entered"); - setDescriptionFromPlatformTask(); - setSubjectFromPlatformTask(); - setDueDateFromPlatformTask(); - setStatusFromPlatformTask(); - setPriorityFromPlatformTask(); - setIDFromPlatformTask(); - return getAbstractTask(); -} - -void TaskWrapper::setDescriptionFromPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - const char *description = calendar_svc_struct_get_str( - m_platformTask, - CAL_VALUE_TXT_DESCRIPTION); - if (description) { - m_abstractTask->setDescription(description); - } -} - -void TaskWrapper::setSubjectFromPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - const char *summary = calendar_svc_struct_get_str(m_platformTask, - CAL_VALUE_TXT_SUMMARY); - if (summary) { - m_abstractTask->setSubject(summary); - } -} - -void TaskWrapper::setDueDateFromPlatformTask() -{ - if (!m_platformTask) { - ThrowMsg(Commons::UnknownException, "Null platform pointer."); - } - time_t dueDate = calendar_svc_struct_get_time(m_platformTask, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT); - - struct tm *tminfo = localtime(&dueDate); - if (tminfo->tm_year != PLATFORM_UNSUPPORTED_DATE_YEAR) { - m_abstractTask->setDueDate(dueDate); - } -} - -void TaskWrapper::setStatusFromPlatformTask() -{ - m_abstractTask->setStatus( - (CalendarTask::TaskStatus)getStatusFromPlatformTask()); -} -void TaskWrapper::setPriorityFromPlatformTask() -{ - m_abstractTask->setPriority( - (CalendarTask::TaskPriority)getPriorityFromPlatformTask()); -} - -void TaskWrapper::setIDFromPlatformTask() -{ - m_abstractTask->setId(getIDFromPlatformTask()); -} - -void TaskWrapper::displayAbstractTask() -{ - m_abstractTask->display(); -} - -void TaskWrapper::displayPlatformTask() -{ - LogDebug("task id: " << - calendar_svc_struct_get_int(m_platformTask, CAL_VALUE_INT_INDEX)); - LogDebug("task due time: " << - calendar_svc_struct_get_time(m_platformTask, - CAL_VALUE_GMT_END_DATE_TIME, - CAL_TZ_FLAG_GMT)); - LogDebug("task summary: " << - calendar_svc_struct_get_str(m_platformTask, CAL_VALUE_TXT_SUMMARY)); - LogDebug("task description: " << - calendar_svc_struct_get_str(m_platformTask, - CAL_VALUE_TXT_DESCRIPTION)); - LogDebug("task priority: " << - calendar_svc_struct_get_str(m_platformTask, CAL_VALUE_INT_PRIORITY)); - LogDebug("task status: " << - calendar_svc_struct_get_str(m_platformTask, - CAL_VALUE_INT_TASK_STATUS)); -} -} -} diff --git a/src/modules/tizen/Task/TaskWrapper.h b/src/modules/tizen/Task/TaskWrapper.h deleted file mode 100644 index 65aa7c5..0000000 --- a/src/modules/tizen/Task/TaskWrapper.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file TaskWrapper.h - * @author Shi Hezhang (hezhang.shi@samsung.com) - * @author Pan Rui (r.pan@samsung.com) - * @version 0.1 - */ - -#ifndef WRTDEVICEAPIS_TASK_TASK_WRAPPER_H_ -#define WRTDEVICEAPIS_TASK_TASK_WRAPPER_H_ - -#include -#include -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace Task { - -const int PLATFORM_UNSUPPORTED_DATE_YEAR = 69; - -class TaskWrapper -{ - public: - TaskWrapper(); - explicit TaskWrapper(const Api::CalendarTaskPtr &task); - virtual ~TaskWrapper(); - cal_struct *convertAbstractTaskToPlatformTask(); - Api::CalendarTaskPtr convertPlatformTaskToAbstractTask(); - cal_struct *getPlatformTask() const; - Api::CalendarTaskPtr getAbstractTask() const; - void freePlatformTask(); - void saveTask(); - void loadTask(int id); - void deleteTask(); - bool matchFilters(Api::TaskFilterPtr filter); - - protected: - int getIDFromPlatformTask() const; - int getStatusFromPlatformTask() const; - int getPriorityFromPlatformTask() const; - - void setDescriptionToPlatformTask(); - void setSubjectToPlatformTask(); - void setDueDateToPlatformTask(); - void setStatusToPlatformTask(); - void setPriorityToPlatformTask(); - void setIDToPlatformTask(); - - void setDescriptionFromPlatformTask(); - void setSubjectFromPlatformTask(); - void setDueDateFromPlatformTask(); - void setStatusFromPlatformTask(); - void setPriorityFromPlatformTask(); - void setIDFromPlatformTask(); - private: - //temporaty solution to cover plafrorm bug - //int calendar_svc_struct_set_int(cal_struct* record, const char* field, int intval); - - void displayAbstractTask(); //only for debugging - void displayPlatformTask(); //only for debugging - - cal_struct *m_platformTask; - Api::CalendarTaskPtr m_abstractTask; -}; - -typedef DPL::SharedPtr TaskWrapperPtr; -} -} -#endif // WRTDEVICEAPIS_TASK_TASK_WRAPPER_H_ diff --git a/src/modules/tizen/Task/config.cmake b/src/modules/tizen/Task/config.cmake deleted file mode 100644 index 3003ff3..0000000 --- a/src/modules/tizen/Task/config.cmake +++ /dev/null @@ -1,27 +0,0 @@ -get_current_path() - -pkg_search_module(calendar REQUIRED calendar) -pkg_search_module(glib REQUIRED glib-2.0) -pkg_search_module(libpcrecpp REQUIRED libpcrecpp) - - -set(INCLUDES_PLATFORM_IMPLEMENTATION_TASK - ${calendar_INCLUDE_DIRS} - ${glib_INCLUDE_DIRS} - ${libpcrecpp_INCLUDE_DIRS} - PARENT_SCOPE -) - -set(LIBS_PLATFORM_IMPLEMENTATION_TASK - ${calendar_LIBRARIES} - ${glib_LIBRARIES} - ${libpcrecpp_LIBRARIES} - PARENT_SCOPE -) - -set(SRCS_PLATFORM_IMPLEMENTATION_TASK - ${CURRENT_PATH}/Task.cpp - ${CURRENT_PATH}/TaskManager.cpp - ${CURRENT_PATH}/TaskWrapper.cpp - PARENT_SCOPE -) diff --git a/src/modules/tizen/VConf/Key.cpp b/src/modules/tizen/VConf/Key.cpp deleted file mode 100644 index 5077e80..0000000 --- a/src/modules/tizen/VConf/Key.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Key.h" -#include -#include - -namespace WrtDeviceApis { -namespace VConf { -Key::Key(const char* name) : - m_callback(NULL), - m_callbackData(NULL) -{ - if (name != NULL) { - m_name = name; - } -} - -Key::~Key() -{ - detachCallback(); -} - -bool Key::attachCallback(KeyChangeCallback callback, - void* data) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - if (!callback) { - return false; - } - - DPL::Mutex::ScopedLock lock(&m_mtx); - bool firstTime = (m_callback == NULL); - m_callback = callback; - m_callbackData = data; - - if (firstTime) { - if (vconf_notify_key_changed(m_name.c_str(), Key::callback, - this) != 0) { - m_callback = NULL; - m_callbackData = NULL; - return false; - } - } - - return true; -} - -void Key::detachCallback() -{ - DPL::Mutex::ScopedLock lock(&m_mtx); - if (m_callback) { - assert(!m_name.empty() && "Key name cannot be empty."); - vconf_ignore_key_changed(m_name.c_str(), Key::callback); - m_callback = NULL; - m_callbackData = NULL; - } -} - -void Key::callback(keynode_t* node, - void* data) -{ - Key* this_ = static_cast(data); - if (this_) { - DPL::Mutex::ScopedLock lock(&this_->m_mtx); - if (this_->m_callback) { - NodePtr ptr(new Node(node)); - (*this_->m_callback)(ptr.Get(), this_->m_callbackData); - } - } -} - -bool Key::getBool() const -{ - assert(!m_name.empty() && "Key name cannot be empty."); - int result = 0; - if (vconf_get_bool(m_name.c_str(), &result) != 0) { - Throw(Commons::ConversionException); - } - return (result != 0); -} - -void Key::setValue(bool value) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - if (vconf_set_bool(m_name.c_str(), value) != 0) { - Throw(Commons::PlatformException); - } -} - -int Key::getInt() const -{ - assert(!m_name.empty() && "Key name cannot be empty."); - int result = 0; - if (vconf_get_int(m_name.c_str(), &result) != 0) { - Throw(Commons::ConversionException); - } - return result; -} - -void Key::setValue(int value) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - if (vconf_set_int(m_name.c_str(), value) != 0) { - Throw(Commons::PlatformException); - } -} - -double Key::getDouble() const -{ - assert(!m_name.empty() && "Key name cannot be empty."); - double result = 0; - if (vconf_get_dbl(m_name.c_str(), &result) != 0) { - Throw(Commons::ConversionException); - } - return result; -} - -void Key::setValue(double value) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - if (vconf_set_dbl(m_name.c_str(), value) != 0) { - Throw(Commons::PlatformException); - } -} - -std::string Key::getString() const -{ - assert(!m_name.empty() && "Key name cannot be empty."); - char* result = vconf_get_str(m_name.c_str()); - if (result == NULL) { - Throw(Commons::ConversionException); - } - return result; -} - -void Key::setValue(const std::string& value) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - setValue(value.c_str()); -} - -void Key::setValue(const char* value) -{ - assert(!m_name.empty() && "Key name cannot be empty."); - if (vconf_set_str(m_name.c_str(), value) != 0) { - Throw(Commons::PlatformException); - } -} - -void Key::reset(const char* name) -{ - detachCallback(); - m_name = (name == NULL ? std::string() : name); -} -} // VConf -} // WrtDeviceApis diff --git a/src/modules/tizen/VConf/Key.h b/src/modules/tizen/VConf/Key.h deleted file mode 100644 index afc3b1e..0000000 --- a/src/modules/tizen/VConf/Key.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_VCONFKEY_H_ -#define WRTDEVICEAPIS_VCONFKEY_H_ - -#include -#include -#include -#include -#include "Node.h" - -namespace WrtDeviceApis { -namespace VConf { -typedef void (*KeyChangeCallback)(const Node*, void*); - -class Key : private DPL::Noncopyable -{ - public: - /** - * Creates vconf key wrapper. - * @param name Key name or NULL (default). - */ - explicit Key(const char* name = NULL); - - ~Key(); - - /** - * Gets boolean value. - * @return Value of the key. - * @throw ConversionException If unable to get value. - */ - bool getBool() const; - - /** - * Sets boolean value for this key. - * @param value Value to set. - * @throw PlatformException If unable to perform the request. - */ - void setValue(bool value); - - /** - * Gets integer value. - * @return Value of the key. - * @throw ConversionException If unable to get value. - */ - int getInt() const; - - /** - * Sets integer value for this key. - * @param value Value to set. - * @throw PlatformException If unable to perform the request. - */ - void setValue(int value); - - /** - * Gets double value. - * @return Value of the key. - * @throw ConversionException If unable to get value. - */ - double getDouble() const; - - /** - * Sets double value for this key. - * @param value Value to set. - * @throw PlatformException If unable to perform the request. - */ - void setValue(double value); - - /** - * Gets string value. - * @return Value of the key. - * @throw ConversionException If unable to get value. - */ - std::string getString() const; - - /** - * Sets string value for this key. - * @param value Value to set. - * @throw PlatformException If unable to perform the request. - */ - void setValue(const std::string& value); - - /** - * Sets c-string value for this key. - * @param value Value to set. - * @throw PlatformException If unable to perform the request. - */ - void setValue(const char* value); - - /** - * Attaches on key value change callback. - * @param callback Callback function. - * @param data User data. - * @return True if callback has been successfully attached, false otherwsie. - * @remarks Does NOT take ownership over user data. - * @remarks Creating two independent keys then attaching the same callback to - * each and detaching it from one of them causes disconnection of - * this callback from vconf engine. - */ - bool attachCallback(KeyChangeCallback callback, - void* data); - - /** - * Detaches on key value change callback. - */ - void detachCallback(); - - /** - * Resets this object to wrap other key around. - * @param name Key name or NULL (default). - */ - void reset(const char* name = NULL); - - private: - /** - * Callback set to platform. - * @param node Key. - * @param data User data. - */ - static void callback(keynode_t* node, - void* data); - - private: - std::string m_name; ///< Key name. - KeyChangeCallback m_callback; ///< Callback. - void* m_callbackData; ///< Callback user data. - DPL::Mutex m_mtx; ///< Synchronize access to callback. -}; -} // VConf -} // WrtDeviceApis -#endif /* WRTDEVICEAPIS_VCONFKEY_H_ */ diff --git a/src/modules/tizen/VConf/Node.cpp b/src/modules/tizen/VConf/Node.cpp deleted file mode 100644 index 0698d5c..0000000 --- a/src/modules/tizen/VConf/Node.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "Node.h" -#include -#include - -namespace WrtDeviceApis { -namespace VConf { -Node::Node(keynode_t* node) : m_node(node) -{ - assert(m_node && "Node cannot be NULL."); - - m_name = vconf_keynode_get_name(m_node); - m_type = static_cast(vconf_keynode_get_type(m_node)); - if ((m_type != TYPE_BOOL) && (m_type != TYPE_INT) && - (m_type != TYPE_DOUBLE) && (m_type != TYPE_STRING)) { - Throw(Commons::UnsupportedException); - } -} - -std::string Node::getName() const -{ - return m_name; -} - -Node::Type Node::getType() const -{ - return m_type; -} -} // VConf -} // WrtDeviceApis diff --git a/src/modules/tizen/VConf/Node.h b/src/modules/tizen/VConf/Node.h deleted file mode 100644 index 75bc55a..0000000 --- a/src/modules/tizen/VConf/Node.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef WRTDEVICEAPIS_VCONF_NODE_H_ -#define WRTDEVICEAPIS_VCONF_NODE_H_ - -#include -#include -#include -#include - -namespace WrtDeviceApis { -namespace VConf { -class Key; - -class Node : private DPL::Noncopyable -{ - friend class Key; - - public: - /** - * Type of the node. - */ - enum Type - { - TYPE_BOOL = VCONF_TYPE_BOOL, //!< TYPE_BOOL - TYPE_INT = VCONF_TYPE_INT, //!< TYPE_INT - TYPE_DOUBLE = VCONF_TYPE_DOUBLE, //!< TYPE_DOUBLE - TYPE_STRING = VCONF_TYPE_STRING //!< TYPE_STRING - }; - - public: - /** - * Gets node name. - * @return Node's name. - */ - std::string getName() const; - - /** - * Gets node type. - * @return Node's type. - */ - Type getType() const; - - private: - explicit Node(keynode_t* node); - - private: - mutable keynode_t* m_node; - std::string m_name; ///< Name of the node. - Type m_type; ///< Type of the node. -}; - -typedef DPL::SharedPtr NodePtr; -} // VConf -} // WrtDeviceApis -#endif /* WRTDEVICEAPIS_VCONF_NODE_H_ */ diff --git a/src/modules/tizen/VConf/config.cmake b/src/modules/tizen/VConf/config.cmake deleted file mode 100644 index 59cd725..0000000 --- a/src/modules/tizen/VConf/config.cmake +++ /dev/null @@ -1,16 +0,0 @@ -get_current_path() - -pkg_search_module(vconf REQUIRED vconf) - -set(INCLUDES_PLATFORM_IMPLEMENTATION_VCONF - ${vconf_INCLUDE_DIRS} -) - -set(LIBS_PLATFORM_IMPLEMENTATION_VCONF - ${vconf_LIBRARIES} -) - -set(SRCS_PLATFORM_IMPLEMENTATION_VCONF - ${CURRENT_PATH}/Key.cpp - ${CURRENT_PATH}/Node.cpp -) diff --git a/src/modules/tizen/Widget/Widget.cpp b/src/modules/tizen/Widget/Widget.cpp index 07cb18b..3bc7341 100644 --- a/src/modules/tizen/Widget/Widget.cpp +++ b/src/modules/tizen/Widget/Widget.cpp @@ -24,7 +24,7 @@ #include #include - +#include #include "Widget.h" #include #include @@ -35,21 +35,23 @@ namespace Widget { using namespace std; using namespace WidgetDB::Api; -Widget::Widget(Commons::IWrtWrapperPtr wrapper) : - m_wrtWrapper(wrapper) +Widget::Widget() +{ + using namespace WrtDeviceApis::Commons; + m_widgetId = WrtAccessSingleton::Instance().getWidgetId(); +} + +Widget::~Widget() { - if (!wrapper) { - LogError("Wrapper is NULL"); - } } string Widget::getProperty(ConfigAttribute attr) const { - checkWrapperPointer(); + checkWidgetId(); string value; Try { - IWidgetDBPtr widgetDB = getWidgetDB(m_wrtWrapper->getWidgetId()); + IWidgetDBPtr widgetDB = getWidgetDB(m_widgetId); value = widgetDB->getConfigValue(attr); } Catch(Commons::InvalidArgumentException){ @@ -62,7 +64,7 @@ string Widget::getProperty(ConfigAttribute attr) const string Widget::getAuthor() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_author.isValid()) { m_author.setValue(getProperty(ConfigAttribute::AUTHOR_NAME)); @@ -72,7 +74,7 @@ string Widget::getAuthor() const string Widget::getAuthorEmail() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_authorEmail.isValid()) { m_authorEmail.setValue(getProperty(ConfigAttribute::AUTHOR_EMAIL)); @@ -82,7 +84,7 @@ string Widget::getAuthorEmail() const string Widget::getAuthorHref() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_authorHref.isValid()) { m_authorHref.setValue(getProperty(ConfigAttribute::AUTHOR_HREF)); @@ -92,7 +94,7 @@ string Widget::getAuthorHref() const string Widget::getDescription() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_description.isValid()) { m_description.setValue(getProperty(ConfigAttribute::DESCRIPTION)); @@ -102,7 +104,7 @@ string Widget::getDescription() const string Widget::getId() const { - checkWrapperPointer(); + checkWidgetId(); LogDebug("entered"); if (!m_id.isValid()) { @@ -113,7 +115,7 @@ string Widget::getId() const string Widget::getName() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_name.isValid()) { m_name.setValue(getProperty(ConfigAttribute::NAME)); @@ -123,7 +125,7 @@ string Widget::getName() const string Widget::getShortName() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_shortName.isValid()) { m_shortName.setValue(getProperty(ConfigAttribute::SHORT_NAME)); @@ -133,7 +135,7 @@ string Widget::getShortName() const string Widget::getVersion() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_version.isValid()) { m_version.setValue(getProperty(ConfigAttribute::VERSION)); @@ -143,7 +145,7 @@ string Widget::getVersion() const unsigned int Widget::getHeight() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_height.isValid()) { m_height.setValue(Commons::String::toInt( @@ -154,7 +156,7 @@ unsigned int Widget::getHeight() const unsigned int Widget::getWidth() const { - checkWrapperPointer(); + checkWidgetId(); if (!m_width.isValid()) { m_width.setValue(Commons::String::toInt( @@ -163,11 +165,11 @@ unsigned int Widget::getWidth() const return m_width.getValue(); } -void Widget::checkWrapperPointer() const +void Widget::checkWidgetId() const { - if (!m_wrtWrapper) { - LogError("Null pointer"); - Throw(Commons::NullPointerException); + if (m_widgetId < 0) { + LogError("Invalid widget id"); + Throw(Commons::InvalidArgumentException); } return; } diff --git a/src/modules/tizen/Widget/Widget.h b/src/modules/tizen/Widget/Widget.h index 2984fd0..eb2ca30 100644 --- a/src/modules/tizen/Widget/Widget.h +++ b/src/modules/tizen/Widget/Widget.h @@ -27,7 +27,7 @@ #include -#include +#include #include #include @@ -40,7 +40,8 @@ class Widget : public Api::IWidget { public: - explicit Widget(Commons::IWrtWrapperPtr wrtWrapper); + explicit Widget(); + ~Widget(); virtual std::string getAuthor() const; virtual std::string getAuthorEmail() const; @@ -55,8 +56,6 @@ class Widget : public Api::IWidget protected: - Commons::IWrtWrapperPtr m_wrtWrapper; - mutable StringProperty m_author; mutable StringProperty m_authorEmail; mutable StringProperty m_authorHref; @@ -71,8 +70,9 @@ class Widget : public Api::IWidget private: std::string getProperty(WidgetDB::Api::ConfigAttribute) const; + void checkWidgetId() const; - void checkWrapperPointer() const; + int m_widgetId; }; } diff --git a/src/modules/tizen/WidgetDB/WidgetDB.cpp b/src/modules/tizen/WidgetDB/WidgetDB.cpp old mode 100755 new mode 100644 index 2727beb..cb4d644 --- a/src/modules/tizen/WidgetDB/WidgetDB.cpp +++ b/src/modules/tizen/WidgetDB/WidgetDB.cpp @@ -37,6 +37,8 @@ #include #include +#include + #include "WidgetFeature.h" namespace { // anonymous @@ -97,9 +99,8 @@ std::string WidgetDB::getConfigValue(Api::ConfigAttribute attribute) const Try { WrtDB::WidgetDAOReadOnly dao(getWidgetId()); - std::string language = getLanguage(); - WrtDB::WidgetLocalizedInfo widgetInfo = dao.getLocalizedInfo( - DPL::FromUTF8String(language)); + WrtDB::WidgetLocalizedInfo widgetInfo = + W3CFileLocalization::getLocalizedInfo(getWidgetId()); std::ostringstream out; diff --git a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp index a6fe123..2ce1805 100644 --- a/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp +++ b/src/modules/tizen/WidgetInterfaceDAO/WidgetInterfaceDAO.cpp @@ -38,6 +38,8 @@ namespace { DPL::DB::SqlConnection::Flag::Type DATABASE_FLAGS = DPL::DB::SqlConnection::Flag::UseLucene; +DPL::DB::SqlConnection::Flag::Option DATABASE_OPTIONS = + DPL::DB::SqlConnection::Flag::RW; const char *KEY_WIDGET_ARG = "widget_arg"; } @@ -50,7 +52,7 @@ WidgetInterfaceDAO::WidgetInterfaceDAO(int widgetHandle) : if (!checkDatabase()) { LogError("There is a problem with database"); } - m_databaseInterface.AttachToThread(); + m_databaseInterface.AttachToThread(DPL::DB::SqlConnection::Flag::RW); } WidgetInterfaceDAO::~WidgetInterfaceDAO() @@ -83,7 +85,8 @@ bool WidgetInterfaceDAO::checkDatabase() Try { - DPL::DB::SqlConnection con(databaseFile); + DPL::DB::SqlConnection con(databaseFile, + DATABASE_FLAGS, DATABASE_OPTIONS); con.ExecCommand(buffer.str().c_str()); } Catch(DPL::DB::SqlConnection::Exception::Base) @@ -102,8 +105,8 @@ bool WidgetInterfaceDAO::copyPropertiesFromWrtDatabase() using namespace DPL::DB::ORM::widget_interface; bool result = true; - WrtDB::WrtDatabase::attachToThread(); - m_databaseInterface.AttachToThread(); + WrtDB::WrtDatabase::attachToThreadRO(); + m_databaseInterface.AttachToThread(DPL::DB::SqlConnection::Flag::RW); Try { @@ -163,14 +166,14 @@ void WidgetInterfaceDAO::setItem(const std::string& key, //check if key exists Properties::Select select(&m_databaseInterface); select.Where( - Equals(DPL::FromASCIIString(key))); + Equals(DPL::FromUTF8String(key))); std::list rows = select.GetRowList(); if (rows.size() == 0) { Properties::Insert insert(&m_databaseInterface); Properties::Row row; - row.Set_key(DPL::FromASCIIString(key)); - row.Set_value(DPL::FromASCIIString(value)); + row.Set_key(DPL::FromUTF8String(key)); + row.Set_value(DPL::FromUTF8String(value)); row.Set_readonly(readOnly ? 1 : 0); row.Set_configxml(fromConfigXml ? 1 : 0); insert.Values(row); @@ -182,10 +185,10 @@ void WidgetInterfaceDAO::setItem(const std::string& key, if (row.Get_readonly() != 0) { Throw(Commons::LocalStorageValueNoModifableException); } - row.Set_value(DPL::FromASCIIString(value)); + row.Set_value(DPL::FromUTF8String(value)); row.Set_readonly(readOnly ? 1 : 0); Properties::Update update(&m_databaseInterface); - update.Where(Equals(DPL::FromASCIIString(key))); + update.Where(Equals(DPL::FromUTF8String(key))); update.Values(row); update.Execute(); } @@ -207,14 +210,14 @@ void WidgetInterfaceDAO::removeItem(const std::string& key) Try { Properties::Select select(&m_databaseInterface); - select.Where(Equals(DPL::FromASCIIString(key))); + select.Where(Equals(DPL::FromUTF8String(key))); bool readonly = select.GetSingleValue(); if (readonly) { ThrowMsg(Commons::LocalStorageValueNoModifableException, "Cannot delete item. Item is readonly"); } Properties::Delete deleteItem(&m_databaseInterface); - deleteItem.Where(Equals(DPL::FromASCIIString(key))); + deleteItem.Where(Equals(DPL::FromUTF8String(key))); deleteItem.Execute(); } Catch(DPL::DB::SqlConnection::Exception::Base) @@ -233,7 +236,7 @@ DPL::Optional WidgetInterfaceDAO::getValue( Try { Properties::Select select(&m_databaseInterface); - select.Where(Equals(DPL::FromASCIIString(key))); + select.Where(Equals(DPL::FromUTF8String(key))); std::list value = select.GetValueList(); if (value.size() == 0) { return DPL::Optional(); @@ -320,7 +323,7 @@ std::string WidgetInterfaceDAO::databaseFileName(int widgetHandle) using namespace WrtDB::WidgetConfig; using namespace WrtDB::GlobalConfig; - WrtDB::WrtDatabase::attachToThread(); + WrtDB::WrtDatabase::attachToThreadRO(); std::stringstream filename; Try diff --git a/src/modules/tizen/config.cmake b/src/modules/tizen/config.cmake new file mode 100644 index 0000000..82b25da --- /dev/null +++ b/src/modules/tizen/config.cmake @@ -0,0 +1,3 @@ +include_config_file(Widget) +include_config_file(StorageEvent) +include_config_file(LocalStorage) \ No newline at end of file diff --git a/src/standards/CMakeLists.txt b/src/standards/CMakeLists.txt new file mode 100644 index 0000000..6bab9bf --- /dev/null +++ b/src/standards/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +set(STANDARD_FILE_DESTINATION /usr/lib/wrt-plugins) + +add_subdirectory(W3C) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/standard-features-list DESTINATION ${STANDARD_FILE_DESTINATION}) diff --git a/src/standards/W3C/CMakeLists.txt b/src/standards/W3C/CMakeLists.txt new file mode 100644 index 0000000..11828fb --- /dev/null +++ b/src/standards/W3C/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +add_subdir(Widget) diff --git a/src/standards/W3C/DESCRIPTION b/src/standards/W3C/DESCRIPTION new file mode 100644 index 0000000..8e32c7b --- /dev/null +++ b/src/standards/W3C/DESCRIPTION @@ -0,0 +1,2 @@ +!!!options!!! stop +W3C plugin - Widget Interface diff --git a/src/standards/W3C/Widget/AddEventListenerSupport.cpp b/src/standards/W3C/Widget/AddEventListenerSupport.cpp new file mode 100644 index 0000000..0f57035 --- /dev/null +++ b/src/standards/W3C/Widget/AddEventListenerSupport.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file AddEventListenerSupport.cpp + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#include "AddEventListenerSupport.h" + +#include +#include +#include +#include +#include "JSStorageEvent.h" + +namespace WrtPlugins { +namespace W3C { + +AddEventListenerSupport::IFramesListeners + AddEventListenerSupport::m_listeners = + AddEventListenerSupport::IFramesListeners(); + +JSContextRef AddEventListenerSupport::m_context = NULL; + +void AddEventListenerSupport::initializeContext(JSContextRef context) +{ + if(!m_context) m_context = context; +} + +bool AddEventListenerSupport::isInitialized() {return m_context!=NULL;} + +JSValueRef AddEventListenerSupport:: +AddEventListener(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("Add event listener invoked"); + LogDebug("This(iframe?):" << thisObject); + LogDebug("object:" << object); + + if (argumentCount < 2 || !JSValueIsString(context, arguments[0])) { + LogError("Wrong arguments"); + return JSValueMakeUndefined(context); + } + + std::string eventName = WrtDeviceApis::CommonsJavaScript:: + Converter(context).toString(arguments[0]); + + if(eventName != "storage"){ + LogDebug("Event type not supported"); + return JSValueMakeUndefined(context); + } + + JSValueProtect(m_context, arguments[1]); + JSObjectRef objectCb = + JSValueToObject(m_context, + arguments[1], + NULL); + if(!JSObjectIsFunction(m_context, objectCb)) + { + LogError("JS object is not a function"); + return JSValueMakeUndefined(context); + } + //add object to Listeners + CallbackData data = {objectCb, thisObject}; + getIFrameListeners(thisObject)->push_back(data); + + return JSValueMakeUndefined(context); +} + +void AddEventListenerSupport::CallListenersFromDifferentIFrames( + JSObjectRef iframe, + const WrtDeviceApis::StorageEvent::Api::IStorageEventPtr& event) +{ + LogDebug("Invoked callbacks"); + + FOREACH(it, m_listeners) + { + if(it->first == iframe){ + continue; + } + + auto eventPriv = new JSStorageEventPrivateObject(m_context, + event); + + JSObjectRef eventObject = + JSObjectMake(m_context, JSStorageEvent::getClassRef(), eventPriv); + const size_t argc = 1; + JSValueRef argv[argc] = {eventObject}; + + JSValueProtect(m_context, eventObject); + + FOREACH(listener, *it->second) + { + LogDebug("Call"); + + JSObjectCallAsFunction( + m_context, + listener->object, + NULL, + argc, + argv, + NULL); + } + + JSValueUnprotect(m_context, eventObject); + } + + LogDebug("Done"); +}; + +AddEventListenerSupport::ListenersPtr +AddEventListenerSupport::getIFrameListeners(JSObjectRef iframe){ + auto it = m_listeners.find(iframe); + if(it != m_listeners.end()){ + return it->second; + } + + return m_listeners[iframe] = ListenersPtr(new Listeners()); +} + +} +} diff --git a/src/standards/W3C/Widget/AddEventListenerSupport.h b/src/standards/W3C/Widget/AddEventListenerSupport.h new file mode 100644 index 0000000..44f39cd --- /dev/null +++ b/src/standards/W3C/Widget/AddEventListenerSupport.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file AddEventListenerSupport.h + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef _WRT_PLUGINS_SRC_W3C_WIDGET_ADDEVENTLISTENERSUPPORT_H_ +#define _WRT_PLUGINS_SRC_W3C_WIDGET_ADDEVENTLISTENERSUPPORT_H_ + +#include +#include +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +class AddEventListenerSupport +{ + public: + static void initializeContext(JSContextRef context); + + static bool isInitialized(); + + static JSValueRef AddEventListener(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static void CallListenersFromDifferentIFrames( + JSObjectRef iframe, + const WrtDeviceApis::StorageEvent::Api::IStorageEventPtr& event); + + private: + struct CallbackData{ + JSObjectRef object; + JSObjectRef thisObject; + }; + + typedef std::list Listeners; + typedef std::shared_ptr ListenersPtr; + + //first-iframe, 2nd - listeners list + typedef std::map IFramesListeners; + + static JSContextRef m_context; + static IFramesListeners m_listeners; + + private: + static ListenersPtr getIFrameListeners(JSObjectRef iframe); +}; + +} +} + +#endif diff --git a/src/standards/W3C/Widget/CMakeLists.txt b/src/standards/W3C/Widget/CMakeLists.txt new file mode 100755 index 0000000..6444650 --- /dev/null +++ b/src/standards/W3C/Widget/CMakeLists.txt @@ -0,0 +1,56 @@ +# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +set(TARGET_NAME "wrt-plugins-w3c-widget-interface") + +pkg_search_module(webkit REQUIRED ewebkit>=0.1.0) +pkg_search_module(wrt-plugin-api REQUIRED wrt-plugin-api>=0.7.0) + +set(SRCS + ${SRCS_COMMONS} + JSWidget.cpp + JSPreferences.cpp + JSStorageEvent.cpp + plugin_initializer.cpp + IFrameSupport.cpp + AddEventListenerSupport.cpp +) + +IF(W3C_TEST) +set(SRCS + ${SRCS} + JSTest.cpp + Test.cpp +) +ENDIF(W3C_TEST) + +include_directories( ${API_WIDGET_PATH} +# ${API_STORAGE_EVENT_PATH} +# ${API_LOCALSTORAGE_PATH} + ${webkit_INCLUDE_DIRS} + ${wrt-plugin-api_INCLUDE_DIRS} +) + +add_library(${TARGET_NAME} SHARED ${SRCS}) +target_link_libraries(${TARGET_NAME} + ${LIBS_COMMON} + ${TARGET_COMMONS} + ${TARGET_COMMONS_JAVASCRIPT} + wrt-plugins-widget + wrt-plugins-localstorage + wrt-plugins-storageevent +) + +INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${STANDARD_FILE_DESTINATION}/w3c-widget-interface) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config.xml DESTINATION ${STANDARD_FILE_DESTINATION}/w3c-widget-interface) diff --git a/src/standards/W3C/Widget/IFrameSupport.cpp b/src/standards/W3C/Widget/IFrameSupport.cpp new file mode 100644 index 0000000..45c4d41 --- /dev/null +++ b/src/standards/W3C/Widget/IFrameSupport.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file IFrameSupport.cpp + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#include "IFrameSupport.h" +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +IFrameSupport::IFramesContainer IFrameSupport::m_iframesObject = + IFrameSupport::IFramesContainer(); + + +void IFrameSupport::RegisterWidget(java_script_context_t global_context, + js_object_instance_t iframe, + js_object_instance_t object) +{ + LogDebug("New widget instance registered"); + LogDebug("iframe: " << iframe ); + LogDebug("object: " << object ); + getIFrameData(static_cast(iframe))->widget = + static_cast(object); +} + +void IFrameSupport::RegisterAddEventListener(java_script_context_t global_context, + js_object_instance_t iframe, + js_object_instance_t object) +{ + LogDebug("New addEventListener instance registered"); + LogDebug("iframe: " << iframe ); + LogDebug("object: " << object ); + getIFrameData(static_cast(iframe))->addEventListener + = static_cast(object); +} + +JSObjectRef IFrameSupport::getIFrameObjectForWidget(JSObjectRef widgetObject) +{ + FOREACH(it, m_iframesObject) + { + if(it->second->widget == widgetObject) + { + LogDebug("iframe found"); + return it->first; + } + } + LogDebug("Iframe not found"); + return NULL; +} + +IFrameDataPtr IFrameSupport::getIFrameData(JSObjectRef iframe) +{ + auto it = m_iframesObject.find(iframe); + if(it != m_iframesObject.end()){ + return it->second; + } + + return m_iframesObject[iframe] = IFrameDataPtr(new IFrameData()); +} + +} +} diff --git a/src/standards/W3C/Widget/IFrameSupport.h b/src/standards/W3C/Widget/IFrameSupport.h new file mode 100644 index 0000000..92f58f8 --- /dev/null +++ b/src/standards/W3C/Widget/IFrameSupport.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file IFrameSupport.h + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef _WRT_PLUGINS_SRC_W3C_WIDGET_IFRAME_SUPPORT_H_ +#define _WRT_PLUGINS_SRC_W3C_WIDGET_IFRAME_SUPPORT_H_ + +#include +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +struct IFrameData +{ + IFrameData() : widget(0), addEventListener(0){} + + JSObjectRef widget; + JSObjectRef addEventListener; +}; +typedef std::shared_ptr IFrameDataPtr; + + +class IFrameSupport +{ + public: + static void RegisterWidget(java_script_context_t global_context, + js_object_instance_t iframe, + js_object_instance_t object); + + static void RegisterAddEventListener(java_script_context_t global_context, + js_object_instance_t iframe, + js_object_instance_t object); + + static JSObjectRef getIFrameObjectForWidget(JSObjectRef widgetObject); + + private: + //map iframe:objects + typedef std::map IFramesContainer; + + static IFramesContainer m_iframesObject; + + private: + static IFrameDataPtr getIFrameData(JSObjectRef iframe); +}; + +} +} + +#endif diff --git a/src/standards/W3C/Widget/JSPreferences.cpp b/src/standards/W3C/Widget/JSPreferences.cpp new file mode 100644 index 0000000..78748b3 --- /dev/null +++ b/src/standards/W3C/Widget/JSPreferences.cpp @@ -0,0 +1,566 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSPreferences.cpp + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + */ + +#include "JSPreferences.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "IFrameSupport.h" +#include "AddEventListenerSupport.h" + +using namespace std; +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; +using namespace WrtDeviceApis::LocalStorage::Api; +using namespace WrtDeviceApis::StorageEvent::Api; + +#define PREFERENCES_PLUGIN_NAME "preferences" +#define LOCAL_STORAGE_PROPERTY_LENGTH "length" + +#define CATCH_EXCEPTION_NO_MODIFABLE \ + Catch(Commons::LocalStorageValueNoModifableException) {\ + LogError("The item is read only");\ + return JSDOMExceptionFactory::\ + NoModificationAllowedException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_CONVERSION \ + Catch(Commons::ConversionException) {\ + LogError("Error on conversion");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_NULL_PTR \ + Catch(Commons::NullPointerException) {\ + LogError("Error on pointer, null value");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_PLATFORM_ERROR \ + Catch(Commons::PlatformException){\ + LogError("PlatformException occured");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_SECURITY \ + Catch(Commons::SecurityException){\ + LogError("Security exception occured");\ + return JSDOMExceptionFactory::\ + SecurityException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_OUT_OF_RANGE \ + Catch(Commons::OutOfRangeException) {\ + LogError("OutOfRangeException");\ + return JSDOMExceptionFactory::\ + QuotaExceededException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_INVALID_ARG \ + Catch(Commons::InvalidArgumentException) {\ + LogError("Pair for given key doesnt exist");\ + return JSValueMakeNull(context);\ + } + +namespace WrtPlugins { +namespace W3C { + + +ILocalStoragePtr getIStorage(JSObjectRef arg) +{ + LogWarning("get localstorage object"); + + LocalStoragePrivateData* priv = + static_cast(JSObjectGetPrivate(arg)); + + if (!priv) { + LogError("Private object not initialized"); + ThrowMsg(Commons::NullPointerException, + "Private object not initialized"); + } + + return priv->istorage; +} + +JSObjectRef getWidgetObject(JSObjectRef arg) +{ + LogWarning("get widget object"); + + LocalStoragePrivateData* priv = + static_cast(JSObjectGetPrivate(arg)); + + if (!priv) { + LogError("Private object not initialized"); + ThrowMsg(Commons::NullPointerException, + "Private object not initialized"); + } + + return priv->widgetObject; + +} + +enum class ModificationType{ + RemoveItem, + SetItem +}; + +//this function may throw exceptions +IStorageEventPtr modifyItemAndCreateEvent(ModificationType type, + JSObjectRef thisObject, + const string& key, + const string& value = std::string()) +{ + DPL::Optional oldValue = + getIStorage(thisObject)->getValue(key); + + if (ModificationType::SetItem == type) + { + getIStorage(thisObject)->setItem(key, value, false); + } + else if (ModificationType::RemoveItem == type) + { + getIStorage(thisObject)->removeItem(key); + } + else + { + Assert(0 && "Wrong Modification type"); + } + + DPL::Optional newValue = + getIStorage(thisObject)->getValue(key); + + //create event object + IStorageEventPtr storageEvent = getStorageEvent(); + + //key + storageEvent->setKey(key); + //oldvalue + if (!!oldValue) { storageEvent->setOldValue(*oldValue); } + //newValue + if(!!newValue){ storageEvent->setNewValue(*newValue); } + + return storageEvent; +} + + +JSClassDefinition JSPreferences::m_classInfo = +{ + 0, + kJSClassAttributeNone, + PREFERENCES_PLUGIN_NAME, + 0, + m_property, + m_function, + initialize, + finalize, + hasProperty, + getProperty, + setProperty, + NULL,//DeleteProperty, + NULL,//GetPropertyNames, + NULL,//CallAsFunction, + NULL,//CallAsConstructor, + NULL,//HasInstance, + NULL,//ConvertToType, +}; + +JSStaticFunction JSPreferences::m_function[] = { + { "setItem", JSPreferences::setItem, kJSPropertyAttributeNone }, + { "removeItem", JSPreferences::removeItem, kJSPropertyAttributeNone }, + { "getItem", JSPreferences::getItem, kJSPropertyAttributeNone }, + { "clear", JSPreferences::clear, kJSPropertyAttributeNone }, + { "key", JSPreferences::key, kJSPropertyAttributeNone }, + { 0, 0, 0 } +}; + +JSStaticValue JSPreferences::m_property[] = +{ + {LOCAL_STORAGE_PROPERTY_LENGTH, + JSPreferences::getLength, + NULL, + kJSPropertyAttributeReadOnly}, + { 0, 0, 0, 0 } +}; + +const JSClassRef JSPreferences::getClassRef() +{ + if (!m_jsClassRef) { + m_jsClassRef = JSClassCreate(&m_classInfo); + } + return m_jsClassRef; +} + +const JSClassDefinition* JSPreferences::getClassInfo() +{ + return &m_classInfo; +} + +JSClassRef JSPreferences::m_jsClassRef = + JSClassCreate(JSPreferences::getClassInfo()); + +void JSPreferences::initialize(JSContextRef context, + JSObjectRef object) +{ + LogDebug("entered"); + + if( !AddEventListenerSupport::isInitialized()) + { + AddEventListenerSupport::initializeContext(context); + } + + LocalStoragePrivateData* priv = + static_cast(JSObjectGetPrivate(object)); + + Assert(priv && "private object of preferences is NULL"); +} + +void JSPreferences::finalize(JSObjectRef object) +{ + LogDebug("entered"); + LocalStoragePrivateData* priv = + static_cast(JSObjectGetPrivate(object)); + + delete priv; + LogDebug("private object is realised"); +} + +JSValueRef JSPreferences::removeItem(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered"); + + Try { + Converter converter(context); + + std::string key = converter.toString(arguments[0]); + + auto event = modifyItemAndCreateEvent(ModificationType::RemoveItem, + thisObject, + key); + + auto iframe = IFrameSupport:: + getIFrameObjectForWidget(getWidgetObject(thisObject)); + + Assert(iframe && "Iframe is NULL"); + + AddEventListenerSupport:: + CallListenersFromDifferentIFrames(iframe, event); + + LogDebug("end"); + return JSValueMakeNull(context); + } + CATCH_EXCEPTION_NO_MODIFABLE + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSPreferences::setItem(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered"); + LogDebug("This: " << thisObject); + LogDebug("Object: " << object); + + Try { + Converter converter(context); + + std::string key = converter.toString(arguments[0]); + std::string value = converter.tryString(arguments[1]); + + auto event = modifyItemAndCreateEvent(ModificationType::SetItem, + thisObject, + key, + value); + + auto iframe = IFrameSupport:: + getIFrameObjectForWidget(getWidgetObject(thisObject)); + Assert(iframe && "Iframe is NULL"); + + AddEventListenerSupport:: + CallListenersFromDifferentIFrames(iframe, event); + + LogDebug("end"); + + return JSValueMakeUndefined(context); + } + CATCH_EXCEPTION_NO_MODIFABLE + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_OUT_OF_RANGE +} + + +JSValueRef JSPreferences::clear(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered"); + + Try { + getIStorage(thisObject)->clear(false); + + + auto iframe = IFrameSupport:: + getIFrameObjectForWidget(getWidgetObject(thisObject)); + + Assert(iframe && "Iframe is NULL"); + + //create event object + IStorageEventPtr storageEvent = getStorageEvent(); + + AddEventListenerSupport:: + CallListenersFromDifferentIFrames(iframe, storageEvent); + + LogDebug("end"); + + return JSValueMakeNull(context); + } + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSPreferences::getItem(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered"); + + Try { + Converter converter(context); + + std::string key = converter.tryString(arguments[0]); + + LogDebug("Getting item for key " << key); + + DPL::Optional value = + getIStorage(thisObject)->getValue(key); + + if (!value) + return JSValueMakeNull(context); + else + return converter.toJSValueRef(*value); + } + CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSPreferences::key(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("entered"); + + Try{ + if (argumentCount<1) { + LogError("No argument found"); + Throw(Commons::InvalidArgumentException); + } + + Converter converter(context); + + size_t n = converter.toSizeT(arguments[0]); + + std::string value = getIStorage(thisObject)->getValueByIndex(n); + + LogDebug("end"); + + return converter.toJSValueRef(value); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_INVALID_ARG +} + +JSValueRef JSPreferences::getLength(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("enter"); + + Try + { + Converter converter(context); + + size_t value = getIStorage(object)->getStorageSize(); + return converter.toJSValueRef(value); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY + CATCH_EXCEPTION_INVALID_ARG +} + +bool JSPreferences::hasProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName) +{ + LogDebug("enter"); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + + if(!getIStorage(object)->getValue(key)) { + return false; + } else { + return true; + } + } + + Catch(Commons::InvalidArgumentException) { + LogDebug("Pair for given key doesnt exist"); + } + + Catch(Commons::ConversionException) { + LogError("Error on conversion"); + } + + Catch(Commons::NullPointerException) { + LogError("Error on pointer, null value"); + } + + Catch(Commons::PlatformException){ + LogError("PlatformException occured"); + } + return false; +} + +JSValueRef JSPreferences::getProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("enter"); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + + DPL::Optional value = + getIStorage(object)->getValue(key); + + LogDebug("end"); + + if (!value) + return JSValueMakeNull(context); + else + return converter.toJSValueRef(*value); + } + + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_INVALID_ARG +} + +bool JSPreferences::setProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef jvalue, + JSValueRef* exception) +{ + LogDebug("enter"); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + std::string value = converter.toString(jvalue); + + auto event = modifyItemAndCreateEvent(ModificationType::SetItem, + object, + key, + value); + + auto iframe = IFrameSupport:: + getIFrameObjectForWidget(getWidgetObject(object)); + Assert(iframe && "Iframe is NULL"); + + AddEventListenerSupport:: + CallListenersFromDifferentIFrames(iframe, event); + + LogDebug("end"); + + return true; + } + CATCH_EXCEPTION_NO_MODIFABLE + CATCH_EXCEPTION_OUT_OF_RANGE + CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY + + return false; +} + +#undef CATCH_EXCEPTION_NO_MODIFABLE +#undef CATCH_EXCEPTION_CONVERSION +#undef CATCH_EXCEPTION_NULL_PTR +#undef CATCH_EXCEPTION_PLATFORM_ERROR +#undef CATCH_EXCEPTION_SECURITY +#undef CATCH_EXCEPTION_OUT_OF_RANGE +#undef CATCH_EXCEPTION_INVALID_ARG + +} +} diff --git a/src/standards/W3C/Widget/JSPreferences.h b/src/standards/W3C/Widget/JSPreferences.h new file mode 100644 index 0000000..c91d4c5 --- /dev/null +++ b/src/standards/W3C/Widget/JSPreferences.h @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSPreferences.h + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef _WRT_PLUGIN_JS_WIDGET_PREFERENCES_H_ +#define _WRT_PLUGIN_JS_WIDGET_PREFERENCES_H_ + +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +struct LocalStoragePrivateData{ + WrtDeviceApis::LocalStorage::Api::ILocalStoragePtr istorage; + //parent + JSObjectRef widgetObject; +}; + +class JSPreferences +{ +public: + /** + * This method initializes this in the JS Engine. + */ + static const 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); + + /** + * This structure contains properties and callbacks + * that define a type of object. + */ + static JSClassDefinition m_classInfo; + + /** + * This structure describes a statically declared function. + */ + static JSStaticFunction m_function[]; + + static JSStaticValue m_property[]; + + static JSClassRef m_jsClassRef; + + //Modified functions for Preference object + static JSValueRef removeItem(JSContextRef context, JSObjectRef object, + JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef setItem(JSContextRef context, JSObjectRef object, + JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef getItem(JSContextRef context, JSObjectRef object, + JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef clear(JSContextRef context, JSObjectRef object, + JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef key(JSContextRef context, JSObjectRef object, + JSObjectRef thisObject, size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef getLength(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static bool hasProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName); + + static JSValueRef getProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static bool setProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef value, + JSValueRef* exception); + +}; +} +} + +#endif diff --git a/src/standards/W3C/Widget/JSStorageEvent.cpp b/src/standards/W3C/Widget/JSStorageEvent.cpp new file mode 100644 index 0000000..db0f8d3 --- /dev/null +++ b/src/standards/W3C/Widget/JSStorageEvent.cpp @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSStorageEvent.cpp + * @author Andrzej Surdej (a.surdej@samsung.com) + * @version 0.1 + */ + +#include "JSStorageEvent.h" +#include +#include +#include +#include +#include +#include "JSPreferences.h" + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; +using namespace WrtDeviceApis::StorageEvent::Api; + +#define WIDGET_PLUGIN_NAME "StorageEvent" + +#define WRT_STORAGE_EVENT_PROPERTY_KEY "key" +#define WRT_STORAGE_EVENT_PROPERTY_OLD_VALUE "oldValue" +#define WRT_STORAGE_EVENT_PROPERTY_NEW_VALUE "newValue" +#define WRT_STORAGE_EVENT_PROPERTY_URL "url" +#define WRT_STORAGE_EVENT_PROPERTY_STORAGE_AREA "storageArea" + +#define CATCH_EXCEPTION_CONVERSION \ + Catch(Commons::ConversionException) {\ + LogError("Error on conversion");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_NULL_PTR \ + Catch(Commons::NullPointerException) {\ + LogError("Error on pointer, null value");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_PLATFORM_ERROR \ + Catch(Commons::PlatformException){\ + LogError("PlatformException occured");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_SECURITY \ + Catch(Commons::SecurityException){\ + LogError("Security exception occured");\ + return JSDOMExceptionFactory::\ + SecurityException.make(context, exception);\ + } + +namespace WrtPlugins { +namespace W3C { +JSClassDefinition JSStorageEvent::m_classInfo = { + 0, + kJSClassAttributeNone, + WIDGET_PLUGIN_NAME, + 0, + m_property, + NULL, + initialize, + finalize, + NULL, //HasProperty, + NULL, //GetProperty, + NULL, //SetProperty, + NULL, //DeleteProperty, + NULL, //GetPropertyNames, + NULL, //CallAsFunction, + NULL, //CallAsConstructor, + NULL, //HasInstance, + NULL, //ConvertToType, +}; + +JSStaticValue JSStorageEvent::m_property[] = { + { WRT_STORAGE_EVENT_PROPERTY_KEY, JSStorageEvent::getKey, + 0, kJSPropertyAttributeReadOnly }, + { WRT_STORAGE_EVENT_PROPERTY_OLD_VALUE, JSStorageEvent::getOldValue, + 0, kJSPropertyAttributeReadOnly }, + { WRT_STORAGE_EVENT_PROPERTY_NEW_VALUE, JSStorageEvent::getNewValue, + 0, kJSPropertyAttributeReadOnly }, + { WRT_STORAGE_EVENT_PROPERTY_URL, JSStorageEvent::getUrl, + 0, kJSPropertyAttributeReadOnly }, + { WRT_STORAGE_EVENT_PROPERTY_STORAGE_AREA, JSStorageEvent::getStorageArea, + 0, kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +const JSClassRef JSStorageEvent::getClassRef() +{ + if (!m_jsClassRef) { + m_jsClassRef = JSClassCreate(&m_classInfo); + } + return m_jsClassRef; +} + +const JSClassDefinition* JSStorageEvent::getClassInfo() +{ + return &m_classInfo; +} + +JSClassRef JSStorageEvent::m_jsClassRef = JSClassCreate(JSStorageEvent::getClassInfo()); + +void JSStorageEvent::initialize(JSContextRef context, + JSObjectRef object) +{ + LogDebug("entered"); + + JSStorageEventPrivateObject* priv = + static_cast(JSObjectGetPrivate(object)); + + Assert(priv && "Missing private object"); +} + +void JSStorageEvent::finalize(JSObjectRef object) +{ + LogDebug("entered"); + JSStorageEventPrivateObject* priv = + static_cast(JSObjectGetPrivate(object)); + + delete priv; + LogDebug("private object is realised"); + +} + +JSValueRef JSStorageEvent::getKey( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try + { + Converter converter(context); + + return converter.toJSValueRef(getPrivateObject(object)->getKey()); + + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSStorageEvent::getOldValue( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try + { + Converter converter(context); + + DPL::OptionalString oldValue = getPrivateObject(object)->getOldValue(); + + if(!oldValue) { + return JSValueMakeNull(context); + } else { + return converter.toJSValueRef(DPL::ToUTF8String(*oldValue)); + } + + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSStorageEvent::getNewValue( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try + { + Converter converter(context); + + DPL::OptionalString newValue = getPrivateObject(object)->getNewValue(); + + if(!newValue) { + return JSValueMakeNull(context); + } else { + return converter.toJSValueRef(DPL::ToUTF8String(*newValue)); + } + + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +JSValueRef JSStorageEvent::getUrl( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try + { + Converter converter(context); + + return converter.toJSValueRef(getPrivateObject(object)->getUrl()); + + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR +} + +JSValueRef JSStorageEvent::getStorageArea( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try + { + LogError("Not implemented"); + return JSValueMakeUndefined(context); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR + CATCH_EXCEPTION_SECURITY +} + +IStorageEventPtr JSStorageEvent::getPrivateObject(JSObjectRef arg) +{ + JSStorageEventPrivateObject* priv = + static_cast(JSObjectGetPrivate(arg)); + + if (!priv) { + LogError("Private object not initialized"); + ThrowMsg(Commons::NullPointerException, + "Private object not initialized"); + } + + return priv->getObject(); +} + +#undef CATCH_EXCEPTION_CONVERSION +#undef CATCH_EXCEPTION_NULL_PTR +#undef CATCH_EXCEPTION_PLATFORM_ERROR +#undef CATCH_EXCEPTION_SECURITY + +} +} diff --git a/src/standards/W3C/Widget/JSStorageEvent.h b/src/standards/W3C/Widget/JSStorageEvent.h new file mode 100644 index 0000000..67bde4d --- /dev/null +++ b/src/standards/W3C/Widget/JSStorageEvent.h @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSStorageEvent.h + * @author Andrzej Surdej (a.surdej@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef _WRT_PLUGIN_JS_STORAGE_EVENT_H_ +#define _WRT_PLUGIN_JS_STORAGE_EVENT_H_ + +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT< + WrtDeviceApis::StorageEvent::Api::IStorageEventPtr>::Type + JSStorageEventPrivateObject; + +class JSStorageEvent +{ + public: + /** + * This method initializes this in the JS Engine. + */ + static const 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); + + /** + * This structure describes a statically declared value property. + */ + static JSStaticValue m_property[]; + + /** + * This structure contains properties and callbacks that define a type of object. + */ + static JSClassDefinition m_classInfo; + + static JSClassRef m_jsClassRef; + + // getters for properties + static JSValueRef getKey( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getOldValue( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getNewValue( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getUrl( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getStorageArea( + JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static WrtDeviceApis::StorageEvent::Api::IStorageEventPtr + getPrivateObject(JSObjectRef arg); +}; +} // W3C +} // WrtPlugins + +#endif // _WRT_PLUGIN_JS_STORAGE_EVENT_H_ diff --git a/src/standards/W3C/Widget/JSTest.cpp b/src/standards/W3C/Widget/JSTest.cpp new file mode 100644 index 0000000..80d77fb --- /dev/null +++ b/src/standards/W3C/Widget/JSTest.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSTest.cpp + * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) + * @version 0.1 + */ + +#include +#include +#include +#include +#include "JSTest.h" +#include "Test.h" + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; + +#define CLASS_NAME "Test" + +namespace WrtPlugins { +namespace W3C { + +JSClassDefinition JSTest::m_classInfo = +{ + 0, + kJSClassAttributeNone, + CLASS_NAME, + 0, + NULL, + m_functions, + initialize, + finalize, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +JSStaticFunction JSTest::m_functions[] = { + { "setEvaluator", JSTest::setEvaluator, kJSPropertyAttributeNone }, + { "run", JSTest::run, kJSPropertyAttributeNone }, + { 0, 0, 0 } +}; + +const JSClassRef JSTest::getClassRef() { + if (!m_jsClassRef) { + m_jsClassRef = JSClassCreate(&m_classInfo); + } + return m_jsClassRef; +} + +const JSClassDefinition* JSTest::getClassInfo() { + return &m_classInfo; +} + +JSClassRef JSTest::m_jsClassRef = JSClassCreate(JSTest::getClassInfo()); + +void JSTest::initialize(JSContextRef context, JSObjectRef object) { + LogDebug("ENTER"); + + Test* priv = static_cast(JSObjectGetPrivate(object)); + if (!priv) { + priv = new Test(); + JSObjectSetPrivate(object, static_cast(priv)); + } + priv->setContext(context); +} + +void JSTest::finalize(JSObjectRef object) { + LogDebug("ENTER"); + delete static_cast(JSObjectGetPrivate(object)); +} + +JSValueRef JSTest::setEvaluator(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("ENTER"); + + Assert(argumentCount >= 1 && "Not enough arguments."); + + try { + JSObjectRef evaluator = CommonsJavaScript::Converter(context).toJSObjectRef(arguments[0]); + getPrivateObject(thisObject)->setEvaluator(evaluator); + } + catch (const Commons::Exception& ex) { + LogError("Exception: " << ex.DumpToString()); + } + + return JSValueMakeUndefined(context); +} + +JSValueRef JSTest::run(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception) +{ + LogDebug("ENTER"); + + try { + double timeout = 0.0; + if (argumentCount >= 1) { + timeout = CommonsJavaScript::Converter(context).toDouble(arguments[0]); + } + + getPrivateObject(thisObject)->run(timeout); + } + catch (const Commons::Exception& ex) { + LogError("Exception: " << ex.DumpToString()); + } + + return JSValueMakeUndefined(context); +} + +Test* JSTest::getPrivateObject(JSObjectRef thisObject) { + Test* priv = static_cast(JSObjectGetPrivate(thisObject)); + Assert(priv && "Private object not available."); + + return priv; +} + +} +} diff --git a/src/standards/W3C/Widget/JSTest.h b/src/standards/W3C/Widget/JSTest.h new file mode 100644 index 0000000..22155e5 --- /dev/null +++ b/src/standards/W3C/Widget/JSTest.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSTest.h + * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef WRT_PLUGIN_JS_WIDGET_TEST_H_ +#define WRT_PLUGIN_JS_WIDGET_TEST_H_ + +#include + +namespace WrtPlugins { +namespace W3C { + +class Test; + +class JSTest { + public: + static const JSClassRef getClassRef(); + + static const JSClassDefinition* getClassInfo(); + + private: + static void initialize(JSContextRef context, JSObjectRef object); + + static void finalize(JSObjectRef object); + + static JSClassDefinition m_classInfo; + + static JSStaticFunction m_functions[]; + + static JSClassRef m_jsClassRef; + + static JSValueRef setEvaluator(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static JSValueRef run(JSContextRef context, + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); + + static Test* getPrivateObject(JSObjectRef thisObject); +}; + +} +} + +#endif diff --git a/src/standards/W3C/Widget/JSWidget.cpp b/src/standards/W3C/Widget/JSWidget.cpp new file mode 100644 index 0000000..3adba57 --- /dev/null +++ b/src/standards/W3C/Widget/JSWidget.cpp @@ -0,0 +1,538 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSWidget.cpp + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + */ + +#include "JSWidget.h" +#include +#include +#include +#include +#include +#include +#include "JSPreferences.h" +#include +#include "IFrameSupport.h" +#include +#include + + +#define CATCH_EXCEPTION_NO_MODIFABLE \ + Catch(Commons::LocalStorageValueNoModifableException) {\ + LogError("The item is read only");\ + return JSDOMExceptionFactory::\ + NoModificationAllowedException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_CONVERSION \ + Catch(Commons::ConversionException) {\ + LogError("Error on conversion");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_NULL_PTR \ + Catch(Commons::NullPointerException) {\ + LogError("Error on pointer, null value");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_PLATFORM_ERROR \ + Catch(Commons::PlatformException){\ + LogError("PlatformException occured");\ + return JSDOMExceptionFactory::\ + UnknownException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_SECURITY \ + Catch(Commons::SecurityException){\ + LogError("Security exception occured");\ + return JSDOMExceptionFactory::\ + SecurityException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_OUT_OF_RANGE \ + Catch(Commons::OutOfRangeException) {\ + LogError("OutOfRangeException");\ + return JSDOMExceptionFactory::\ + QuotaExceededException.make(context, exception);\ + } + +#define CATCH_EXCEPTION_INVALID_ARG \ + Catch(Commons::InvalidArgumentException) {\ + LogError("Pair for given key doesnt exist");\ + return JSValueMakeNull(context);\ + } + +#define WIDGET_PLUGIN_NAME "Widget" + +#define WRT_WIDGET_PROPERTY_AUTHOR "author" +#define WRT_WIDGET_PROPERTY_AUTHOR_EMAIL "authorEmail" +#define WRT_WIDGET_PROPERTY_AUTHOR_HREF "authorHref" +#define WRT_WIDGET_PROPERTY_DESCRIPTION "description" +#define WRT_WIDGET_PROPERTY_ID "id" +#define WRT_WIDGET_PROPERTY_NAME "name" +#define WRT_WIDGET_PROPERTY_SHORT_NAME "shortName" +#define WRT_WIDGET_PROPERTY_VERSION "version" +#define WRT_WIDGET_PROPERTY_HEIGHT "height" +#define WRT_WIDGET_PROPERTY_WIDTH "width" + +namespace WrtPlugins { +namespace W3C { + +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; +using namespace WrtDeviceApis::CommonsJavaScript; +using namespace WrtDeviceApis::Widget; + + +struct WidgetPrivateObject +{ + Widget::Api::IWidgetPtr iwidget; + JSObjectRef preferencesObject; + //TEMP + int widgetId; + JSObjectRef widgetObject; +}; +typedef std::shared_ptr WidgetPrivateObjectPtr; + +typedef WrtDeviceApis::CommonsJavaScript::PrivateObjectT + ::Type JSWidgetPrivateObject; + +WrtDeviceApis::Widget::Api::IWidgetPtr getIWidget(JSObjectRef arg) +{ + JSWidgetPrivateObject* priv = + static_cast(JSObjectGetPrivate(arg)); + + if (!priv) { + LogError("Private object not initialized"); + ThrowMsg(Commons::NullPointerException, + "Private object not initialized"); + } + + return priv->getObject()->iwidget; +} + + +LocalStorage::Api::ILocalStoragePtr getLocalStorage(int widgetId) +{ + static int id = widgetId; + Assert(id == widgetId && "SPA is not longer supported"); + + static LocalStorage::Api::ILocalStoragePtr storage( + LocalStorage::Api::getLocalStorage(widgetId)); + + return storage; +} + +JSObjectRef getPreferences(JSObjectRef arg) +{ + JSWidgetPrivateObject* priv = + static_cast(JSObjectGetPrivate(arg)); + + if (!priv) { + LogError("Private object not initialized"); + return NULL; + } + + return priv->getObject()->preferencesObject; +} + +JSObjectRef createPreferencesObject(JSContextRef context, + JSObjectRef widgetObject, + int widgetId) +{ + Assert(widgetObject && "Widget Object can'n be null"); + //delete is invoked in JSPreferences::finalize + LocalStoragePrivateData* priv = new LocalStoragePrivateData; + Assert(priv && "Private data is null"); + priv->istorage = getLocalStorage(widgetId); + priv->widgetObject = widgetObject; + + JSObjectRef preferences = JSObjectMake(context, + JSPreferences::getClassRef(), + priv); + + if(!preferences){ + LogError("Preferences object is null"); + delete priv; + } + //Unprotect is called in JSWidget::finalize + JSValueProtect(context, preferences); + + return preferences; +}; + + +JSClassDefinition JSWidget::m_classInfo = { + 0, + kJSClassAttributeNone, + WIDGET_PLUGIN_NAME, + 0, + m_property, + NULL, + initialize, + finalize, + hasProperty, + getProperty, + setProperty, + NULL, //DeleteProperty, + NULL, //GetPropertyNames, + NULL, //CallAsFunction, + NULL, //CallAsConstructor, + NULL, //HasInstance, + NULL, //ConvertToType, +}; + +JSStaticValue JSWidget::m_property[] = { + { WRT_WIDGET_PROPERTY_AUTHOR, JSWidget::getAuthor, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_AUTHOR_EMAIL, JSWidget::getAuthorEmail, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_AUTHOR_HREF, JSWidget::getAuthorHref, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_DESCRIPTION, JSWidget::getDescription, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_ID, JSWidget::getId, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_NAME, JSWidget::getName, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_SHORT_NAME, JSWidget::getShortName, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_VERSION, JSWidget::getVersion, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_HEIGHT, JSWidget::getHeight, + 0, kJSPropertyAttributeReadOnly }, + { WRT_WIDGET_PROPERTY_WIDTH, JSWidget::getWidth, + 0, kJSPropertyAttributeReadOnly }, + { 0, 0, 0, 0 } +}; + +const JSClassRef JSWidget::getClassRef() +{ + if (!m_jsClassRef) { + m_jsClassRef = JSClassCreate(&m_classInfo); + } + return m_jsClassRef; +} + +const JSClassDefinition* JSWidget::getClassInfo() +{ + return &m_classInfo; +} + +JSClassRef JSWidget::m_jsClassRef = JSClassCreate(JSWidget::getClassInfo()); + +void JSWidget::initialize(JSContextRef context, + JSObjectRef object) +{ + LogDebug("entered"); + LogError("object " << object); + + JSWidgetPrivateObject* priv = + static_cast(JSObjectGetPrivate(object)); + + if (!priv) { + LogDebug("creation private object"); + + Try { + using namespace WrtDeviceApis::Commons; + + Widget::Api::IWidgetPtr widget = + Api::WidgetFactory::createWidget(); + int widgetId = WrtAccessSingleton::Instance().getWidgetId(); + JSObjectRef preferences = + createPreferencesObject(context, + object, + widgetId); + if(!preferences){ + LogError("Failed to create preferences object"); + } + + WidgetPrivateObjectPtr widgetPriv(new WidgetPrivateObject); + widgetPriv->iwidget = widget; + widgetPriv->preferencesObject = preferences; + + priv = new JSWidgetPrivateObject(context, widgetPriv); + JSObjectSetPrivate(object, priv); + LogDebug("private object created"); + + } + Catch(Commons::InvalidArgumentException){ + LogError("You should register widget id in ON_WIDGET_START"); + return; + } + + } +} + +void JSWidget::finalize(JSObjectRef object) +{ + LogDebug("entered"); + JSWidgetPrivateObject* priv = + static_cast(JSObjectGetPrivate(object)); + + JSValueUnprotect(priv->getContext(), priv->getObject()->preferencesObject); + + delete priv; + LogDebug("private object is realised"); +} + +JSValueRef JSWidget::getAuthor(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("entered"); + + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getAuthor()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getAuthorEmail(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getAuthorEmail()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getAuthorHref(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getAuthorHref()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getDescription(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getDescription()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getId(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getId()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getName(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getName()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getShortName(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getShortName()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getVersion(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getVersion()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getHeight(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getHeight()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +JSValueRef JSWidget::getWidth(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + Try { + Converter converter(context); + return converter.toJSValueRef(getIWidget(object)->getWidth()); + } + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_PLATFORM_ERROR +} + +bool JSWidget::hasProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName) +{ + LogDebug("enter"); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + if(key=="preferences"){ + return true; + } + } + Catch(Commons::InvalidArgumentException) { + LogDebug("Pair for given key doesnt exist"); + } + + Catch(Commons::ConversionException) { + LogError("Error on conversion"); + } + + Catch(Commons::NullPointerException) { + LogError("Error on pointer, null value"); + } + + Catch(Commons::PlatformException){ + LogError("PlatformException occured"); + } + + return false; +} + +JSValueRef JSWidget::getProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception) +{ + LogDebug("Object: " << object); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + + if(key=="preferences"){ + Converter converter(context); + JSObjectRef pref = getPreferences(object); + if (!pref) + { + LogError("Preferences object is NULL"); + return JSValueMakeUndefined(context); + } + return pref; + } + LogError("Property NOT supported: " << propertyName); + return JSValueMakeUndefined(context); + } + + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + CATCH_EXCEPTION_INVALID_ARG +} + +bool JSWidget::setProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef jvalue, + JSValueRef* exception) +{ + LogDebug("enter"); + + Try{ + Converter converter(context); + + std::string key = converter.toString(propertyName); + if (key == "preferences"){ + LogError("Object is read only"); + return true; + } + } + CATCH_EXCEPTION_INVALID_ARG + CATCH_EXCEPTION_CONVERSION + CATCH_EXCEPTION_NULL_PTR + + return false; +} + +#undef CATCH_EXCEPTION_NO_MODIFABLE +#undef CATCH_EXCEPTION_CONVERSION +#undef CATCH_EXCEPTION_NULL_PTR +#undef CATCH_EXCEPTION_PLATFORM_ERROR +#undef CATCH_EXCEPTION_SECURITY +#undef CATCH_EXCEPTION_OUT_OF_RANGE +#undef CATCH_EXCEPTION_INVALID_ARG + +} +} diff --git a/src/standards/W3C/Widget/JSWidget.h b/src/standards/W3C/Widget/JSWidget.h new file mode 100644 index 0000000..0ae68f5 --- /dev/null +++ b/src/standards/W3C/Widget/JSWidget.h @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file JSWidget.h + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef _WRT_PLUGIN_JS_WIDGET_H_ +#define _WRT_PLUGIN_JS_WIDGET_H_ + +#include +#include + +namespace WrtPlugins { +namespace W3C { + + +class JSWidget +{ + public: + /** + * This method initializes this in the JS Engine. + */ + static const 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); + + /** + * This structure describes a statically declared value property. + */ + static JSStaticValue m_property[]; + + /** + * This structure contains properties and callbacks that define a type of object. + */ + static JSClassDefinition m_classInfo; + + static JSClassRef m_jsClassRef; + + // getters for properties + static JSValueRef getAuthor(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getAuthorEmail(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getAuthorHref(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getDescription(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getId(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getName(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getShortName(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getVersion(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getHeight(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + static JSValueRef getWidth(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static bool hasProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName); + + static JSValueRef getProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef* exception); + + static bool setProperty(JSContextRef context, + JSObjectRef object, + JSStringRef propertyName, + JSValueRef value, + JSValueRef* exception); +}; +} +} + +#endif /* _WRT_PLUGIN_JS_WIDGET_INTERFACE_H_ */ diff --git a/src/standards/W3C/Widget/Test.cpp b/src/standards/W3C/Widget/Test.cpp new file mode 100644 index 0000000..f53f3c8 --- /dev/null +++ b/src/standards/W3C/Widget/Test.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Test.cpp + * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) + * @version 1.0 + * @date 09/13/2011 08:31:09 AM + * @brief + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Test.h" + +using namespace WrtDeviceApis; +//using namespace WrtDeviceApis::Commons; +//using namespace WrtDeviceApis::CommonsJavaScript; + +namespace WrtPlugins { +namespace W3C { + +Test::Test() + : m_context(NULL), + m_evaluator(NULL) +{ + DPL::Event::ControllerEventHandler::Touch(); +} + +void Test::run(double timeout) { + PostTimedEvent(FinishEvent(), timeout); +} + +void Test::setEvaluator(JSObjectRef evaluator) { + m_evaluator = evaluator; +} + +void Test::setContext(JSContextRef context) { + m_context = context; +} + +void Test::OnEventReceived(const FinishEvent& event) { + LogDebug("ENTER"); + + Result result = Result::Success; + if (m_evaluator && m_context) { + JSValueRef eval = JSObjectCallAsFunction(m_context, + m_evaluator, + NULL, + 0, + NULL, + NULL); + if (eval) { + if (JSValueIsBoolean(m_context, eval)) { + if (!JSValueToBoolean(m_context, eval)) { + result = Result::Fail; + } + } + else { + LogError("Evaluator returned value of wrong type."); + result = Result::Exception; + } + } + else { + LogError("Evaluator did not return any value."); + result = Result::Exception; + } + } + + + FILE* output = fdopen(4, "w"); + if (output) { + Commons::IWrtWrapperPtr wrt = + Commons::WrtWrappersMgr::getInstance().getWrtWrapper(m_context); + WidgetDB::Api::IWidgetDBPtr widgetDB = + WidgetDB::Api::getWidgetDB(wrt->getWidgetId()); + + fprintf(output, + "%d\t%s\t%s\n", + wrt->getWidgetId(), + widgetDB->getConfigValue( + WidgetDB::Api::ConfigAttribute::NAME).c_str(), + resultToString(result).c_str()); + fclose(output); + } else { + LogInfo("Output descriptor not created."); + } + + pid_t pid = getpid(); + LogDebug("Sending SIGINT to " << pid); + if (kill(pid, SIGINT) != 0) { + LogError("Sending SIGINT failed."); + } +} + +std::string Test::resultToString(Result result) { + switch (result) { + case Result::Success: return "OK"; + case Result::Fail: return "FAIL"; + case Result::Exception: return "EXCEPTION"; + default: + Assert(false && "Unsupported result type."); + } +} + +} +} diff --git a/src/standards/W3C/Widget/Test.h b/src/standards/W3C/Widget/Test.h new file mode 100644 index 0000000..f102274 --- /dev/null +++ b/src/standards/W3C/Widget/Test.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Test.h + * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) + * @version 1.0 + * @date 09/13/2011 08:24:44 AM + * @brief + */ + +#ifndef WRTPLUGINS_W3C_TEST_H_ +#define WRTPLUGINS_W3C_TEST_H_ + +#include +#include +#include +#include +#include + +namespace WrtPlugins { +namespace W3C { + +DECLARE_GENERIC_EVENT_0(FinishEvent) + +class Test : public DPL::Event::Controller::Type> { + public: + Test(); + + void run(double timeout = 0.0); + void setEvaluator(JSObjectRef evaluator); + void setContext(JSContextRef context); + + protected: + void OnEventReceived(const FinishEvent& event); + + private: + enum class Result { + Success, + Fail, + Exception + }; + + private: + std::string resultToString(Result result); + + private: + JSContextRef m_context; + JSObjectRef m_evaluator; +}; + +} +} +#endif diff --git a/src/standards/W3C/Widget/config.xml b/src/standards/W3C/Widget/config.xml new file mode 100644 index 0000000..594e1b8 --- /dev/null +++ b/src/standards/W3C/Widget/config.xml @@ -0,0 +1,24 @@ + + + + libwrt-plugins-w3c-widget-interface.so + xxx + SAMSUNG plugin group + SAMSUNG certificate authority + AAAABBBBCCCCDDDEEEE0000 + + + http://w3cWidgetInterface.com/w3c-widget-interface + + + + + + + + + + + + + diff --git a/src/standards/W3C/Widget/plugin_initializer.cpp b/src/standards/W3C/Widget/plugin_initializer.cpp new file mode 100644 index 0000000..f03858a --- /dev/null +++ b/src/standards/W3C/Widget/plugin_initializer.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + * @file plugin_initializer.cpp + * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) + * @version 0.1 + * @brief + */ + +#include + +#include +#include + +#include "JSWidget.h" +#include "JSPreferences.h" +#include "JSTest.h" + +#include "IFrameSupport.h" +#include "AddEventListenerSupport.h" + +#define OBJECT_WIDGET "widget" +#define OBJECT_PREFERENCES "preferences" +#define OBJECT_TEST "__test" + +using namespace WrtPlugins::W3C; +using namespace WrtDeviceApis; +using namespace WrtDeviceApis::Commons; + +namespace Options{ + +class_definition_options_t WidgetOptions = +{ + JS_CLASS, + CREATE_INSTANCE, + ALWAYS_NOTICE, + USE_OVERLAYED, //ignored + IFrameSupport::RegisterWidget, + NULL +}; + +class_definition_options_t AddEventListenerOptions = +{ + JS_FUNCTION, + CREATE_INSTANCE, + ALWAYS_NOTICE, + OVERLAYED_BEFORE_ORIGINAL, + IFrameSupport::RegisterAddEventListener, + NULL +}; + +}; + +void on_widget_start_callback(int widgetId) +{ + LogDebug("[W3C\\widget] on_widget_start_callback (" << widgetId << ")"); + + Try + { + WrtAccessSingleton::Instance().initialize(widgetId); + } + Catch (Commons::Exception) + { + LogError("Wrt wrapper registration failed"); + return; + } +} + +void on_widget_stop_callback(int widgetId) +{ + LogDebug("[W3C\\widget] on_widget_stop_callback (" << widgetId << ")"); + Try + { + WrtAccessSingleton::Instance().deinitialize(widgetId); + } + Catch (Commons::Exception) + { + LogError("Wrt wrapper registration failed"); + return; + } + +} + +PLUGIN_ON_WIDGET_START(on_widget_start_callback) +PLUGIN_ON_WIDGET_STOP(on_widget_stop_callback) + +PLUGIN_CLASS_MAP_BEGIN +PLUGIN_CLASS_MAP_ADD_CLASS (WRT_JS_EXTENSION_OBJECT_GLOBAL, + OBJECT_WIDGET, + WrtPlugins::W3C::JSWidget::getClassRef(), + &Options::WidgetOptions) +//PLUGIN_CLASS_MAP_ADD_CLASS(OBJECT_WIDGET, +// OBJECT_PREFERENCES, +// WrtPlugins::W3C::JSPreferences::getClassRef(), +// NULL) +//Function::AddEventListener +PLUGIN_CLASS_MAP_ADD_CLASS (WRT_JS_EXTENSION_OBJECT_GLOBAL, + "addEventListener", + (const void*) + AddEventListenerSupport::AddEventListener, + &Options::AddEventListenerOptions) +#ifdef W3C_TEST +PLUGIN_CLASS_MAP_ADD_CLASS(OBJECT_WIDGET, + OBJECT_TEST, + WrtPlugins::W3C::JSTest::getClassRef(), + NULL) +#endif // W3C_TEST +PLUGIN_CLASS_MAP_END + +#undef OBJECT_WIDGET +#undef OBJECT_PREFERENCES diff --git a/src/standards/standard-features-list b/src/standards/standard-features-list new file mode 100644 index 0000000..4ef06c8 --- /dev/null +++ b/src/standards/standard-features-list @@ -0,0 +1 @@ +http://w3cWidgetInterface.com/w3c-widget-interface diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 6e00c3f..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# @file CMakeLists.txt -# @author Lukasz Marek (l.marek@samsung.com) -# @version 1.0 -# @brief -# - -# -# Test files -# -# Define all wrt-plugins-common tests sources. -# Runner is responsible for runnint it all and -# generating proper output files -# - -SET(TARGET_NAME wrt-plugins-commons-test) - -pkg_search_module(dpl REQUIRED dpl-efl>=1.0.0) -pkg_search_module(dpl-test REQUIRED dpl-test-efl) -pkg_search_module(dpl-wrt-dao-ro REQUIRED dpl-wrt-dao-ro) - -SET(WRT_PLUGINS_COMMONS_TESTS_SOURCES - ${PROJECT_SOURCE_DIR}/tests/main.cpp - ${PROJECT_SOURCE_DIR}/tests/test_widget_interface_dao.cpp -) - -SET(WRT_PLUGINS_COMMONS_TESTS_DIR - ${PROJECT_SOURCE_DIR}/src/ - ${PROJECT_SOURCE_DIR}/src/Commons/ - ${PROJECT_SOURCE_DIR}/src/CommonsJavaScript/ - ${PROJECT_SOURCE_DIR}/src/modules/tizen/ - ${PROJECT_SOURCE_DIR}/src/modules/API/ - ${PROJECT_SOURCE_DIR}/tests -) - -include_directories( - ${WRT_PLUGINS_COMMONS_TESTS_DIR} - ${dpl_INCLUDE_DIRS} - ${dpl-wrt-dao-ro_INCLUDE_DIRS} - ${dpl-test_INCLUDE_DIRS} -) - -ADD_EXECUTABLE(${TARGET_NAME} - ${WRT_PLUGINS_COMMONS_TESTS_SOURCES} -) - -TARGET_LINK_LIBRARIES(${TARGET_NAME} - ${dpl_LIBRARIES} - ${dpl-test_LIBRARIES} - ${dpl-wrt-dao-ro_LIBRARIES} - "wrt-plugins-widget-interface-dao" -) - -SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin/ - BUILD_WITH_INSTALL_RPATH ON - INSTALL_RPATH_USE_LINK_PATH ON -) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/wrt_plugins_commons_test_prepare_db.sh - ${PROJECT_SOURCE_DIR}/bin/wrt_plugins_commons_test_prepare_db.sh COPYONLY) diff --git a/tests/main.cpp b/tests/main.cpp deleted file mode 100644 index ffc8e9b..0000000 --- a/tests/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file main.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 1.0 - * @brief This file is the implementation file of main - */ - -#include -#include - -int main(int argc, char *argv[]) -{ - int ret = system("./wrt_plugins_commons_test_prepare_db.sh start"); - - if (!WIFEXITED(ret) || WEXITSTATUS(ret)) - { - LogDebug("Fail while preparing database. Restoring"); - system("./wrt_plugins_commons_test_prepare_db.sh stop"); - return -1; - } - - ret = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv); - - system("./wrt_plugins_commons_test_prepare_db.sh stop"); - - return ret; -} - diff --git a/tests/test_widget_interface_dao.cpp b/tests/test_widget_interface_dao.cpp deleted file mode 100644 index 77edab6..0000000 --- a/tests/test_widget_interface_dao.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * @file test_widget_interface_dao.cpp - * @author Lukasz Marek (l.marek@samsung.com) - * @version 1.0 - * @brief This is the implementation file of test widget interface dao. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace { -const std::string FAKE_WIDGET_DIR = "/opt/apps/org.tizen."; -const std::string WIDGET_DATA_SUBDIR = "data/"; -const std::string DATABASE_NAME = "widget_interface.db"; - -//Following variable is an arbitraty number. -//It must match value inserted to wrt database by -//wrt_plugins_commons_test_prepare_db script. -const int FAKE_WIDGET_ID = 65537; -} - -using namespace WrtDeviceApis; - -RUNNER_TEST_GROUP_INIT(WidgetInterfaceDAO) - -class FakeWidget -{ -public: - FakeWidget() : - m_fakeWidgetId(FAKE_WIDGET_ID) - { - std::stringstream baseDir; - baseDir << FAKE_WIDGET_DIR << m_fakeWidgetId << "/"; - m_fakeWidgetBaseDir = baseDir.str(); - - std::string widgetDataDir = - m_fakeWidgetBaseDir + WIDGET_DATA_SUBDIR; - - m_fakeWidgetDatabaseFile = widgetDataDir + DATABASE_NAME; - - if ((mkdir(baseDir.str().c_str(), 0777) < 0) || - (mkdir(widgetDataDir.c_str(), 0777) < 0)) - { - LogError("Cannot create test directory"); - } - } - - ~FakeWidget() - { - std::string command = "rm -rf "; - command.append(m_fakeWidgetBaseDir); - int ret = system(command.c_str()); - if (!WIFEXITED(ret) || WEXITSTATUS(ret)) - { - LogWarning("Fake widget directory is not deleted!"); - } - } - - int widgetId() const - { - return m_fakeWidgetId; - } - - std::string dataBaseFile() const - { - return m_fakeWidgetDatabaseFile; - } - -private: - int m_fakeWidgetId; - std::string m_fakeWidgetBaseDir; - std::string m_fakeWidgetDatabaseFile; -}; - -RUNNER_TEST(DatabaseCreateOnFirstUse) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - int ret = access(w.dataBaseFile().c_str(), F_OK); - - LogDebug("filename " << w.dataBaseFile() << " result " << ret); - - RUNNER_ASSERT(ret == 0); -} - -RUNNER_TEST(GetStorageSize) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key", "value", false); - - RUNNER_ASSERT(dao.getStorageSize() == 1); - - dao.removeItem("key"); - - RUNNER_ASSERT(dao.getStorageSize() == 0); -} - -RUNNER_TEST(RemoveItem) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key", "value", false); - - RUNNER_ASSERT(dao.getStorageSize() == 1); - - dao.setItem("key", "value", true); - - RUNNER_ASSERT(dao.getStorageSize() == 1); - - bool exCaught = false; - try - { - dao.removeItem("key"); - } - catch(const Commons::LocalStorageValueNoModifableException &ex) - { - exCaught = true; - } - - RUNNER_ASSERT(dao.getStorageSize() == 1 && exCaught); -} - -RUNNER_TEST(GetValueExisting) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", false); - dao.setItem("key2", "value2", false); - - DPL::Optional val1 = dao.getValue("key1"); - DPL::Optional val2 = dao.getValue("key2"); - - RUNNER_ASSERT(!val1.IsNull() && *val1 == "value1"); - RUNNER_ASSERT(!val2.IsNull() && *val2 == "value2"); - -} - -RUNNER_TEST(GetValueNonExisting) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - DPL::Optional val1 = dao.getValue("key1"); - - RUNNER_ASSERT(val1.IsNull()); -} - -RUNNER_TEST(Clear) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", false); - dao.setItem("key2", "value1", false); - RUNNER_ASSERT(dao.getStorageSize() == 2); - - dao.clear(false); - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", true); - dao.setItem("key2", "value1", true); - RUNNER_ASSERT(dao.getStorageSize() == 2); - - dao.clear(false); - RUNNER_ASSERT(dao.getStorageSize() == 2); - - dao.clear(true); - RUNNER_ASSERT(dao.getStorageSize() == 0); -} - -RUNNER_TEST(UpdateValue) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", false); - DPL::Optional val1 = dao.getValue("key1"); - RUNNER_ASSERT(!val1.IsNull() && *val1 == "value1"); - - dao.setItem("key1", "value2", false); - val1 = dao.getValue("key1"); - RUNNER_ASSERT(!val1.IsNull() && *val1 == "value2"); - - RUNNER_ASSERT(dao.getStorageSize() == 1); -} - -RUNNER_TEST(UpdateReadOnlyValue) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", true); - DPL::Optional val1 = dao.getValue("key1"); - RUNNER_ASSERT(!val1.IsNull() && *val1 == "value1"); - - bool exCaught = false; - try - { - dao.setItem("key1", "value2", false); - } - catch(const Commons::LocalStorageValueNoModifableException &ex) - { - exCaught = true; - } - - RUNNER_ASSERT(dao.getStorageSize() == 1 && exCaught); -} - -RUNNER_TEST(GetValueByIndex) -{ - FakeWidget w; - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", false); - dao.setItem("key2", "value2", false); - RUNNER_ASSERT(dao.getStorageSize() == 2); - - std::string val1 = dao.getValueByIndex(0); - std::string val2 = dao.getValueByIndex(1); - - RUNNER_ASSERT((val1 == "value1" && val2 == "value2") || - (val2 == "value1" && val1 == "value2")); -} - -RUNNER_TEST(DataPersistent) -{ - FakeWidget w; - { - WidgetInterfaceDAO dao(w.widgetId()); - - RUNNER_ASSERT(dao.getStorageSize() == 0); - - dao.setItem("key1", "value1", false); - dao.setItem("key2", "value2", false); - } - - { - WidgetInterfaceDAO dao(w.widgetId()); - DPL::Optional val1 = dao.getValue("key1"); - DPL::Optional val2 = dao.getValue("key2"); - - RUNNER_ASSERT(!val1.IsNull() && *val1 == "value1"); - RUNNER_ASSERT(!val2.IsNull() && *val2 == "value2"); - } -} diff --git a/tests/wrt_plugins_commons_test_prepare_db.sh b/tests/wrt_plugins_commons_test_prepare_db.sh deleted file mode 100755 index e0058b7..0000000 --- a/tests/wrt_plugins_commons_test_prepare_db.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -WRT_DB=/opt/dbspace/.wrt.db -WRT_DB_BCK=/tmp/wrt.db_backup - -if [ "x$1" == "xstart" ]; then - echo start; - cp $WRT_DB $WRT_DB_BCK - wrt_reset_db.sh; - - #insert some fake widget into to make widget interface dao tests working corectly - INS_ALL_WIDGET="insert into WidgetInfo(app_id, widget_id, widget_version, widget_width, widget_height, author_name, author_email, author_href, base_folder, webkit_plugins_required, child_protection, recognized, wac_signed, distributor_signed, min_version, slp_pkgname)"; - sqlite3 $WRT_DB "${INS_ALL_WIDGET} VALUES(65537, 'w_id_2000', '1.0.0', 100, 200, 'a_name_2000', 'a_email_2000', 'a_href_2000', 'basef_2000', 1, 1, 1, 1, 1, '1.0', 'org.tizen.65537')"; - - exit $? -elif [ "x$1" == "xstop" ]; then - echo stop; - cp $WRT_DB_BCK $WRT_DB - exit $? -else - exit 1 -fi -- 2.7.4